Title: [139770] trunk
Revision
139770
Author
k...@webkit.org
Date
2013-01-15 12:02:20 -0800 (Tue, 15 Jan 2013)

Log Message

[CSS Filters] brightness() function doesn't work as specified
https://bugs.webkit.org/show_bug.cgi?id=106674

Source/WebCore:

Reviewed by Dean Jackson.

The brightness filter implementation modified the intercept instead of the slope on
the feComponentTransfer function. The passed amount acts as multiplier for each
color chanel now.

Existing tests cover the changes and were updated.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseBuiltinFilterArguments):
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::setFilters):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::build):

LayoutTests:

Negative brightness values are possible but are meaningless. Modify the tests
to mainly use positive amounts for brightness tests.

Reviewed by Dean Jackson.

* css3/filters/effect-brightness-clamping-hw.html:
* css3/filters/effect-brightness-hw.html:
* css3/filters/effect-combined-hw.html:
* css3/filters/effect-combined.html:
* css3/filters/multiple-filters-invalidation.html:
* css3/filters/null-effect-check.html:
* css3/filters/script-tests/filter-property-parsing-invalid.js:
* css3/filters/script-tests/filter-property-parsing.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139769 => 139770)


--- trunk/LayoutTests/ChangeLog	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/ChangeLog	2013-01-15 20:02:20 UTC (rev 139770)
@@ -1,3 +1,22 @@
+2013-01-13  Dirk Schulze  <dschu...@adobe.com>
+
+        [CSS Filters] brightness() function doesn't work as specified
+        https://bugs.webkit.org/show_bug.cgi?id=106674
+
+        Negative brightness values are possible but are meaningless. Modify the tests
+        to mainly use positive amounts for brightness tests.
+
+        Reviewed by Dean Jackson.
+
+        * css3/filters/effect-brightness-clamping-hw.html:
+        * css3/filters/effect-brightness-hw.html:
+        * css3/filters/effect-combined-hw.html:
+        * css3/filters/effect-combined.html:
+        * css3/filters/multiple-filters-invalidation.html:
+        * css3/filters/null-effect-check.html:
+        * css3/filters/script-tests/filter-property-parsing-invalid.js:
+        * css3/filters/script-tests/filter-property-parsing.js:
+
 2013-01-15  Zan Dobersek  <zandober...@gmail.com>
 
         [GTK] Enable Performance Timeline, Resource Timing, Navigation Timing features

Modified: trunk/LayoutTests/css3/filters/effect-brightness-clamping-hw.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/effect-brightness-clamping-hw.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/effect-brightness-clamping-hw.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -3,14 +3,14 @@
     -webkit-transform:translateZ(0);
 }
 </style>
-<img style="-webkit-filter: brightness(-1) brightness(1)" src=""
-<img style="-webkit-filter: brightness(-0.8) brightness(0.8)" src=""
-<img style="-webkit-filter: brightness(-0.5) brightness(0.5)" src=""
-<img style="-webkit-filter: brightness(-0.2) brightness(0.2)" src=""
-<img style="-webkit-filter: brightness(0.2) brightness(-0.2)" src=""
-<img style="-webkit-filter: brightness(0.5) brightness(-0.5)" src=""
-<img style="-webkit-filter: brightness(0.8) brightness(-0.8)" src=""
-<img style="-webkit-filter: brightness(1) brightness(-1)" src=""
+<img style="-webkit-filter: brightness(1) brightness(2)" src=""
+<img style="-webkit-filter: brightness(0.2) brightness(1.8)" src=""
+<img style="-webkit-filter: brightness(0.5) brightness(1.5)" src=""
+<img style="-webkit-filter: brightness(0.8) brightness(1.2)" src=""
+<img style="-webkit-filter: brightness(1.2) brightness(0.8)" src=""
+<img style="-webkit-filter: brightness(1.5) brightness(0.5)" src=""
+<img style="-webkit-filter: brightness(1.8) brightness(0.2)" src=""
+<img style="-webkit-filter: brightness(1) brightness(1)" src=""
 <img style="-webkit-filter: brightness(0.8) grayscale(1)" src=""
 <img style="-webkit-filter: brightness(0.5) blur(3px)" src=""
 <img style="-webkit-filter: brightness(1) blur(3px)" src=""

Modified: trunk/LayoutTests/css3/filters/effect-brightness-hw.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/effect-brightness-hw.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/effect-brightness-hw.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -3,10 +3,10 @@
     -webkit-transform:translateZ(0);
 }
 </style>
-<img style="-webkit-filter: brightness(-1)" src=""
-<img style="-webkit-filter: brightness(-0.6)" src=""
-<img style="-webkit-filter: brightness(-0.3)" src=""
+<img style="-webkit-filter: brightness(0)" src=""
+<img style="-webkit-filter: brightness(0.4)" src=""
+<img style="-webkit-filter: brightness(0.7)" src=""
 <img style="-webkit-filter: brightness()" src=""
-<img style="-webkit-filter: brightness(0.3)" src=""
-<img style="-webkit-filter: brightness(0.6)" src=""
-<img style="-webkit-filter: brightness(1)" src=""
+<img style="-webkit-filter: brightness(1.3)" src=""
+<img style="-webkit-filter: brightness(1.6)" src=""
+<img style="-webkit-filter: brightness(2)" src=""

Modified: trunk/LayoutTests/css3/filters/effect-combined-hw.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/effect-combined-hw.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/effect-combined-hw.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -9,4 +9,4 @@
 <img style="-webkit-filter: grayscale() blur(3px)" src=""
 <img style="-webkit-filter: blur(3px) hue-rotate(-90deg) sepia()" src=""
 <img style="-webkit-filter: blur(3px) opacity(0.5) hue-rotate(-90deg) sepia()" src=""
-<img style="-webkit-filter: blur(3px) brightness(0.2) contrast(2)" src=""
+<img style="-webkit-filter: blur(3px) brightness(1.2) contrast(2)" src=""

Modified: trunk/LayoutTests/css3/filters/effect-combined.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/effect-combined.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/effect-combined.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -14,4 +14,4 @@
 <img style="-webkit-filter: grayscale() blur(3px)" src=""
 <img style="-webkit-filter: blur(3px) hue-rotate(-90deg) sepia()" src=""
 <img style="-webkit-filter: blur(3px) opacity(0.5) hue-rotate(-90deg) sepia()" src=""
-<img style="-webkit-filter: blur(3px) brightness(0.2) contrast(2)" src=""
+<img style="-webkit-filter: blur(3px) brightness(1.2) contrast(2)" src=""

Modified: trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt (139769 => 139770)


--- trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt	2013-01-15 20:02:20 UTC (rev 139770)
@@ -637,6 +637,28 @@
 PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE
 PASS subRule.cssText is 'grayscale(0.25)'
 
+Parameter less than -100% : brightness(-1.1)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-filter') is 'brightness(-1.1)'
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
+PASS filterRule.length is 1
+PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS
+PASS subRule.cssText is 'brightness(-1.1)'
+
+Parameter more than 100% : brightness(101%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-filter') is 'brightness(101%)'
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
+PASS filterRule.length is 1
+PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS
+PASS subRule.cssText is 'brightness(101%)'
+
 Rule combinations : grayscale(0.25) brightness(0.5)
 PASS cssRule.type is 1
 PASS declaration.length is 1

Modified: trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt (139769 => 139770)


--- trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt	2013-01-15 20:02:20 UTC (rev 139770)
@@ -214,16 +214,6 @@
 PASS declaration.length is 0
 PASS declaration.getPropertyValue('-webkit-filter') is null
 
-Parameter out of bounds (negative) : brightness(-1.1)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is null
-
-Parameter out of bounds (positive) : brightness(101%)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is null
-
 Length instead of number : contrast(10px)
 PASS cssRule.type is 1
 PASS declaration.length is 0

Modified: trunk/LayoutTests/css3/filters/multiple-filters-invalidation.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/multiple-filters-invalidation.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/multiple-filters-invalidation.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -2,7 +2,7 @@
 <head>
 <style>
 html {
-  -webkit-filter: brightness(0.1) contrast(120%);
+  -webkit-filter: brightness(1.1) contrast(120%);
 }
 #rect {
   background: red;

Modified: trunk/LayoutTests/css3/filters/null-effect-check.html (139769 => 139770)


--- trunk/LayoutTests/css3/filters/null-effect-check.html	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/null-effect-check.html	2013-01-15 20:02:20 UTC (rev 139770)
@@ -23,7 +23,7 @@
     There should be 13 green boxes on screen. 
 -->
 <div style="-webkit-filter: blur(0)"></div>
-<div style="-webkit-filter: brightness(0)"></div>
+<div style="-webkit-filter: brightness(1)"></div>
 <div style="-webkit-filter: invert(0)"></div>
 <div style="-webkit-filter: contrast(1)"></div>
 

Modified: trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing-invalid.js (139769 => 139770)


--- trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing-invalid.js	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing-invalid.js	2013-01-15 20:02:20 UTC (rev 139770)
@@ -70,8 +70,6 @@
 testInvalidFilterRule("Too many parameters", "brightness(0.5 0.5)");
 testInvalidFilterRule("Too many parameters and commas", "brightness(0.5, 0.5)");
 testInvalidFilterRule("Trailing comma", "brightness(0.5,)");
-testInvalidFilterRule("Parameter out of bounds (negative)", "brightness(-1.1)");
-testInvalidFilterRule("Parameter out of bounds (positive)", "brightness(101%)");
 
 testInvalidFilterRule("Length instead of number", "contrast(10px)");
 testInvalidFilterRule("Too many parameters", "contrast(0.5 0.5)");

Modified: trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing.js (139769 => 139770)


--- trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing.js	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/css3/filters/script-tests/filter-property-parsing.js	2013-01-15 20:02:20 UTC (rev 139770)
@@ -328,6 +328,16 @@
               ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS", "WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"],
               ["brightness(0.5)", "grayscale(0.25)"]);
 
+testFilterRule("Parameter less than -100%",
+              "brightness(-1.1)", 1, "brightness(-1.1)",
+              ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"],
+              ["brightness(-1.1)"]);
+
+testFilterRule("Parameter more than 100%",
+              "brightness(101%)", 1, "brightness(101%)",
+              ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"],
+              ["brightness(101%)"]);
+
 testFilterRule("Rule combinations",
               "grayscale(0.25) brightness(0.5)", 2, "grayscale(0.25) brightness(0.5)",
               [ "WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", "WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"],

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (139769 => 139770)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-15 20:02:20 UTC (rev 139770)
@@ -4266,6 +4266,16 @@
 crbug.com/169550 [ Debug ] fast/lists/big-list-marker.html [ Crash ]
 crbug.com/169550 [ Debug ] platform/chromium/virtual/deferred/fast/images/icon-decoding.html [ Crash ]
 
+# Brightnes filter update needs rebaseline.
+webkit.org/b/106746 css3/filters/effect-brightness-hw.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/effect-combined.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/effect-brightness-clamping.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/multiple-filters-invalidation.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/effect-combined-hw.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/effect-brightness.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/effect-brightness-clamping-hw.html [ ImageOnlyFailure ]
+webkit.org/b/106746 css3/filters/filter-property-parsing.html [ Failure ]
+
 # Transient. Needs rebaseline.
 webkit.org/b/103955 fast/repaint/caret-outside-block.html [ ImageOnlyFailure ]
 webkit.org/b/103955 [ Linux ] fast/repaint/japanese-rl-selection-repaint-in-regions.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (139769 => 139770)


--- trunk/Source/WebCore/ChangeLog	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/Source/WebCore/ChangeLog	2013-01-15 20:02:20 UTC (rev 139770)
@@ -1,3 +1,23 @@
+2013-01-13  Dirk Schulze  <dschu...@adobe.com>
+
+        [CSS Filters] brightness() function doesn't work as specified
+        https://bugs.webkit.org/show_bug.cgi?id=106674
+
+        Reviewed by Dean Jackson.
+
+        The brightness filter implementation modified the intercept instead of the slope on
+        the feComponentTransfer function. The passed amount acts as multiplier for each
+        color chanel now.
+
+        Existing tests cover the changes and were updated.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseBuiltinFilterArguments):
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayer::setFilters):
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::build):
+
 2013-01-15  Zan Dobersek  <zandober...@gmail.com>
 
         [GTK] Enable Performance Timeline, Resource Timing, Navigation Timing features

Modified: trunk/Source/WebCore/css/CSSParser.cpp (139769 => 139770)


--- trunk/Source/WebCore/css/CSSParser.cpp	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-01-15 20:02:20 UTC (rev 139770)
@@ -8270,7 +8270,7 @@
         break;
     }
     case WebKitCSSFilterValue::BrightnessFilterOperation: {
-        // One optional argument, -1 to +1 or -100% to +100%, if missing use 0,
+        // One optional argument, if missing use 100%.
         if (args->size() > 1)
             return 0;
 
@@ -8278,14 +8278,8 @@
             CSSParserValue* value = args->current();
             if (!validUnit(value, FNumber | FPercent, CSSStrictMode))
                 return 0;
-                
-            double amount = value->fValue;
-            double minAllowed = value->unit == CSSPrimitiveValue::CSS_PERCENTAGE ? -100.0 : -1.0;
-            double maxAllowed = value->unit == CSSPrimitiveValue::CSS_PERCENTAGE ? 100.0 : 1.0;
-            if (amount < minAllowed || amount > maxAllowed)
-                return 0;
 
-            filterValue->append(cssValuePool().createValue(amount, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)));
+            filterValue->append(cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)));
         }
         break;
     }

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (139769 => 139770)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2013-01-15 20:02:20 UTC (rev 139770)
@@ -859,9 +859,9 @@
             CAFilter *filter = [CAFilter filterWithType:kCAFilterColorMatrix];
             
             CAColorMatrix brightnessMatrix = {
-                1, 0, 0, 0, static_cast<float>(op->amount()),
-                0, 1, 0, 0, static_cast<float>(op->amount()),
-                0, 0, 1, 0, static_cast<float>(op->amount()),
+                static_cast<float>(op->amount()), 0, 0, 0, 0,
+                0, static_cast<float>(op->amount()), 0, 0, 0,
+                0, 0, static_cast<float>(op->amount()), 0, 0,
                 0, 0, 0, 1, 0
             };
 

Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (139769 => 139770)


--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp	2013-01-15 20:02:20 UTC (rev 139770)
@@ -313,8 +313,8 @@
             BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
             ComponentTransferFunction transferFunction;
             transferFunction.type = FECOMPONENTTRANSFER_TYPE_LINEAR;
-            transferFunction.slope = 1;
-            transferFunction.intercept = narrowPrecisionToFloat(componentTransferOperation->amount());
+            transferFunction.slope = narrowPrecisionToFloat(componentTransferOperation->amount());
+            transferFunction.intercept = 0;
 
             ComponentTransferFunction nullFunction;
             effect = FEComponentTransfer::create(this, transferFunction, transferFunction, transferFunction, nullFunction);

Modified: trunk/Source/WebCore/svg/SVGStylable.h (139769 => 139770)


--- trunk/Source/WebCore/svg/SVGStylable.h	2013-01-15 19:49:50 UTC (rev 139769)
+++ trunk/Source/WebCore/svg/SVGStylable.h	2013-01-15 20:02:20 UTC (rev 139770)
@@ -34,8 +34,8 @@
 public:
     virtual ~SVGStylable() { }
 
-    virtual CSSStyleDeclaration* style() = 0;
-    virtual PassRefPtr<CSSValue> getPresentationAttribute(const String&) = 0;
+    virtual CSSStyleDeclaration* style() { return 0; };
+    virtual PassRefPtr<CSSValue> getPresentationAttribute(const String&) { return 0; };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to