royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [royale-compiler] 02/03: fix matching selectors that have different namespace prefixes that map to same uri
Date Fri, 28 Sep 2018 03:34:58 GMT
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 86e3719fa3038c45a0ee7a3282c27a88b3b89afa
Author: Alex Harui <aharui@apache.org>
AuthorDate: Thu Sep 27 20:32:55 2018 -0700

    fix matching selectors that have different namespace prefixes that map to same uri
---
 .../java/org/apache/royale/compiler/css/ICSSSelector.java     | 11 +++++++++++
 .../org/apache/royale/compiler/internal/css/CSSSelector.java  | 11 +++++++++++
 .../compiler/internal/css/codegen/CSSCompilationSession.java  |  2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/css/ICSSSelector.java b/compiler/src/main/java/org/apache/royale/compiler/css/ICSSSelector.java
index d09e751..f3da29a 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/css/ICSSSelector.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/css/ICSSSelector.java
@@ -91,6 +91,17 @@ public interface ICSSSelector extends ICSSNode
     /**
      * This API is explicitly added so that no CSS compilation logic will depend
      * on {@code toString()} value of an {@link ICSSNode}.
+     * This version is used so that Basic|SomeClass in one css file 
+     * will match SomeClass in another css file.  The code that uses this has already resolved
+     * the namespace prefix to an actual uri.
+     * 
+     * @return The CSS text from which this selector is generated without any namespace prefixes
+     */
+    String getCSSSyntaxNoNamespaces();
+
+    /**
+     * This API is explicitly added so that no CSS compilation logic will depend
+     * on {@code toString()} value of an {@link ICSSNode}.
      * 
      * @return The CSS text from which this selector is generated.
      */
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSSelector.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSSelector.java
index cf04c61..6efc239 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSSelector.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSSelector.java
@@ -105,6 +105,17 @@ public class CSSSelector extends CSSNodeBase implements ICSSSelector
         return result.toString();
     }
 
+    public String getCSSSyntaxNoNamespaces()
+    {
+        final StringBuilder result = new StringBuilder();
+        if (combinator != null)
+            result.append(combinator.getSelector().toString()).append(combinator.getCombinatorType().text);
+        if (elementName != null)
+            result.append(elementName);
+        result.append(stringifyConditions(conditions));
+        return result.toString();
+    }
+
     @Override
     public String stringifyConditions(List<ICSSSelectorCondition> conditions)
     {
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/css/codegen/CSSCompilationSession.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/css/codegen/CSSCompilationSession.java
index dd2c48f..a9599e5 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/css/codegen/CSSCompilationSession.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/css/codegen/CSSCompilationSession.java
@@ -310,7 +310,7 @@ public class CSSCompilationSession
                 selectorQname = qname;
         }
         final String resolvedSelectorName = selectorQname.concat(
-                selector.getCSSSyntax());
+                selector.getCSSSyntaxNoNamespaces());
         return resolvedSelectorName;
     }
 


Mime
View raw message