WebKit Bugzilla
Attachment 338790 Details for
Bug 184937
: brightness() filter should default to 1, and not allow negative values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-184937-20180425141439.patch (text/plain), 40.03 KB, created by
Simon Fraser (smfr)
on 2018-04-25 14:14:39 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-04-25 14:14:39 PDT
Size:
40.03 KB
patch
obsolete
>Subversion Revision: 230976 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8d757377312d727017ed046f85ba9b7f2eeb8fb0..19a7fa19e6265436a332b3eee7e68899cf0e9b68 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-04-25 Simon Fraser <simon.fraser@apple.com> >+ >+ brightness() filter should default to 1, and not allow negative values >+ https://bugs.webkit.org/show_bug.cgi?id=184937 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove the special-casing for brightness() in consumeFilterFunction(), so it now >+ follows the same logic as the other color-related filters in not allowing negative >+ values. >+ >+ Removed the special-casing for brightness() in createFilterOperations() so its default >+ value is now 1. >+ >+ Modified existing tests. >+ >+ * css/StyleResolver.cpp: >+ (WebCore::StyleResolver::createFilterOperations): >+ * css/parser/CSSPropertyParserHelpers.cpp: >+ (WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne): >+ (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): >+ > 2018-04-24 Simon Fraser <simon.fraser@apple.com> > > shape-outside and filter styles occur twice in the result of getComputedStyle >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index 1318d654fecf0e6691e506ace03a2630db4a63fe..6bab457488da67861e6840f1c465730c93266a07 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -1981,7 +1981,7 @@ bool StyleResolver::createFilterOperations(const CSSValue& inValue, FilterOperat > case FilterOperation::BRIGHTNESS: > case FilterOperation::CONTRAST: > case FilterOperation::OPACITY: { >- double amount = (operationType == FilterOperation::BRIGHTNESS) ? 0 : 1; >+ double amount = 1; > if (filterValue.length() == 1) { > amount = firstValue->doubleValue(); > if (firstValue->isPercentage()) >diff --git a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >index c5d95ae287a5cfd32bd0033f063c01d03a2d2359..61ddb3e5d4d824e3aaeafff29d34896d1bf63c8e 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >@@ -1404,6 +1404,19 @@ static bool isValidPrimitiveFilterFunction(CSSValueID filterFunction) > } > } > >+static bool allowsValuesGreaterThanOne(CSSValueID filterFunction) >+{ >+ switch (filterFunction) { >+ case CSSValueBrightness: >+ case CSSValueContrast: >+ case CSSValueSaturate: >+ return true; >+ default: >+ return false; >+ } >+ return false; >+} >+ > RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range, const CSSParserContext& context) > { > CSSValueID filterType = range.peek().functionId(); >@@ -1418,11 +1431,8 @@ RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range, const > else { > if (args.atEnd()) > return filterValue; >- if (filterType == CSSValueBrightness) { >- parsedValue = consumePercent(args, ValueRangeAll); >- if (!parsedValue) >- parsedValue = consumeNumber(args, ValueRangeAll); >- } else if (filterType == CSSValueHueRotate) >+ >+ if (filterType == CSSValueHueRotate) > parsedValue = consumeAngle(args, context.mode, UnitlessQuirk::Forbid); > else if (filterType == CSSValueBlur) > parsedValue = consumeLength(args, HTMLStandardMode, ValueRangeNonNegative); >@@ -1430,7 +1440,7 @@ RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range, const > parsedValue = consumePercent(args, ValueRangeNonNegative); > if (!parsedValue) > parsedValue = consumeNumber(args, ValueRangeNonNegative); >- if (parsedValue && filterType != CSSValueSaturate && filterType != CSSValueContrast) { >+ if (parsedValue && !allowsValuesGreaterThanOne(filterType)) { > bool isPercentage = downcast<CSSPrimitiveValue>(*parsedValue).isPercentage(); > double maxAllowed = isPercentage ? 100.0 : 1.0; > if (downcast<CSSPrimitiveValue>(*parsedValue).doubleValue() > maxAllowed) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 33fcebe0274f97be96e15c2274aec289e73d6b9b..34291fa6da320ccf8f825b2331f57c11970acd87 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,31 @@ >+2018-04-25 Simon Fraser <simon.fraser@apple.com> >+ >+ brightness() filter should default to 1, and not allow negative values >+ https://bugs.webkit.org/show_bug.cgi?id=184937 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added negative value tests to filter-property-parsing.html and backdropfilter-property-parsing.html, >+ and made these tests more similar. >+ >+ Fixed expected computed value for brightness() to be brightness(1) in the tests. >+ >+ The effect-brightness* test results failed because elements with invalid brightness values now >+ no longer create a RenderLayer. >+ >+ * css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt: >+ * css3/filters/backdrop/backdropfilter-property-computed-style.html: >+ * css3/filters/backdrop/backdropfilter-property-parsing-expected.txt: >+ * css3/filters/backdrop/backdropfilter-property-parsing.html: >+ * css3/filters/effect-brightness-expected.txt: >+ * css3/filters/filter-property-computed-style-expected.txt: >+ * css3/filters/filter-property-computed-style.html: >+ * css3/filters/filter-property-parsing-expected.txt: >+ * css3/filters/filter-property-parsing.html: >+ * css3/filters/unprefixed-expected.txt: >+ * css3/filters/unprefixed.html: >+ * platform/mac/css3/filters/effect-brightness-clamping-expected.txt: >+ > 2018-04-24 Simon Fraser <simon.fraser@apple.com> > > shape-outside and filter styles occur twice in the result of getComputedStyle >diff --git a/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt b/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt >index 7775f48d12649a87434f5232ed162ed062653f5a..5e025b610d897f9ecce07ff305d9da236b7fadb4 100644 >--- a/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt >+++ b/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt >@@ -194,7 +194,7 @@ PASS subRule.cssText is "brightness(0)" > > No values : brightness() > PASS filterStyle.length is 1 >-PASS subRule.cssText is "brightness(0)" >+PASS subRule.cssText is "brightness(1)" > > Multiple values : brightness(0.5) brightness(0.25) > PASS filterStyle.length is 2 >diff --git a/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style.html b/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style.html >index 470f429659fe6a4ab9b8c12a7ed0d228781bf87c..b1215083dd5b7e86bdb54539758e132687c38222 100644 >--- a/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style.html >+++ b/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style.html >@@ -209,7 +209,7 @@ testComputedFilterRule("Zero value", > > testComputedFilterRule("No values", > "brightness()", 1, >- ["brightness(0)"]); >+ ["brightness(1)"]); > > testComputedFilterRule("Multiple values", > "brightness(0.5) brightness(0.25)", 2, >diff --git a/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-expected.txt b/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-expected.txt >index 677e78931a289347b0f54ed844412cef2292c81b..378efe0e92c222c001616a49d9f2e88f6cc315cc 100644 >--- a/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-expected.txt >+++ b/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-expected.txt >@@ -76,6 +76,26 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "grayscale(1)" > >+Values over 1 are clamped : grayscale(1.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "grayscale(1)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "grayscale(1)" >+ >+Percentages over 100 are clamped : grayscale(320%) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "grayscale(100%)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "grayscale(100%)" >+ > Zero value : grayscale(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -137,6 +157,31 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "sepia(1)" > >+Values over 1 are clamped : sepia(8) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "sepia(1)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "sepia(1)" >+ >+Percentages over 100 are clamped : sepia(101%) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "sepia(100%)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "sepia(100%)" >+ >+Negative value : sepia(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Zero value : sepia(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -157,6 +202,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "sepia()" > >+Negative value : grayscale(-0.2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Multiple values : sepia(0.5) sepia(0.25) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -229,6 +279,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "saturate(5.5)" > >+Negative value : saturate(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Zero value : saturate(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -321,6 +376,16 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "hue-rotate(0.5turn)" > >+Negative value : hue-rotate(-370.2deg) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "hue-rotate(-370.2deg)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "hue-rotate(-370.2deg)" >+ > Zero value : hue-rotate(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -382,6 +447,26 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "invert(1)" > >+Values over 1 are clamped : invert(1.01) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "invert(1)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "invert(1)" >+ >+Percentages over 100 are clamped : invert(500000%) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "invert(100%)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "invert(100%)" >+ > Zero value : invert(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -392,6 +477,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "invert(0)" > >+Negative value : invert(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > No values : invert() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -454,6 +544,31 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "opacity(1)" > >+Values over 1 are clamped : opacity(2134687326) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "opacity(1)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "opacity(1)" >+ >+Percentages over 100 are clamped : opacity(500%) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "opacity(100%)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "opacity(100%)" >+ >+Negative value : opacity(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Zero value : opacity(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -536,6 +651,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "brightness(0)" > >+Negative value : brightness(-2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > No values : brightness() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -568,15 +688,15 @@ PASS filterRule.length is 2 > PASS subRule.cssText is "brightness(0.5)" > PASS subRule.cssText is "grayscale(0.25)" > >-Parameter less than -100% : brightness(-1.1) >+Value less than -100% : brightness(-1.1) > PASS cssRule.type is 1 >-PASS declaration.length is 1 >-PASS declaration.getPropertyValue('-webkit-backdrop-filter') is "brightness(-1.1)" >-PASS jsWrapperClass(filterRule) is 'CSSValueList' >-PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >-PASS jsWrapperClass(filterRule.constructor) is 'Function' >-PASS filterRule.length is 1 >-PASS subRule.cssText is "brightness(-1.1)" >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ >+Negative value : brightness(-0.6) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' > > Parameter more than 100% : brightness(101%) > PASS cssRule.type is 1 >@@ -649,6 +769,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "contrast(0)" > >+Negative value : contrast(-0.2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > No values : contrast() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -669,6 +794,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "contrast(2)" > >+Negative value : contrast(-0.8) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Multiple values : contrast(0.5) contrast(0.25) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -732,6 +862,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "blur()" > >+Negative value : blur(-2px) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('-webkit-backdrop-filter') is '' >+ > Color then three values : drop-shadow(red 1px 2px 3px) > PASS cssRule.type is 1 > PASS declaration.length is 1 >diff --git a/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing.html b/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing.html >index 94daf03eb4a6979cafbdcabae2c5c6680de9ff6f..2c82698c8eccd1200e0d64f234526eae9edff2a9 100644 >--- a/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing.html >+++ b/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing.html >@@ -59,6 +59,25 @@ function testFilterRule(description, rule, expectedLength, expectedValue, expect > shouldBe("subRule.cssText", `"${expectedTexts[i]}"`); > } > } >+ >+ stylesheet.deleteRule(0); >+} >+ >+function testInvalidFilterRule(description, rule) >+{ >+ debug(""); >+ debug(`${description} : ${rule}`); >+ >+ stylesheet.insertRule("body { -webkit-backdrop-filter: " + rule + "; }", 0); >+ cssRule = stylesheet.cssRules.item(0); >+ >+ shouldBe("cssRule.type", "1"); >+ >+ declaration = cssRule.style; >+ shouldBe("declaration.length", "0"); >+ shouldBe("declaration.getPropertyValue('-webkit-backdrop-filter')", "''"); >+ >+ stylesheet.deleteRule(0); > } > > testFilterRule("Basic reference", >@@ -89,6 +108,14 @@ testFilterRule("Float value converts to integer", > "grayscale(1.0)", 1, "grayscale(1)", > ["grayscale(1)"]); > >+testFilterRule("Values over 1 are clamped", >+ "grayscale(1.5)", 1, "grayscale(1)", >+ ["grayscale(1)"]); >+ >+testFilterRule("Percentages over 100 are clamped", >+ "grayscale(320%)", 1, "grayscale(100%)", >+ ["grayscale(100%)"]); >+ > testFilterRule("Zero value", > "grayscale(0)", 1, "grayscale(0)", > ["grayscale(0)"]); >@@ -113,6 +140,16 @@ testFilterRule("Float value converts to integer", > "sepia(1.0)", 1, "sepia(1)", > ["sepia(1)"]); > >+testFilterRule("Values over 1 are clamped", >+ "sepia(8)", 1, "sepia(1)", >+ ["sepia(1)"]); >+ >+testFilterRule("Percentages over 100 are clamped", >+ "sepia(101%)", 1, "sepia(100%)", >+ ["sepia(100%)"]); >+ >+testInvalidFilterRule("Negative value", "sepia(-0.5)"); >+ > testFilterRule("Zero value", > "sepia(0)", 1, "sepia(0)", > ["sepia(0)"]); >@@ -121,6 +158,8 @@ testFilterRule("No values", > "sepia()", 1, "sepia()", > ["sepia()"]); > >+testInvalidFilterRule("Negative value", "grayscale(-0.2)"); >+ > testFilterRule("Multiple values", > "sepia(0.5) sepia(0.25)", 2, "sepia(0.5) sepia(0.25)", > ["sepia(0.5)", "sepia(0.25)"]); >@@ -149,6 +188,8 @@ testFilterRule("Input value > 1", > "saturate(5.5)", 1, "saturate(5.5)", > ["saturate(5.5)"]); > >+testInvalidFilterRule("Negative value", "saturate(-0.5)"); >+ > testFilterRule("Zero value", > "saturate(0)", 1, "saturate(0)", > ["saturate(0)"]); >@@ -185,6 +226,10 @@ testFilterRule("Turns value", > "hue-rotate(0.5turn)", 1, "hue-rotate(0.5turn)", > ["hue-rotate(0.5turn)"]); > >+testFilterRule("Negative value", >+ "hue-rotate(-370.2deg)", 1, "hue-rotate(-370.2deg)", >+ ["hue-rotate(-370.2deg)"]); >+ > testFilterRule("Zero value", > "hue-rotate(0)", 1, "hue-rotate(0deg)", > ["hue-rotate(0deg)"]); >@@ -209,10 +254,20 @@ testFilterRule("Float value converts to integer", > "invert(1.0)", 1, "invert(1)", > ["invert(1)"]); > >+testFilterRule("Values over 1 are clamped", >+ "invert(1.01)", 1, "invert(1)", >+ ["invert(1)"]); >+ >+testFilterRule("Percentages over 100 are clamped", >+ "invert(500000%)", 1, "invert(100%)", >+ ["invert(100%)"]); >+ > testFilterRule("Zero value", > "invert(0)", 1, "invert(0)", > ["invert(0)"]); > >+testInvalidFilterRule("Negative value", "invert(-0.5)"); >+ > testFilterRule("No values", > "invert()", 1, "invert()", > ["invert()"]); >@@ -237,6 +292,16 @@ testFilterRule("Float value converts to integer", > "opacity(1.0)", 1, "opacity(1)", > ["opacity(1)"]); > >+testFilterRule("Values over 1 are clamped", >+ "opacity(2134687326)", 1, "opacity(1)", >+ ["opacity(1)"]); >+ >+testFilterRule("Percentages over 100 are clamped", >+ "opacity(500%)", 1, "opacity(100%)", >+ ["opacity(100%)"]); >+ >+testInvalidFilterRule("Negative value", "opacity(-0.5)"); >+ > testFilterRule("Zero value", > "opacity(0)", 1, "opacity(0)", > ["opacity(0)"]); >@@ -269,6 +334,8 @@ testFilterRule("Zero value", > "brightness(0)", 1, "brightness(0)", > ["brightness(0)"]); > >+testInvalidFilterRule("Negative value", "brightness(-2)"); >+ > testFilterRule("No values", > "brightness()", 1, "brightness()", > ["brightness()"]); >@@ -281,9 +348,8 @@ testFilterRule("Rule combinations", > "brightness(0.5) grayscale(0.25)", 2, "brightness(0.5) grayscale(0.25)", > ["brightness(0.5)", "grayscale(0.25)"]); > >-testFilterRule("Parameter less than -100%", >- "brightness(-1.1)", 1, "brightness(-1.1)", >- ["brightness(-1.1)"]); >+testInvalidFilterRule("Value less than -100%", "brightness(-1.1)"); >+testInvalidFilterRule("Negative value", "brightness(-0.6)"); > > testFilterRule("Parameter more than 100%", > "brightness(101%)", 1, "brightness(101%)", >@@ -313,6 +379,8 @@ testFilterRule("Zero value", > "contrast(0)", 1, "contrast(0)", > ["contrast(0)"]); > >+testInvalidFilterRule("Negative value", "contrast(-0.2)"); >+ > testFilterRule("No values", > "contrast()", 1, "contrast()", > ["contrast()"]); >@@ -321,6 +389,8 @@ testFilterRule("Value greater than one", > "contrast(2)", 1, "contrast(2)", > ["contrast(2)"]); > >+testInvalidFilterRule("Negative value", "contrast(-0.8)"); >+ > testFilterRule("Multiple values", > "contrast(0.5) contrast(0.25)", 2, "contrast(0.5) contrast(0.25)", > ["contrast(0.5)", "contrast(0.25)"]); >@@ -345,6 +415,8 @@ testFilterRule("No values", > "blur()", 1, "blur()", > ["blur()"]); > >+testInvalidFilterRule("Negative value", "blur(-2px)"); >+ > testFilterRule("Color then three values", > "drop-shadow(red 1px 2px 3px)", 1, "drop-shadow(red 1px 2px 3px)", > ["drop-shadow(red 1px 2px 3px)"]); >diff --git a/LayoutTests/css3/filters/effect-brightness-expected.txt b/LayoutTests/css3/filters/effect-brightness-expected.txt >index 94a186935568355b298e8cde80746a6f4ecb3e39..798f3305350f7caa230806b93a59aaee62ee5794 100644 >--- a/LayoutTests/css3/filters/effect-brightness-expected.txt >+++ b/LayoutTests/css3/filters/effect-brightness-expected.txt >@@ -3,10 +3,13 @@ layer at (0,0) size 800x600 > layer at (0,0) size 800x600 > RenderBlock {HTML} at (0,0) size 800x600 > RenderBody {BODY} at (8,8) size 784x584 >+ RenderImage {IMG} at (0,0) size 160x90 > RenderText {#text} at (160,76) size 4x18 > text run at (160,76) width 4: " " >+ RenderImage {IMG} at (164,0) size 160x90 > RenderText {#text} at (324,76) size 4x18 > text run at (324,76) width 4: " " >+ RenderImage {IMG} at (328,0) size 160x90 > RenderText {#text} at (488,76) size 4x18 > text run at (488,76) width 4: " " > RenderText {#text} at (652,76) size 4x18 >@@ -16,12 +19,6 @@ layer at (0,0) size 800x600 > RenderText {#text} at (324,170) size 4x18 > text run at (324,170) width 4: " " > RenderText {#text} at (0,0) size 0x0 >-layer at (8,8) size 160x90 >- RenderImage {IMG} at (0,0) size 160x90 >-layer at (172,8) size 160x90 >- RenderImage {IMG} at (164,0) size 160x90 >-layer at (336,8) size 160x90 >- RenderImage {IMG} at (328,0) size 160x90 > layer at (500,8) size 160x90 > RenderImage {IMG} at (492,0) size 160x90 > layer at (8,102) size 160x90 >diff --git a/LayoutTests/css3/filters/filter-property-computed-style-expected.txt b/LayoutTests/css3/filters/filter-property-computed-style-expected.txt >index 58ff8061859bb2feb8d879ef1d7fac7ecfa2fbc7..eb41ff9a6d6a6f61b48ad9d57ebe6425f594bbfd 100644 >--- a/LayoutTests/css3/filters/filter-property-computed-style-expected.txt >+++ b/LayoutTests/css3/filters/filter-property-computed-style-expected.txt >@@ -194,7 +194,7 @@ PASS subRule.cssText is "brightness(0)" > > No values : brightness() > PASS filterStyle.length is 1 >-PASS subRule.cssText is "brightness(0)" >+PASS subRule.cssText is "brightness(1)" > > Multiple values : brightness(0.5) brightness(0.25) > PASS filterStyle.length is 2 >diff --git a/LayoutTests/css3/filters/filter-property-computed-style.html b/LayoutTests/css3/filters/filter-property-computed-style.html >index 8e87da3cd46d6a47f9be14976b1ac9c80e120c95..648200199ba6674cf6c5bb5ed9a796b28b89120a 100644 >--- a/LayoutTests/css3/filters/filter-property-computed-style.html >+++ b/LayoutTests/css3/filters/filter-property-computed-style.html >@@ -209,7 +209,7 @@ testComputedFilterRule("Zero value", > > testComputedFilterRule("No values", > "brightness()", 1, >- ["brightness(0)"]); >+ ["brightness(1)"]); > > testComputedFilterRule("Multiple values", > "brightness(0.5) brightness(0.25)", 2, >diff --git a/LayoutTests/css3/filters/filter-property-parsing-expected.txt b/LayoutTests/css3/filters/filter-property-parsing-expected.txt >index 9ca9c5c2ffc42cd8359dd15baad35a3a813e2a09..24a8d1cff630acf2a39828380b072571e11d4f3b 100644 >--- a/LayoutTests/css3/filters/filter-property-parsing-expected.txt >+++ b/LayoutTests/css3/filters/filter-property-parsing-expected.txt >@@ -177,6 +177,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "sepia(100%)" > >+Negative value : sepia(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Zero value : sepia(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -197,6 +202,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "sepia()" > >+Negative value : grayscale(-0.2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Multiple values : sepia(0.5) sepia(0.25) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -269,6 +279,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "saturate(5.5)" > >+Negative value : saturate(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Zero value : saturate(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -361,6 +376,16 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "hue-rotate(0.5turn)" > >+Negative value : hue-rotate(-370.2deg) >+PASS cssRule.type is 1 >+PASS declaration.length is 1 >+PASS declaration.getPropertyValue('filter') is "hue-rotate(-370.2deg)" >+PASS jsWrapperClass(filterRule) is 'CSSValueList' >+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >+PASS jsWrapperClass(filterRule.constructor) is 'Function' >+PASS filterRule.length is 1 >+PASS subRule.cssText is "hue-rotate(-370.2deg)" >+ > Zero value : hue-rotate(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -452,6 +477,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "invert(0)" > >+Negative value : invert(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > No values : invert() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -534,6 +564,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "opacity(100%)" > >+Negative value : opacity(-0.5) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Zero value : opacity(0) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -616,6 +651,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "brightness(0)" > >+Negative value : brightness(-2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > No values : brightness() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -648,15 +688,15 @@ PASS filterRule.length is 2 > PASS subRule.cssText is "brightness(0.5)" > PASS subRule.cssText is "grayscale(0.25)" > >-Parameter less than -100% : brightness(-1.1) >+Value less than -100% : brightness(-1.1) > PASS cssRule.type is 1 >-PASS declaration.length is 1 >-PASS declaration.getPropertyValue('filter') is "brightness(-1.1)" >-PASS jsWrapperClass(filterRule) is 'CSSValueList' >-PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype' >-PASS jsWrapperClass(filterRule.constructor) is 'Function' >-PASS filterRule.length is 1 >-PASS subRule.cssText is "brightness(-1.1)" >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ >+Negative value : brightness(-0.6) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' > > Parameter more than 100% : brightness(101%) > PASS cssRule.type is 1 >@@ -729,6 +769,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "contrast(0)" > >+Negative value : contrast(-0.2) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > No values : contrast() > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -749,6 +794,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "contrast(2)" > >+Negative value : contrast(-0.8) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Multiple values : contrast(0.5) contrast(0.25) > PASS cssRule.type is 1 > PASS declaration.length is 1 >@@ -812,6 +862,11 @@ PASS jsWrapperClass(filterRule.constructor) is 'Function' > PASS filterRule.length is 1 > PASS subRule.cssText is "blur()" > >+Negative value : blur(-2px) >+PASS cssRule.type is 1 >+PASS declaration.length is 0 >+PASS declaration.getPropertyValue('filter') is '' >+ > Color then three values : drop-shadow(red 1px 2px 3px) > PASS cssRule.type is 1 > PASS declaration.length is 1 >diff --git a/LayoutTests/css3/filters/filter-property-parsing.html b/LayoutTests/css3/filters/filter-property-parsing.html >index 70280d3e1f5b5acbfa4f1727ef5027c0b06ff541..8eb5a1faf8dfc2d677af6140bc3053c897524770 100644 >--- a/LayoutTests/css3/filters/filter-property-parsing.html >+++ b/LayoutTests/css3/filters/filter-property-parsing.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<!DOCTYPE> > <html> > <head> > <script src="../../resources/js-test-pre.js"></script> >@@ -59,6 +59,24 @@ function testFilterRule(description, rule, expectedLength, expectedValue, expect > shouldBe("subRule.cssText", `"${expectedTexts[i]}"`); > } > } >+ >+ stylesheet.deleteRule(0); >+} >+ >+function testInvalidFilterRule(description, rule) >+{ >+ debug(""); >+ debug(`${description} : ${rule}`); >+ >+ stylesheet.insertRule(`body { filter: ${rule}; }`, 0); >+ cssRule = stylesheet.cssRules.item(0); >+ >+ shouldBe("cssRule.type", "1"); >+ >+ declaration = cssRule.style; >+ shouldBe("declaration.length", "0"); >+ shouldBe("declaration.getPropertyValue('filter')", "''"); >+ > stylesheet.deleteRule(0); > } > >@@ -130,6 +148,8 @@ testFilterRule("Percentages over 100 are clamped", > "sepia(101%)", 1, "sepia(100%)", > ["sepia(100%)"]); > >+testInvalidFilterRule("Negative value", "sepia(-0.5)"); >+ > testFilterRule("Zero value", > "sepia(0)", 1, "sepia(0)", > ["sepia(0)"]); >@@ -138,6 +158,8 @@ testFilterRule("No values", > "sepia()", 1, "sepia()", > ["sepia()"]); > >+testInvalidFilterRule("Negative value", "grayscale(-0.2)"); >+ > testFilterRule("Multiple values", > "sepia(0.5) sepia(0.25)", 2, "sepia(0.5) sepia(0.25)", > ["sepia(0.5)", "sepia(0.25)"]); >@@ -166,6 +188,8 @@ testFilterRule("Input value > 1", > "saturate(5.5)", 1, "saturate(5.5)", > ["saturate(5.5)"]); > >+testInvalidFilterRule("Negative value", "saturate(-0.5)"); >+ > testFilterRule("Zero value", > "saturate(0)", 1, "saturate(0)", > ["saturate(0)"]); >@@ -202,9 +226,13 @@ testFilterRule("Turns value", > "hue-rotate(0.5turn)", 1, "hue-rotate(0.5turn)", > ["hue-rotate(0.5turn)"]); > >+testFilterRule("Negative value", >+ "hue-rotate(-370.2deg)", 1, "hue-rotate(-370.2deg)", >+ ["hue-rotate(-370.2deg)"]); >+ > testFilterRule("Zero value", > "hue-rotate(0)", 1, "hue-rotate(0deg)", >- ["hue-rotate(0deg)"]); >+ ["hue-rotate(0deg)"]); > > testFilterRule("No values", > "hue-rotate()", 1, "hue-rotate()", >@@ -238,6 +266,8 @@ testFilterRule("Zero value", > "invert(0)", 1, "invert(0)", > ["invert(0)"]); > >+testInvalidFilterRule("Negative value", "invert(-0.5)"); >+ > testFilterRule("No values", > "invert()", 1, "invert()", > ["invert()"]); >@@ -270,6 +300,8 @@ testFilterRule("Percentages over 100 are clamped", > "opacity(500%)", 1, "opacity(100%)", > ["opacity(100%)"]); > >+testInvalidFilterRule("Negative value", "opacity(-0.5)"); >+ > testFilterRule("Zero value", > "opacity(0)", 1, "opacity(0)", > ["opacity(0)"]); >@@ -302,6 +334,8 @@ testFilterRule("Zero value", > "brightness(0)", 1, "brightness(0)", > ["brightness(0)"]); > >+testInvalidFilterRule("Negative value", "brightness(-2)"); >+ > testFilterRule("No values", > "brightness()", 1, "brightness()", > ["brightness()"]); >@@ -314,9 +348,8 @@ testFilterRule("Rule combinations", > "brightness(0.5) grayscale(0.25)", 2, "brightness(0.5) grayscale(0.25)", > ["brightness(0.5)", "grayscale(0.25)"]); > >-testFilterRule("Parameter less than -100%", >- "brightness(-1.1)", 1, "brightness(-1.1)", >- ["brightness(-1.1)"]); >+testInvalidFilterRule("Value less than -100%", "brightness(-1.1)"); >+testInvalidFilterRule("Negative value", "brightness(-0.6)"); > > testFilterRule("Parameter more than 100%", > "brightness(101%)", 1, "brightness(101%)", >@@ -346,6 +379,8 @@ testFilterRule("Zero value", > "contrast(0)", 1, "contrast(0)", > ["contrast(0)"]); > >+testInvalidFilterRule("Negative value", "contrast(-0.2)"); >+ > testFilterRule("No values", > "contrast()", 1, "contrast()", > ["contrast()"]); >@@ -354,6 +389,8 @@ testFilterRule("Value greater than one", > "contrast(2)", 1, "contrast(2)", > ["contrast(2)"]); > >+testInvalidFilterRule("Negative value", "contrast(-0.8)"); >+ > testFilterRule("Multiple values", > "contrast(0.5) contrast(0.25)", 2, "contrast(0.5) contrast(0.25)", > ["contrast(0.5)", "contrast(0.25)"]); >@@ -378,6 +415,8 @@ testFilterRule("No values", > "blur()", 1, "blur()", > ["blur()"]); > >+testInvalidFilterRule("Negative value", "blur(-2px)"); >+ > testFilterRule("Color then three values", > "drop-shadow(red 1px 2px 3px)", 1, "drop-shadow(red 1px 2px 3px)", > ["drop-shadow(red 1px 2px 3px)"]); >diff --git a/LayoutTests/css3/filters/unprefixed-expected.txt b/LayoutTests/css3/filters/unprefixed-expected.txt >index 40a9a9ad157b0590f0435211c3bc961e168e5157..8cb6561ebc900d6fb43b21203879ee8256b4e964 100644 >--- a/LayoutTests/css3/filters/unprefixed-expected.txt >+++ b/LayoutTests/css3/filters/unprefixed-expected.txt >@@ -194,7 +194,7 @@ PASS subRule.cssText is "brightness(0)" > > No values : brightness() > PASS filterStyle.length is 1 >-PASS subRule.cssText is "brightness(0)" >+PASS subRule.cssText is "brightness(1)" > > Multiple values : brightness(0.5) brightness(0.25) > PASS filterStyle.length is 2 >diff --git a/LayoutTests/css3/filters/unprefixed.html b/LayoutTests/css3/filters/unprefixed.html >index 987f9eba2ed807ebbbd4e49ec9e0a86cf1804c7b..287b07365ba3cfae3dca2c81708f9a2207c89c08 100644 >--- a/LayoutTests/css3/filters/unprefixed.html >+++ b/LayoutTests/css3/filters/unprefixed.html >@@ -209,7 +209,7 @@ testComputedFilterRule("Zero value", > > testComputedFilterRule("No values", > "brightness()", 1, >- ["brightness(0)"]); >+ ["brightness(1)"]); > > testComputedFilterRule("Multiple values", > "brightness(0.5) brightness(0.25)", 2, >diff --git a/LayoutTests/platform/mac/css3/filters/effect-brightness-clamping-expected.txt b/LayoutTests/platform/mac/css3/filters/effect-brightness-clamping-expected.txt >index 523aee6805615d062003684b9cbcf4b5cdcbfdb1..77db28c3d20651fbe9844c27546c096fc6bf360c 100644 >--- a/LayoutTests/platform/mac/css3/filters/effect-brightness-clamping-expected.txt >+++ b/LayoutTests/platform/mac/css3/filters/effect-brightness-clamping-expected.txt >@@ -3,20 +3,28 @@ layer at (0,0) size 800x600 > layer at (0,0) size 800x600 > RenderBlock {HTML} at (0,0) size 800x600 > RenderBody {BODY} at (8,8) size 784x584 >+ RenderImage {IMG} at (0,0) size 160x90 > RenderText {#text} at (160,76) size 4x18 > text run at (160,76) width 4: " " >+ RenderImage {IMG} at (164,0) size 160x90 > RenderText {#text} at (324,76) size 4x18 > text run at (324,76) width 4: " " >+ RenderImage {IMG} at (328,0) size 160x90 > RenderText {#text} at (488,76) size 4x18 > text run at (488,76) width 4: " " >+ RenderImage {IMG} at (492,0) size 160x90 > RenderText {#text} at (652,76) size 4x18 > text run at (652,76) width 4: " " >+ RenderImage {IMG} at (0,94) size 160x90 > RenderText {#text} at (160,170) size 4x18 > text run at (160,170) width 4: " " >+ RenderImage {IMG} at (164,94) size 160x90 > RenderText {#text} at (324,170) size 4x18 > text run at (324,170) width 4: " " >+ RenderImage {IMG} at (328,94) size 160x90 > RenderText {#text} at (488,170) size 4x18 > text run at (488,170) width 4: " " >+ RenderImage {IMG} at (492,94) size 160x90 > RenderText {#text} at (652,170) size 4x18 > text run at (652,170) width 4: " " > RenderText {#text} at (160,264) size 4x18 >@@ -26,22 +34,6 @@ layer at (0,0) size 800x600 > RenderText {#text} at (488,264) size 4x18 > text run at (488,264) width 4: " " > RenderText {#text} at (0,0) size 0x0 >-layer at (8,8) size 160x90 >- RenderImage {IMG} at (0,0) size 160x90 >-layer at (172,8) size 160x90 >- RenderImage {IMG} at (164,0) size 160x90 >-layer at (336,8) size 160x90 >- RenderImage {IMG} at (328,0) size 160x90 >-layer at (500,8) size 160x90 >- RenderImage {IMG} at (492,0) size 160x90 >-layer at (8,102) size 160x90 >- RenderImage {IMG} at (0,94) size 160x90 >-layer at (172,102) size 160x90 >- RenderImage {IMG} at (164,94) size 160x90 >-layer at (336,102) size 160x90 >- RenderImage {IMG} at (328,94) size 160x90 >-layer at (500,102) size 160x90 >- RenderImage {IMG} at (492,94) size 160x90 > layer at (8,196) size 160x90 > RenderImage {IMG} at (0,188) size 160x90 > layer at (172,196) size 160x90
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 184937
:
338790
|
338792
|
338809
|
338810
|
338815
|
338818