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
The following commit(s) were added to refs/heads/develop by this push:
new f251ddd fix a bunch of CSS bugs. Fixes #31 and #32
f251ddd is described below
commit f251ddd34f0225ae6b12582c6d554284513f63af
Author: Alex Harui <[email protected]>
AuthorDate: Thu Mar 22 19:04:56 2018 -0700
fix a bunch of CSS bugs. Fixes #31 and #32
---
.../driver/js/royale/JSCSSCompilationSession.java | 17 ++++++++++++++-
.../test/resources/royale/files/CSSTestSource.css | 20 +++++++++++++++++
.../royale/files/CSSTestSource_encoded_result.txt | 3 ++-
.../royale/files/CSSTestSource_result.css | 25 ++++++++++++++++++++++
.../apache/royale/compiler/internal/css/CSSTree.g | 2 +-
.../apache/royale/compiler/css/ConditionType.java | 5 +++++
6 files changed, 69 insertions(+), 3 deletions(-)
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java
index 11b777a..8d79948 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/royale/JSCSSCompilationSession.java
@@ -132,6 +132,15 @@ public class JSCSSCompilationSession extends
CSSCompilationSession
condition = s.substring(colon);
s = s.substring(0, colon);
}
+ else
+ {
+ int brace = s.indexOf("[");
+ if (brace != -1)
+ {
+ condition = s.substring(brace);
+ s = s.substring(0, brace);
+ }
+ }
if (!htmlElementNames.contains(s.toLowerCase()))
{
int pipe = s.indexOf("|");
@@ -207,6 +216,7 @@ public class JSCSSCompilationSession extends
CSSCompilationSession
List<String> htmlElementNames = Arrays.asList(
"body",
"button",
+ "input",
"span"
);
@@ -248,7 +258,12 @@ public class JSCSSCompilationSession extends
CSSCompilationSession
selName = formatQualifiedName(selName);
ImmutableList<ICSSSelectorCondition> conds =
sel.getConditions();
for (ICSSSelectorCondition cond : conds)
- selName += cond.toString();
+ {
+ String condString = cond.toString();
+ if (condString.contains("\""))
+ condString = condString.replace("\"", "\\\"");
+ selName += condString;
+ }
result.append("\"" + selName + "\"");
}
}
diff --git a/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
b/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
index e4fa9a0..4cbca85 100755
--- a/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
+++ b/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
@@ -125,3 +125,23 @@
-webkit-transform: translate(0,-1px);
transform: translate(0,-1px)
}
+
+.jewel.textfield > input {
+ padding: 0;
+}
+
+.jewel.checkbox > input[type="checkbox"] {
+ padding: 0;
+}
+
+.slider::-webkit-slider-thumb {
+ padding: 0;
+}
+
+.jewel.slider input[type="range"] {
+ padding: 0;
+}
+
+input[type="range"] {
+ padding: 0;
+}
diff --git
a/compiler-jx/src/test/resources/royale/files/CSSTestSource_encoded_result.txt
b/compiler-jx/src/test/resources/royale/files/CSSTestSource_encoded_result.txt
index f440a84..8ebbe37 100755
---
a/compiler-jx/src/test/resources/royale/files/CSSTestSource_encoded_result.txt
+++
b/compiler-jx/src/test/resources/royale/files/CSSTestSource_encoded_result.txt
@@ -33,5 +33,6 @@ this["left"] = 0.0;
this["padding"] = 0.0;
this["border"] = 0.0;
this["WebkitTransform"] = null;
-this["top"] = 50.0}];
+this["top"] = 50.0},
+0,
1,
"input",
function() {this["padding"] = 0.0},
0,
1,
"input[type=\"checkbox\"]",
function() {this["padding"] = 0.0},
0,
1,
".slider::-webkit-slider-thumb",
function() {this["padding"] = 0.0},
0,
1,
"input[type=\"range\"]",
function() {this["padding"] = 0.0},
0,
1,
"input[type=\"range\"]",
function() {this["padding"] = 0.0}];
diff --git
a/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
b/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
index 0d659df..48df758 100755
--- a/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
+++ b/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
@@ -136,4 +136,29 @@
}
+.jewel.textfield>input {
+ padding: 0;
+}
+
+
+.jewel.checkbox>input[type="checkbox"] {
+ padding: 0;
+}
+
+
+.slider::-webkit-slider-thumb {
+ padding: 0;
+}
+
+
+.jewel.slider input[type="range"] {
+ padding: 0;
+}
+
+
+input[type="range"] {
+ padding: 0;
+}
+
+
diff --git
a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g
b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g
index 0ebde21..ad9e63f 100644
--- a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g
+++ b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g
@@ -296,7 +296,7 @@ conditionSelector
| HASH_WORD { type = ConditionType.ID; name =
$HASH_WORD.text.substring(1); }
| ^(COLON NOT arg=ARGUMENTS) { type = ConditionType.NOT; name =
$arg.text; }
| ^(COLON s=ID) { type = ConditionType.PSEUDO; name = $s.text; }
- | ^(DOUBLE_COLON dc=ID) { type = ConditionType.PSEUDO; name = $dc.text;
}
+ | ^(DOUBLE_COLON dc=ID) { type = ConditionType.PSEUDO_ELEMENT; name =
$dc.text; }
| attributeSelector { type = ConditionType.ATTRIBUTE; name =
curAttribute.substring(1); }
;
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/css/ConditionType.java
b/compiler/src/main/java/org/apache/royale/compiler/css/ConditionType.java
index a0ea3ef..0457cc9 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/css/ConditionType.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/css/ConditionType.java
@@ -40,6 +40,11 @@ public enum ConditionType
PSEUDO(":"),
/**
+ * For example: <code>s|Label:loadingState</code>
+ */
+ PSEUDO_ELEMENT("::"),
+
+ /**
* For example: <code>s|Panel:not(:first-child)</code>
*/
NOT("not"),
--
To stop receiving notification emails like this one, please contact
[email protected].