Diff
Modified: trunk/LayoutTests/ChangeLog (236277 => 236278)
--- trunk/LayoutTests/ChangeLog 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/LayoutTests/ChangeLog 2018-09-20 20:43:36 UTC (rev 236278)
@@ -1,3 +1,18 @@
+2018-09-20 Oriol Brufau <[email protected]>
+
+ Fix 'border' serialization with both common and uncommon values
+ https://bugs.webkit.org/show_bug.cgi?id=189597
+
+ Reviewed by Simon Fraser.
+
+ Fix existing tests to check that 'border' serializes to empty string if there
+ are uncommon values.
+
+ * fast/css/getPropertyValue-border-expected.txt:
+ * fast/css/getPropertyValue-border.html:
+ * fast/dom/css-shorthand-common-value-expected.txt:
+ * fast/dom/css-shorthand-common-value.html:
+
2018-09-20 Dawei Fenton <[email protected]>
WebGL conformance: Failures and Timeouts in suite 2.0.0/conformance
Modified: trunk/LayoutTests/fast/css/getPropertyValue-border-expected.txt (236277 => 236278)
--- trunk/LayoutTests/fast/css/getPropertyValue-border-expected.txt 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/LayoutTests/fast/css/getPropertyValue-border-expected.txt 2018-09-20 20:43:36 UTC (rev 236278)
@@ -1,4 +1,4 @@
-1 2 3 4 5 6 7 8 9
+1 2 3 4 5 6 7 8 9 10
Bug 15823: getPropertyValue for border returns null, should compute the shorthand value
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -5,16 +5,42 @@
PASS div1.style.getPropertyValue("border") is '5px solid green'
-PASS div2.style.getPropertyValue("border") is '5px solid'
-PASS div3.style.getPropertyValue("border") is '5px green'
- NOTE: '5px green' is an illegal CSS value for 'border'.
-PASS div4.style.getPropertyValue("border") is 'solid green'
-PASS div5.style.getPropertyValue("border") is 'green'
- NOTE: 'green' is an illegal CSS value for 'border'.
-PASS div6.style.getPropertyValue("border") is '5px'
-PASS div7.style.getPropertyValue("border") is 'solid'
-PASS div8.style.getPropertyValue("border") is ""
-PASS div9.style.getPropertyValue("border") is ""
+PASS div2.style.getPropertyValue("border") is ''
+PASS div2.style.getPropertyValue("border-color") is 'green blue purple red'
+PASS div2.style.getPropertyValue("border-style") is 'solid'
+PASS div2.style.getPropertyValue("border-width") is '5px'
+PASS div3.style.getPropertyValue("border") is ''
+PASS div3.style.getPropertyValue("border-color") is 'green'
+PASS div3.style.getPropertyValue("border-style") is 'solid dotted groove dashed'
+PASS div3.style.getPropertyValue("border-width") is '5px'
+PASS div4.style.getPropertyValue("border") is ''
+PASS div4.style.getPropertyValue("border-color") is 'green'
+PASS div4.style.getPropertyValue("border-style") is 'solid'
+PASS div4.style.getPropertyValue("border-width") is '5px 5px 5px 4px'
+PASS div5.style.getPropertyValue("border") is ''
+PASS div5.style.getPropertyValue("border-color") is 'green'
+PASS div5.style.getPropertyValue("border-style") is 'solid dotted groove dashed'
+PASS div5.style.getPropertyValue("border-width") is '3px 4px 5px 2px'
+PASS div6.style.getPropertyValue("border") is ''
+PASS div6.style.getPropertyValue("border-color") is 'green blue purple red'
+PASS div6.style.getPropertyValue("border-style") is 'solid dotted groove dashed'
+PASS div6.style.getPropertyValue("border-width") is '5px'
+PASS div7.style.getPropertyValue("border") is ''
+PASS div7.style.getPropertyValue("border-color") is 'green blue purple red'
+PASS div7.style.getPropertyValue("border-style") is 'solid'
+PASS div7.style.getPropertyValue("border-width") is '3px 4px 5px 2px'
+PASS div8.style.getPropertyValue("border") is ''
+PASS div8.style.getPropertyValue("border-color") is 'green blue purple red'
+PASS div8.style.getPropertyValue("border-style") is 'solid dotted groove dashed'
+PASS div8.style.getPropertyValue("border-width") is '3px 5px 5px 2px'
+PASS div9.style.getPropertyValue("border") is ''
+PASS div9.style.getPropertyValue("border-color") is ''
+PASS div9.style.getPropertyValue("border-style") is ''
+PASS div9.style.getPropertyValue("border-width") is ''
+PASS div10.style.getPropertyValue("border") is '5px solid green'
+PASS div10.style.getPropertyValue("border-color") is 'green'
+PASS div10.style.getPropertyValue("border-style") is 'solid'
+PASS div10.style.getPropertyValue("border-width") is '5px'
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/css/getPropertyValue-border.html (236277 => 236278)
--- trunk/LayoutTests/fast/css/getPropertyValue-border.html 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/LayoutTests/fast/css/getPropertyValue-border.html 2018-09-20 20:43:36 UTC (rev 236278)
@@ -27,6 +27,7 @@
<div id="border7" class="test" style="border-left: 2px solid red; border-top: 3px solid green; border-right: 4px solid blue; border-bottom: 5px solid purple;">7</div>
<div id="border8" class="test" style="border-left: 2px dashed red; border-top: 3px solid green; border-right: 5px dotted blue; border-bottom: 5px groove purple;">8</div>
<div id="border9" class="test" style="border-left: 5px solid red; border-top: 5px solid green; border-right: 5px solid blue;">9</div>
+ <div id="border10" class="test" style="border-left: 5px solid green; border-top: 5px solid green; border-right: 5px solid green; border-bottom: 5px solid green; border-image: initial">10</div>
<p id="description"></p>
<div id="console"></div>
<script>
@@ -36,30 +37,58 @@
shouldBe('div1.style.getPropertyValue("border")', "'5px solid green'");
var div2 = document.getElementById("border2");
- shouldBe('div2.style.getPropertyValue("border")', "'5px solid'");
+ shouldBe('div2.style.getPropertyValue("border")', "''");
+ shouldBe('div2.style.getPropertyValue("border-color")', "'green blue purple red'");
+ shouldBe('div2.style.getPropertyValue("border-style")', "'solid'");
+ shouldBe('div2.style.getPropertyValue("border-width")', "'5px'");
var div3 = document.getElementById("border3");
- shouldBe('div3.style.getPropertyValue("border")', "'5px green'");
- debug(" NOTE: '5px green' is an illegal CSS value for 'border'.");
+ shouldBe('div3.style.getPropertyValue("border")', "''");
+ shouldBe('div3.style.getPropertyValue("border-color")', "'green'");
+ shouldBe('div3.style.getPropertyValue("border-style")', "'solid dotted groove dashed'");
+ shouldBe('div3.style.getPropertyValue("border-width")', "'5px'");
var div4 = document.getElementById("border4");
- shouldBe('div4.style.getPropertyValue("border")', "'solid green'");
+ shouldBe('div4.style.getPropertyValue("border")', "''");
+ shouldBe('div4.style.getPropertyValue("border-color")', "'green'");
+ shouldBe('div4.style.getPropertyValue("border-style")', "'solid'");
+ shouldBe('div4.style.getPropertyValue("border-width")', "'5px 5px 5px 4px'");
var div5 = document.getElementById("border5");
- shouldBe('div5.style.getPropertyValue("border")', "'green'");
- debug(" NOTE: 'green' is an illegal CSS value for 'border'.");
+ shouldBe('div5.style.getPropertyValue("border")', "''");
+ shouldBe('div5.style.getPropertyValue("border-color")', "'green'");
+ shouldBe('div5.style.getPropertyValue("border-style")', "'solid dotted groove dashed'");
+ shouldBe('div5.style.getPropertyValue("border-width")', "'3px 4px 5px 2px'");
var div6 = document.getElementById("border6");
- shouldBe('div6.style.getPropertyValue("border")', "'5px'");
+ shouldBe('div6.style.getPropertyValue("border")', "''");
+ shouldBe('div6.style.getPropertyValue("border-color")', "'green blue purple red'");
+ shouldBe('div6.style.getPropertyValue("border-style")', "'solid dotted groove dashed'");
+ shouldBe('div6.style.getPropertyValue("border-width")', "'5px'");
var div7 = document.getElementById("border7");
- shouldBe('div7.style.getPropertyValue("border")', "'solid'");
+ shouldBe('div7.style.getPropertyValue("border")', "''");
+ shouldBe('div7.style.getPropertyValue("border-color")', "'green blue purple red'");
+ shouldBe('div7.style.getPropertyValue("border-style")', "'solid'");
+ shouldBe('div7.style.getPropertyValue("border-width")', "'3px 4px 5px 2px'");
var div8 = document.getElementById("border8");
- shouldBeEqualToString('div8.style.getPropertyValue("border")', "");
+ shouldBe('div8.style.getPropertyValue("border")', "''");
+ shouldBe('div8.style.getPropertyValue("border-color")', "'green blue purple red'");
+ shouldBe('div8.style.getPropertyValue("border-style")', "'solid dotted groove dashed'");
+ shouldBe('div8.style.getPropertyValue("border-width")', "'3px 5px 5px 2px'");
var div9 = document.getElementById("border9");
- shouldBeEqualToString('div9.style.getPropertyValue("border")', "");
+ shouldBe('div9.style.getPropertyValue("border")', "''");
+ shouldBe('div9.style.getPropertyValue("border-color")', "''");
+ shouldBe('div9.style.getPropertyValue("border-style")', "''");
+ shouldBe('div9.style.getPropertyValue("border-width")', "''");
+
+ var div10 = document.getElementById("border10");
+ shouldBe('div10.style.getPropertyValue("border")', "'5px solid green'");
+ shouldBe('div10.style.getPropertyValue("border-color")', "'green'");
+ shouldBe('div10.style.getPropertyValue("border-style")', "'solid'");
+ shouldBe('div10.style.getPropertyValue("border-width")', "'5px'");
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/fast/dom/css-shorthand-common-value-expected.txt (236277 => 236278)
--- trunk/LayoutTests/fast/dom/css-shorthand-common-value-expected.txt 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/LayoutTests/fast/dom/css-shorthand-common-value-expected.txt 2018-09-20 20:43:36 UTC (rev 236278)
@@ -1,3 +1,3 @@
-getPropertyValue('border') should not return a value for any property that doesn't have the same value for top, left, right and bottom, even if the values that differ are implicitly set by a shorthand.
+getPropertyValue('border') should return empty string if some side has different width, style or color than the others, even if the values that differ are implicitly set by a shorthand.
PASS
Modified: trunk/LayoutTests/fast/dom/css-shorthand-common-value.html (236277 => 236278)
--- trunk/LayoutTests/fast/dom/css-shorthand-common-value.html 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/LayoutTests/fast/dom/css-shorthand-common-value.html 2018-09-20 20:43:36 UTC (rev 236278)
@@ -5,7 +5,7 @@
border-top-width: 50px;
}
</style>
-<p>getPropertyValue('border') should not return a value for any property that doesn't have the same value for top, left, right and bottom, even if the values that differ are implicitly set by a shorthand.
+<p>getPropertyValue('border') should return empty string if some side has different width, style or color than the others, even if the values that differ are implicitly set by a shorthand.
<pre id="result">
</pre>
@@ -13,7 +13,7 @@
if (window.testRunner)
testRunner.dumpAsText();
var sheet = document.querySelector('style').sheet;
- var expected = 'solid red';
+ var expected = '';
var actual = sheet.cssRules[0].style.getPropertyValue('border');
if (expected == actual)
Modified: trunk/Source/WebCore/ChangeLog (236277 => 236278)
--- trunk/Source/WebCore/ChangeLog 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/Source/WebCore/ChangeLog 2018-09-20 20:43:36 UTC (rev 236278)
@@ -1,3 +1,22 @@
+2018-09-20 Oriol Brufau <[email protected]>
+
+ Fix 'border' serialization with both common and uncommon values
+ https://bugs.webkit.org/show_bug.cgi?id=189597
+
+ Reviewed by Simon Fraser.
+
+ Remove CommonValueMode enum and make borderPropertyValue always return null
+ when there are uncommon values (the previous ReturnNullOnUncommonValues mode).
+
+ Test: fast/css/getPropertyValue-border.html
+ Test: fast/dom/css-shorthand-common-value.html
+
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue const):
+ (WebCore::StyleProperties::borderPropertyValue const):
+ (WebCore::StyleProperties::asText const):
+ * css/StyleProperties.h:
+
2018-09-20 Justin Michaud <[email protected]>
Implement CSS Custom Properties and Values Skeleton
Modified: trunk/Source/WebCore/css/StyleProperties.cpp (236277 => 236278)
--- trunk/Source/WebCore/css/StyleProperties.cpp 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/Source/WebCore/css/StyleProperties.cpp 2018-09-20 20:43:36 UTC (rev 236278)
@@ -148,7 +148,7 @@
case CSSPropertyBackground:
return getLayeredShorthandValue(backgroundShorthand());
case CSSPropertyBorder:
- return borderPropertyValue(OmitUncommonValues);
+ return borderPropertyValue();
case CSSPropertyBorderTop:
return getShorthandValue(borderTopShorthand());
case CSSPropertyBorderRight:
@@ -619,7 +619,7 @@
return value;
}
-String StyleProperties::borderPropertyValue(CommonValueMode valueMode) const
+String StyleProperties::borderPropertyValue() const
{
const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() };
String commonValue;
@@ -626,15 +626,11 @@
StringBuilder result;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
String value = getCommonValue(properties[i]);
- if (value.isNull()) {
- if (valueMode == ReturnNullOnUncommonValues)
- return String();
- ASSERT(valueMode == OmitUncommonValues);
- continue;
- }
+ if (value.isNull())
+ return String();
if (!i)
commonValue = value;
- else if (!commonValue.isNull() && commonValue != value)
+ else if (commonValue != value)
commonValue = String();
if (value == "initial")
continue;
@@ -644,7 +640,7 @@
}
if (isInitialOrInherit(commonValue))
return commonValue;
- return result.isEmpty() ? String() : result.toString();
+ return result.toString();
}
RefPtr<CSSValue> StyleProperties::getPropertyCSSValue(CSSPropertyID propertyID) const
@@ -954,7 +950,7 @@
// FIXME: Deal with cases where only some of border-(top|right|bottom|left) are specified.
ASSERT(CSSPropertyBorder - firstCSSProperty < shorthandPropertyAppeared.size());
if (!shorthandPropertyAppeared[CSSPropertyBorder - firstCSSProperty]) {
- value = borderPropertyValue(ReturnNullOnUncommonValues);
+ value = borderPropertyValue();
if (value.isNull())
shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
else
Modified: trunk/Source/WebCore/css/StyleProperties.h (236277 => 236278)
--- trunk/Source/WebCore/css/StyleProperties.h 2018-09-20 20:41:16 UTC (rev 236277)
+++ trunk/Source/WebCore/css/StyleProperties.h 2018-09-20 20:43:36 UTC (rev 236278)
@@ -163,8 +163,7 @@
String getShorthandValue(const StylePropertyShorthand&) const;
String getCommonValue(const StylePropertyShorthand&) const;
String getAlignmentShorthandValue(const StylePropertyShorthand&) const;
- enum CommonValueMode { OmitUncommonValues, ReturnNullOnUncommonValues };
- String borderPropertyValue(CommonValueMode) const;
+ String borderPropertyValue() const;
String getLayeredShorthandValue(const StylePropertyShorthand&) const;
String get4Values(const StylePropertyShorthand&) const;
String borderSpacingValue(const StylePropertyShorthand&) const;