Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3E5FF200CC9 for ; Mon, 17 Jul 2017 16:45:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 68405160D17; Mon, 17 Jul 2017 14:45:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8DDF1160D5F for ; Mon, 17 Jul 2017 16:45:33 +0200 (CEST) Received: (qmail 90979 invoked by uid 500); 17 Jul 2017 14:45:31 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 90971 invoked by uid 99); 17 Jul 2017 14:45:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 14:45:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5AC1FDFF36; Mon, 17 Jul 2017 14:45:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Message-Id: <722cf2d4d36449a48718fae886f9fece@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-falcon] [refs/heads/develop] - fix css output. encoder could use a refactor Date: Mon, 17 Jul 2017 14:45:31 +0000 (UTC) archived-at: Mon, 17 Jul 2017 14:45:35 -0000 Repository: flex-falcon Updated Branches: refs/heads/develop 920cc51f8 -> 309900734 fix css output. encoder could use a refactor Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/30990073 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/30990073 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/30990073 Branch: refs/heads/develop Commit: 3099007347ad0f95ae2a0886d7899274937536ea Parents: 920cc51 Author: Alex Harui Authored: Mon Jul 17 07:45:27 2017 -0700 Committer: Alex Harui Committed: Mon Jul 17 07:45:27 2017 -0700 ---------------------------------------------------------------------- .../js/flexjs/JSCSSCompilationSession.java | 58 ++++++++++++++++++++ .../internal/css/codegen/CSSReducer.java | 10 ++++ 2 files changed, 68 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/30990073/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java index a3a9d54..902b624 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java @@ -324,6 +324,64 @@ public class JSCSSCompilationSession extends CSSCompilationSession } result.append("]"); } + else if (value instanceof CSSMultiValuePropertyValue) + { + ImmutableList values = ((CSSMultiValuePropertyValue)value).getElements(); + result.append("["); + boolean firstone = true; + for (ICSSPropertyValue val : values) + { + if (firstone) + firstone = false; + else + result.append(", "); + if (val instanceof CSSStringPropertyValue) + { + result.append("\"" + ((CSSStringPropertyValue)val).getValue() + "\""); + } + else if (val instanceof CSSColorPropertyValue) + { + result.append(new Integer(((CSSColorPropertyValue)val).getColorAsInt())); + } + else if (val instanceof CSSRgbColorPropertyValue) + { + result.append(new Integer(((CSSRgbColorPropertyValue)val).getColorAsInt())); + } + else if (value instanceof CSSRgbaColorPropertyValue) + { + //todo: handle alpha in the RGBA ? + result.append(new Integer(((CSSRgbaColorPropertyValue)value).getColorAsInt())); + } + else if (val instanceof CSSKeywordPropertyValue) + { + CSSKeywordPropertyValue keywordValue = (CSSKeywordPropertyValue)val; + String keywordString = keywordValue.getKeyword(); + if (IASLanguageConstants.TRUE.equals(keywordString)) + result.append("true"); + else if (IASLanguageConstants.FALSE.equals(keywordString)) + result.append("false"); + else + result.append("\"" + ((CSSKeywordPropertyValue)val).getKeyword() + "\""); + } + else if (val instanceof CSSNumberPropertyValue) + { + result.append(new Double(((CSSNumberPropertyValue)val).getNumber().doubleValue())); + } + else if (val instanceof CSSURLAndFormatPropertyValue) + { + result.append("\"" + ((CSSURLAndFormatPropertyValue)val).toString() + "\""); + } + else if (val instanceof CSSMultiValuePropertyValue) + { + result.append("\"" + ((CSSMultiValuePropertyValue)val).toString() + "\""); + } + else + { + result.append("unexpected value type: " + val.toString()); + } + } + result.append("]"); + } else if (value instanceof CSSStringPropertyValue) { result.append("\"" + ((CSSStringPropertyValue)value).getValue() + "\""); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/30990073/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java index 0d4d82b..87bdcdb 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java @@ -55,6 +55,7 @@ import org.apache.flex.compiler.internal.css.CSSColorPropertyValue; import org.apache.flex.compiler.internal.css.CSSFontFace; import org.apache.flex.compiler.internal.css.CSSFunctionCallPropertyValue; import org.apache.flex.compiler.internal.css.CSSKeywordPropertyValue; +import org.apache.flex.compiler.internal.css.CSSMultiValuePropertyValue; import org.apache.flex.compiler.internal.css.CSSNumberPropertyValue; import org.apache.flex.compiler.internal.css.CSSRgbColorPropertyValue; import org.apache.flex.compiler.internal.css.CSSRgbaColorPropertyValue; @@ -539,6 +540,15 @@ public class CSSReducer implements ICSSCodeGenResult } valueInstructions.addInstruction(ABCConstants.OP_newarray, arrayValue.getElements().size()); } + else if (value instanceof CSSMultiValuePropertyValue) + { + final CSSMultiValuePropertyValue arrayValue = (CSSMultiValuePropertyValue)value; + for (final ICSSPropertyValue elementValue : arrayValue.getElements()) + { + valueInstructions.addAll(getInstructionListForPropertyValue(elementValue)); + } + valueInstructions.addInstruction(ABCConstants.OP_newarray, arrayValue.getElements().size()); + } else { assert false : "Unsupported property value: " + value;