Setting '-webkit-filter' to 'brightness(calc(10% * 2))' does not work
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jan 2015 01:54:37 +0000 (01:54 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jan 2015 01:54:37 +0000 (01:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140149

Reviewed by Darin Adler.

Source/WebCore:

Setting '-webkit-filter' to 'brightness(calc(10% * 2))' was not working
because the CSS parser did not handle calculated values inside
brightness(). This patch addresses the issue.

Test: fast/css/webkit-filter-calc.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseBuiltinFilterArguments):

LayoutTests:

Update the -webkit-filter calculated value test to cover brightness()
function as well.

* fast/css/webkit-filter-calc-expected.txt:
* fast/css/webkit-filter-calc.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/webkit-filter-calc-expected.txt
LayoutTests/fast/css/webkit-filter-calc.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp

index 7ef6a04..57aac61 100644 (file)
@@ -1,3 +1,16 @@
+2015-01-06  Chris Dumez  <cdumez@apple.com>
+
+        Setting '-webkit-filter' to 'brightness(calc(10% * 2))' does not work
+        https://bugs.webkit.org/show_bug.cgi?id=140149
+
+        Reviewed by Darin Adler.
+
+        Update the -webkit-filter calculated value test to cover brightness()
+        function as well.
+
+        * fast/css/webkit-filter-calc-expected.txt:
+        * fast/css/webkit-filter-calc.html:
+
 2015-01-06  Zalan Bujtas  <zalan@apple.com>
 
         Assertion in RenderGeometryMap::mapToContainer with LayoutUnit overflow.
index ef1c9db..b67b097 100644 (file)
@@ -7,6 +7,9 @@ PASS testDiv.style['-webkit-filter'] is ""
 testDiv.style['-webkit-filter'] = 'saturate(calc(10% * 2))'
 PASS testDiv.style['-webkit-filter'] is "saturate(calc(20%))"
 PASS window.getComputedStyle(testDiv).getPropertyValue('-webkit-filter') is "saturate(0.2)"
+testDiv.style['-webkit-filter'] = 'brightness(calc(10% * 2))'
+PASS testDiv.style['-webkit-filter'] is "brightness(calc(20%))"
+PASS window.getComputedStyle(testDiv).getPropertyValue('-webkit-filter') is "brightness(0.2)"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 69f4b97..26e9478 100644 (file)
@@ -12,6 +12,10 @@ evalAndLog("testDiv.style['-webkit-filter'] = 'saturate(calc(10% * 2))'");
 shouldBeEqualToString("testDiv.style['-webkit-filter']", "saturate(calc(20%))");
 shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('-webkit-filter')", "saturate(0.2)");
 
+evalAndLog("testDiv.style['-webkit-filter'] = 'brightness(calc(10% * 2))'");
+shouldBeEqualToString("testDiv.style['-webkit-filter']", "brightness(calc(20%))");
+shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('-webkit-filter')", "brightness(0.2)");
+
 </script>
 <script src="../../resources/js-test-post.js"></script>
 </body>
index a459db7..45a455a 100644 (file)
@@ -1,3 +1,19 @@
+2015-01-06  Chris Dumez  <cdumez@apple.com>
+
+        Setting '-webkit-filter' to 'brightness(calc(10% * 2))' does not work
+        https://bugs.webkit.org/show_bug.cgi?id=140149
+
+        Reviewed by Darin Adler.
+
+        Setting '-webkit-filter' to 'brightness(calc(10% * 2))' was not working
+        because the CSS parser did not handle calculated values inside
+        brightness(). This patch addresses the issue.
+
+        Test: fast/css/webkit-filter-calc.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseBuiltinFilterArguments):
+
 2015-01-06  Zalan Bujtas  <zalan@apple.com>
 
         Assertion in RenderGeometryMap::mapToContainer with LayoutUnit overflow.
index 969094c..64964ba 100644 (file)
@@ -9378,8 +9378,7 @@ PassRefPtr<WebKitCSSFilterValue> CSSParser::parseBuiltinFilterArguments(CSSParse
             if (!validateUnit(argumentWithCalculation, FNumber | FPercent, CSSStrictMode))
                 return nullptr;
 
-            // FIXME: This doesn't handle calculated values.
-            filterValue->append(cssValuePool().createValue(argumentWithCalculation.value().fValue, static_cast<CSSPrimitiveValue::UnitTypes>(argumentWithCalculation.value().unit)));
+            filterValue->append(createPrimitiveNumericValue(argumentWithCalculation));
         }
         break;
     }