- Revision
- 117622
- Author
- [email protected]
- Date
- 2012-05-18 13:52:24 -0700 (Fri, 18 May 2012)
Log Message
background-size specified by a single value in background shorthand fails to parse.
https://bugs.webkit.org/show_bug.cgi?id=86739
Patch by Joe Thomas <[email protected]> on 2012-05-18
Reviewed by Tony Chang.
While parsing the background shorthand property, if the second parsedValue is not a valid unit,
parseFillSize should return the first parsedValue instead of failing.
Source/WebCore:
* css/CSSParser.cpp:
(WebCore::CSSParser::parseFillSize):
LayoutTests:
* fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
* fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (117621 => 117622)
--- trunk/LayoutTests/ChangeLog 2012-05-18 20:45:11 UTC (rev 117621)
+++ trunk/LayoutTests/ChangeLog 2012-05-18 20:52:24 UTC (rev 117622)
@@ -1,3 +1,16 @@
+2012-05-18 Joe Thomas <[email protected]>
+
+ background-size specified by a single value in background shorthand fails to parse.
+ https://bugs.webkit.org/show_bug.cgi?id=86739
+
+ Reviewed by Tony Chang.
+
+ While parsing the background shorthand property, if the second parsedValue is not a valid unit,
+ parseFillSize should return the first parsedValue instead of failing.
+
+ * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
+ * fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
+
2012-05-18 Raphael Kubo da Costa <[email protected]>
[EFL] Unreviewed gardening.
Modified: trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt (117621 => 117622)
--- trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt 2012-05-18 20:45:11 UTC (rev 117621)
+++ trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt 2012-05-18 20:52:24 UTC (rev 117622)
@@ -38,6 +38,27 @@
PASS computedStyle.getPropertyValue("background-size") is 'auto'
PASS checkComputedStyleValue() is true
+PASS e.style.background is 'red url(dummy://test.png) no-repeat fixed 50px 60px / 50%'
+PASS e.style.backgroundSize is '50%'
+PASS checkStyle() is true
+PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 50px 60px / 50%'
+PASS computedStyle.getPropertyValue("background-size") is '50%'
+PASS checkComputedStyleValue() is true
+
+PASS e.style.background is 'red url(dummy://test.png) repeat scroll padding-box padding-box 0% 0% / 100px'
+PASS e.style.backgroundSize is '100px'
+PASS checkStyle() is true
+PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0% / 100px'
+PASS computedStyle.getPropertyValue("background-size") is '100px'
+PASS checkComputedStyleValue() is true
+
+PASS e.style.background is 'red url(dummy://test.png) repeat fixed content-box content-box 50% 50% / auto'
+PASS e.style.backgroundSize is 'auto'
+PASS checkStyle() is true
+PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) repeat fixed 50% 50% / auto'
+PASS computedStyle.getPropertyValue("background-size") is 'auto'
+PASS checkComputedStyleValue() is true
+
PASS e.style.background is ''
PASS e.style.backgroundSize is ''
PASS checkStyle() is true
Modified: trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html (117621 => 117622)
--- trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html 2012-05-18 20:45:11 UTC (rev 117621)
+++ trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html 2012-05-18 20:52:24 UTC (rev 117622)
@@ -67,6 +67,33 @@
shouldBe("checkComputedStyleValue()", "true");
debug("")
+ e.style.background = "" red 50px 60px / 50% no-repeat fixed";
+ shouldBe("e.style.background", "'red url(dummy://test.png) no-repeat fixed 50px 60px / 50%'");
+ shouldBe("e.style.backgroundSize", "'50%'");
+ shouldBe("checkStyle()", "true");
+ shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 50px 60px / 50%'");
+ shouldBe('computedStyle.getPropertyValue("background-size")', "'50%'");
+ shouldBe("checkComputedStyleValue()", "true");
+ debug("")
+
+ e.style.background = "" repeat scroll padding-box padding-box top left / 100px url(dummy://test.png)";
+ shouldBe("e.style.background", "'red url(dummy://test.png) repeat scroll padding-box padding-box 0% 0% / 100px'");
+ shouldBe("e.style.backgroundSize", "'100px'");
+ shouldBe("checkStyle()", "true");
+ shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0% / 100px'");
+ shouldBe('computedStyle.getPropertyValue("background-size")', "'100px'");
+ shouldBe("checkComputedStyleValue()", "true");
+ debug("")
+
+ e.style.background = "" / auto fixed url(dummy://test.png) repeat content-box red";
+ shouldBe("e.style.background", "'red url(dummy://test.png) repeat fixed content-box content-box 50% 50% / auto'");
+ shouldBe("e.style.backgroundSize", "'auto'");
+ shouldBe("checkStyle()", "true");
+ shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) repeat fixed 50% 50% / auto'");
+ shouldBe('computedStyle.getPropertyValue("background-size")', "'auto'");
+ shouldBe("checkComputedStyleValue()", "true");
+ debug("")
+
e.style.background = ""
e.style.background = "" / cover url(dummy://test.png) repeat";
shouldBe("e.style.background", "''");
Modified: trunk/Source/WebCore/ChangeLog (117621 => 117622)
--- trunk/Source/WebCore/ChangeLog 2012-05-18 20:45:11 UTC (rev 117621)
+++ trunk/Source/WebCore/ChangeLog 2012-05-18 20:52:24 UTC (rev 117622)
@@ -1,3 +1,16 @@
+2012-05-18 Joe Thomas <[email protected]>
+
+ background-size specified by a single value in background shorthand fails to parse.
+ https://bugs.webkit.org/show_bug.cgi?id=86739
+
+ Reviewed by Tony Chang.
+
+ While parsing the background shorthand property, if the second parsedValue is not a valid unit,
+ parseFillSize should return the first parsedValue instead of failing.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseFillSize):
+
2012-05-18 Tony Chang <[email protected]>
remove the CSS_GRID_LAYOUT compiler define, but default grid layout to off
Modified: trunk/Source/WebCore/css/CSSParser.cpp (117621 => 117622)
--- trunk/Source/WebCore/css/CSSParser.cpp 2012-05-18 20:45:11 UTC (rev 117621)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2012-05-18 20:52:24 UTC (rev 117622)
@@ -3375,9 +3375,13 @@
if (value->unit == CSSParserValue::Operator && value->iValue == ',')
allowComma = false;
else if (value->id != CSSValueAuto) {
- if (!validUnit(value, FLength | FPercent))
- return 0;
- parsedValue2 = createPrimitiveNumericValue(value);
+ if (!validUnit(value, FLength | FPercent)) {
+ if (!inShorthand())
+ return 0;
+ // We need to rewind the value list, so that when it is advanced we'll end up back at this value.
+ m_valueList->previous();
+ } else
+ parsedValue2 = createPrimitiveNumericValue(value);
}
} else if (!parsedValue2 && propId == CSSPropertyWebkitBackgroundSize) {
// For backwards compatibility we set the second value to the first if it is omitted.