WebKit Bugzilla
Attachment 349763 Details for
Bug 189597
: Wrong 'border' serialization with both common and uncommon values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189597-20180914175203.patch (text/plain), 8.01 KB, created by
Oriol Brufau
on 2018-09-14 08:52:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Oriol Brufau
Created:
2018-09-14 08:52:04 PDT
Size:
8.01 KB
patch
obsolete
>Subversion Revision: 235979 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 953e4068f6d79f81287c600d85d189012c3c66ce..d0302198ce51c03477ca2a2e202d83b63191a143 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-09-14 Oriol Brufau <obrufau@igalia.com> >+ >+ Fix 'border' serialization with both common and uncommon values >+ https://bugs.webkit.org/show_bug.cgi?id=189597 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove CommonValueMode enum and make borderPropertyValue always return null >+ when there are uncommon values (the previous ReturnNullOnUncommonValues mode). >+ >+ Test: imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html >+ >+ * css/StyleProperties.cpp: >+ (WebCore::StyleProperties::getPropertyValue const): >+ (WebCore::StyleProperties::borderPropertyValue const): >+ (WebCore::StyleProperties::asText const): >+ * css/StyleProperties.h: >+ > 2018-09-13 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r235953. >diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp >index 7408177375757ccce5fce32fd8513202f090f375..5d78f8c17fe1def1b22ffde44e152db4f65b07eb 100644 >--- a/Source/WebCore/css/StyleProperties.cpp >+++ b/Source/WebCore/css/StyleProperties.cpp >@@ -148,7 +148,7 @@ String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const > case CSSPropertyBackground: > return getLayeredShorthandValue(backgroundShorthand()); > case CSSPropertyBorder: >- return borderPropertyValue(OmitUncommonValues); >+ return borderPropertyValue(); > case CSSPropertyBorderTop: > return getShorthandValue(borderTopShorthand()); > case CSSPropertyBorderRight: >@@ -619,22 +619,18 @@ String StyleProperties::getAlignmentShorthandValue(const StylePropertyShorthand& > return value; > } > >-String StyleProperties::borderPropertyValue(CommonValueMode valueMode) const >+String StyleProperties::borderPropertyValue() const > { > const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() }; > String commonValue; > 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 @@ String StyleProperties::borderPropertyValue(CommonValueMode valueMode) const > } > 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 @@ String StyleProperties::asText() const > // 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 >diff --git a/Source/WebCore/css/StyleProperties.h b/Source/WebCore/css/StyleProperties.h >index a183a9cca2c563e03834beab24ebc250d20543a8..3f4b65ab7288dd0f3b161ba41bd505df2e37550c 100644 >--- a/Source/WebCore/css/StyleProperties.h >+++ b/Source/WebCore/css/StyleProperties.h >@@ -163,8 +163,7 @@ private: > 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; >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 630094d8f370a8b2d64faa015ec1040e0b07c00b..5d491c8dece9e26b6b9fb2941cd98a936aa4546d 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,14 @@ >+2018-09-14 Oriol Brufau <obrufau@igalia.com> >+ >+ Fix 'border' serialization with both common and uncommon values >+ https://bugs.webkit.org/show_bug.cgi?id=189597 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add test checking 'border' serialization. >+ >+ * web-platform-tests/css/cssom/shorthand-serialization.html: >+ > 2018-09-12 Chris Dumez <cdumez@apple.com> > > Unreviewed, rebaseline imported/w3c/web-platform-tests/url/failure.html after r235808. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html >index 97e11da8b8a266c7efa3826272e3fdb7ce55ed86..626d114ee83de61d15c04ef91507130d37d3df32 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html >@@ -21,6 +21,8 @@ > <div id="test"></div> > > <script> >+ const testElem = document.getElementById("test"); >+ > test(function() { > var elem1 = document.getElementById('foo1'); > var elem2 = document.getElementById('foo2'); >@@ -53,27 +55,23 @@ > }, "Shorthand serialization with variable and variable from other shorthand."); > > test(function() { >- var testElem = document.getElementById("test"); > testElem.style.margin = "20px 20px 20px 20px"; > assert_equals(testElem.style.margin, "20px"); > assert_equals(testElem.style.cssText, "margin: 20px;") > }, "Shorthand serialization after setting"); > > test(function() { >- const testElem = document.getElementById("test"); > testElem.style.cssText = "margin: initial;"; > assert_equals(testElem.style.margin, "initial"); > assert_equals(testElem.style.cssText, "margin: initial;"); > }, "Shorthand serialization with 'initial' value."); > > test(function() { >- const testElem = document.getElementById("test"); > testElem.style.setProperty("margin-top", "initial", "important"); > assert_equals(testElem.style.margin, ""); > }, "Shorthand serialization with 'initial' value, one longhand with important flag."); > > test(function() { >- const testElem = document.getElementById("test"); > testElem.style.cssText = ""; > testElem.style.setProperty("margin-top", "initial"); > testElem.style.setProperty("margin-right", "initial"); >@@ -81,6 +79,11 @@ > testElem.style.setProperty("margin-left", "initial", "important"); > assert_equals(testElem.style.margin, ""); > }, "Shorthand serialization with 'initial' value, longhands set individually, one with important flag."); >+ >+ test(function() { >+ testElem.style.cssText = "border: 5px solid blue; border-top: 5px dotted green"; >+ assert_equals(testElem.style.border, ""); >+ }, "Shorthand serialization with both common and uncommon values."); > </script> > </body> > </html>
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 189597
:
349763
|
349767
|
349773
|
349777
|
349780
|
349785
|
349794
|
349797
|
350250