FLEX-35235 add support for CSS calc()
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/a89c2d7c Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/a89c2d7c Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/a89c2d7c Branch: refs/heads/master Commit: a89c2d7cc4e092c237c090be7957aba8c9ea0e50 Parents: 84a6f63 Author: Alex Harui <[email protected]> Authored: Mon Jan 23 13:43:20 2017 -0800 Committer: Alex Harui <[email protected]> Committed: Mon Jan 23 13:43:20 2017 -0800 ---------------------------------------------------------------------- compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css | 5 +++++ .../src/test/resources/flexjs/files/CSSTestSource_result.css | 6 ++++++ .../main/antlr3/org/apache/flex/compiler/internal/css/CSS.g | 2 ++ .../antlr3/org/apache/flex/compiler/internal/css/CSSTree.g | 2 ++ 4 files changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a89c2d7c/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css ---------------------------------------------------------------------- diff --git a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css index 0e4d580..f18dc6f 100755 --- a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css +++ b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css @@ -81,3 +81,8 @@ color: #fff; background: url('assets/dog.png') bottom right 15% no-repeat #46B6AC; } + +.usescalc { + color: #fff; + width: calc((100% - 50px)/3; +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a89c2d7c/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css ---------------------------------------------------------------------- diff --git a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css index 3d2ddcd..6a17c84 100755 --- a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css +++ b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css @@ -83,4 +83,10 @@ } +.usescalc { + color: #fff; + width: calc((100% - 50px) / 3; +} + + http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a89c2d7c/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSS.g ---------------------------------------------------------------------- diff --git a/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSS.g b/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSS.g index 6fec15d..af9348a 100644 --- a/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSS.g +++ b/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSS.g @@ -454,6 +454,7 @@ singleValue -> ^(EMBED ARGUMENTS) | URL ARGUMENTS formatOption* -> ^(URL ARGUMENTS formatOption*) | LOCAL ARGUMENTS -> ^(LOCAL ARGUMENTS) + | CALC ARGUMENTS -> ^(CALC ARGUMENTS) | ALPHA_VALUE | SCALE_VALUE | RECT_VALUE @@ -524,6 +525,7 @@ EMBED : 'Embed' ; URL : 'url' ; FORMAT : 'format' ; LOCAL : 'local' ; +CALC : 'calc' ; SCALE : 'scale' ; NULL : 'null' ; ONLY : 'only' ; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a89c2d7c/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSSTree.g ---------------------------------------------------------------------- diff --git a/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSSTree.g b/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSSTree.g index b8d9587..d543ccb 100644 --- a/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSSTree.g +++ b/compiler/src/main/antlr3/org/apache/flex/compiler/internal/css/CSSTree.g @@ -404,6 +404,8 @@ singleValue returns [CSSPropertyValue propertyValue] { $propertyValue = new CSSURLAndFormatPropertyValue($URL.text, $url.text, $format.text, $start, tokenStream); } | ^(LOCAL l=ARGUMENTS) { $propertyValue = new CSSFunctionCallPropertyValue($LOCAL.text, $l.text, $start, tokenStream); } + | ^(CALC l=ARGUMENTS) + { $propertyValue = new CSSFunctionCallPropertyValue($CALC.text, $l.text, $start, tokenStream); } | s=STRING { $propertyValue = new CSSStringPropertyValue($s.text, $start, tokenStream); } | ID
