You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/03/27 17:13:37 UTC
[royale-compiler] branch develop updated: handle more complex urls.
fixes #35
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 717b8ec handle more complex urls. fixes #35
717b8ec is described below
commit 717b8ecd9c847870b22d6ffd97746406c8ff79c2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Mar 27 10:13:23 2018 -0700
handle more complex urls. fixes #35
---
.../driver/js/royale/JSCSSCompilationSession.java | 19 ++++++++++++-------
.../src/test/resources/royale/files/CSSTestSource.css | 4 ++++
.../resources/royale/files/CSSTestSource_result.css | 5 +++++
3 files changed, 21 insertions(+), 7 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 5790aae..97c6443 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
@@ -227,6 +227,13 @@ public class JSCSSCompilationSession extends CSSCompilationSession
"h6"
);
+ private String escapeDoubleQuotes(String s)
+ {
+ if (s.contains("\""))
+ s = s.replace("\"", "\\\"");
+ return s;
+ }
+
private String encodeRule(ICSSRule rule)
{
final StringBuilder result = new StringBuilder();
@@ -266,9 +273,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
ImmutableList<ICSSSelectorCondition> conds = sel.getConditions();
for (ICSSSelectorCondition cond : conds)
{
- String condString = cond.toString();
- if (condString.contains("\""))
- condString = condString.replace("\"", "\\\"");
+ String condString = escapeDoubleQuotes(cond.toString());
selName += condString;
}
result.append("\"" + selName + "\"");
@@ -300,7 +305,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
result.append(", ");
if (val instanceof CSSStringPropertyValue)
{
- result.append("\"" + ((CSSStringPropertyValue)val).getValue() + "\"");
+ result.append("\"" + escapeDoubleQuotes(((CSSStringPropertyValue)val).getValue()) + "\"");
}
else if (val instanceof CSSColorPropertyValue)
{
@@ -332,7 +337,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
}
else if (val instanceof CSSURLAndFormatPropertyValue)
{
- result.append("\"" + ((CSSURLAndFormatPropertyValue)val).toString() + "\"");
+ result.append("\"" + escapeDoubleQuotes(((CSSURLAndFormatPropertyValue)val).toString()) + "\"");
}
else if (val instanceof CSSMultiValuePropertyValue)
{
@@ -358,7 +363,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
result.append(", ");
if (val instanceof CSSStringPropertyValue)
{
- result.append("\"" + ((CSSStringPropertyValue)val).getValue() + "\"");
+ result.append("\"" + escapeDoubleQuotes(((CSSStringPropertyValue)val).getValue()) + "\"");
}
else if (val instanceof CSSColorPropertyValue)
{
@@ -390,7 +395,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
}
else if (val instanceof CSSURLAndFormatPropertyValue)
{
- result.append("\"" + ((CSSURLAndFormatPropertyValue)val).toString() + "\"");
+ result.append("\"" + escapeDoubleQuotes(((CSSURLAndFormatPropertyValue)val).toString()) + "\"");
}
else if (val instanceof CSSMultiValuePropertyValue)
{
diff --git a/compiler-jx/src/test/resources/royale/files/CSSTestSource.css b/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
index 4cbca85..9da086f 100755
--- a/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
+++ b/compiler-jx/src/test/resources/royale/files/CSSTestSource.css
@@ -145,3 +145,7 @@
input[type="range"] {
padding: 0;
}
+
+.complex {
+ background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 16 13' version='1.1' xmlns='http://www.w3.org/2000/svg'><g transform='translate(-763, -290)'><g transform='translate(760, 285)'><g><polygon fill='#ffffff' points='3 13 9 18 19 7 16 5 9 13 6 10'></polygon></g></g></g></svg>"), #b3dffa;
+}
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 48df758..1c08cfd 100755
--- a/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
+++ b/compiler-jx/src/test/resources/royale/files/CSSTestSource_result.css
@@ -161,4 +161,9 @@ input[type="range"] {
}
+.complex {
+ background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 16 13' version='1.1' xmlns='http://www.w3.org/2000/svg'><g transform='translate(-763, -290)'><g transform='translate(760, 285)'><g><polygon fill='#ffffff' points='3 13 9 18 19 7 16 5 9 13 6 10'></polygon></g></g></g></svg>"), #b3dffa;
+}
+
+
--
To stop receiving notification emails like this one, please contact
aharui@apache.org.