Skip to content
Permalink
Browse files
CSS revert should serialize as "revert", not "Revert"
https://bugs.webkit.org/show_bug.cgi?id=216187

Reviewed by Anders Carlsson.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-color-adjust/parsing/color-scheme-valid-expected.txt: Expect
one additional test to pass instead of fail.

* web-platform-tests/css/css-values/unset-value-storage-expected.txt: Expect pass instead of fail.
* web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Ditto.

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-values/unset-value-storage.html
       imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block.html

* css/CSSRevertValue.cpp:
(WebCore::CSSRevertValue::customCSSText const): Use lowercase "revert".

* css/StyleProperties.cpp:
(WebCore::isCSSWideValueKeyword): Added. Replaces isInitialOrInherit.
(WebCore::StyleProperties::fontValue const): Use isCSSWideValueKeyword rather
than isInitialOrInherit.
(WebCore::StyleProperties::getLayeredShorthandValue const): Ditto. Also
rearranged thee function a bit and shortened some excessively wordy code.
(WebCore::StyleProperties::getShorthandValue const): Ditto.
(WebCore::StyleProperties::borderPropertyValue const): Ditto.
(WebCore::StyleProperties::asText const): Added code to properly handle the
case where both background-position/repeat-x and -y are the same CSS-wide
value keyword as well as cases involving "initial". The general case above
handles these properly, but background-position/repeat have their own code,
which needed to repeat some of the same logic.
(WebCore::StyleProperties::PropertyReference::cssText const): Use makeString
instead of StringBuilder.

* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged): Removed incorrect code that
detached the CSS object model style wrapper from the element when the style
attribute was removed. This was incorrect behavior; it should stay attached.
This fix happens to be tested by the same file as the "revert"/"Revert" fix
and I wanted the whole file to pass, not just one more test.

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::addBlockStyle): Rewrote for simplicity, but
also so this works properly when inlineStyle is non-null but empty. This case
arises in one test now because of the change to StyledElement above.

LayoutTests:

* editing/spelling/spelling-dots-position-expected.html: Remove some unneeded style text.
Caught my eye because it uses "background-position: initial".

* fast/css/background-position-serialize-expected.txt: Updated for a progression.
We now correctly omit "background-position: initial initial; background-repeat: initial initial;".

* platform/gtk/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
These were only needed because the failure strings depended on the exact set of attributes.
But the test passes now.


Canonical link: https://commits.webkit.org/229029@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
darinadler committed Sep 5, 2020
1 parent 0f45c53 commit afe30bf025b46ebbefa1ff077596c4854e9b1804
@@ -1,3 +1,22 @@
2020-09-05 Darin Adler <darin@apple.com>

CSS revert should serialize as "revert", not "Revert"
https://bugs.webkit.org/show_bug.cgi?id=216187

Reviewed by Anders Carlsson.

* editing/spelling/spelling-dots-position-expected.html: Remove some unneeded style text.
Caught my eye because it uses "background-position: initial".

* fast/css/background-position-serialize-expected.txt: Updated for a progression.
We now correctly omit "background-position: initial initial; background-repeat: initial initial;".

* platform/gtk/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Removed.
These were only needed because the failure strings depended on the exact set of attributes.
But the test passes now.

2020-09-05 Commit Queue <commit-queue@webkit.org>

Unreviewed, reverting r266614 and r266657.
@@ -10,9 +10,9 @@
</head>
<body>
<div>There should be no misspelling dots visible below (because they're covered up by a div)</div>
<div contenteditable="" id="root" class="editing">wafewerewdfea&nbsp;<span id="test"></span><div style="background-color: black; width: 1px; height: 150px; display: inline-block; background-position: initial initial; background-repeat: initial initial;"></div></div>
<div contenteditable="" id="root" class="editing">wafewerewdfea&nbsp;<span id="test"></span><div style="background-color: black; width: 1px; height: 150px; display: inline-block"></div></div>
<script>
runEditingTest();
</script><div style="background-color: black; position: absolute; left: 8px; top: 179.9726px; width: 237px; height: 4.7689200000000005px; background-position: initial initial; background-repeat: initial initial;"></div>
</script><div style="background-color: black; position: absolute; left: 8px; top: 179.9726px; width: 237px; height: 4.76892px"></div>
</body>
</html>
@@ -72,4 +72,4 @@ PASS: window.getComputedStyle(t).backgroundPositionX should be 20px and is.
t.setAttribute('style', 'background: url(about:blank) 80% 80%;');
t.style.backgroundPositionY = '50px'
style.cssText =
background-image: url("about:blank"); background-position: 80% 50px; background-repeat: initial initial;
background-image: url("about:blank"); background-position: 80% 50px;
@@ -1,3 +1,16 @@
2020-09-05 Darin Adler <darin@apple.com>

CSS revert should serialize as "revert", not "Revert"
https://bugs.webkit.org/show_bug.cgi?id=216187

Reviewed by Anders Carlsson.

* web-platform-tests/css/css-color-adjust/parsing/color-scheme-valid-expected.txt: Expect
one additional test to pass instead of fail.

* web-platform-tests/css/css-values/unset-value-storage-expected.txt: Expect pass instead of fail.
* web-platform-tests/css/cssom/css-style-attr-decl-block-expected.txt: Ditto.

2020-09-05 Darin Adler <darin@apple.com>

Implement serialization of CSSPropertyGap
@@ -15,7 +15,7 @@ FAIL e.style['color-scheme'] = "light none" should set the property value assert
PASS e.style['color-scheme'] = "inherit" should set the property value
PASS e.style['color-scheme'] = "initial" should set the property value
PASS e.style['color-scheme'] = "unset" should set the property value
FAIL e.style['color-scheme'] = "revert" should set the property value assert_equals: serialization should be canonical expected "revert" but got "Revert"
PASS e.style['color-scheme'] = "revert" should set the property value
PASS e.style['color-scheme'] = "only" should set the property value
FAIL e.style['color-scheme'] = "only only" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['color-scheme'] = "only light dark" should set the property value
@@ -1,3 +1,3 @@

FAIL Storage of "unset" value assert_equals: border is expected to be "unset" expected "unset" but got "unset unset unset"
PASS Storage of "unset" value

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,3 +1,44 @@
2020-09-05 Darin Adler <darin@apple.com>

CSS revert should serialize as "revert", not "Revert"
https://bugs.webkit.org/show_bug.cgi?id=216187

Reviewed by Anders Carlsson.

Tests: imported/w3c/web-platform-tests/css/css-values/unset-value-storage.html
imported/w3c/web-platform-tests/css/cssom/css-style-attr-decl-block.html

* css/CSSRevertValue.cpp:
(WebCore::CSSRevertValue::customCSSText const): Use lowercase "revert".

* css/StyleProperties.cpp:
(WebCore::isCSSWideValueKeyword): Added. Replaces isInitialOrInherit.
(WebCore::StyleProperties::fontValue const): Use isCSSWideValueKeyword rather
than isInitialOrInherit.
(WebCore::StyleProperties::getLayeredShorthandValue const): Ditto. Also
rearranged thee function a bit and shortened some excessively wordy code.
(WebCore::StyleProperties::getShorthandValue const): Ditto.
(WebCore::StyleProperties::borderPropertyValue const): Ditto.
(WebCore::StyleProperties::asText const): Added code to properly handle the
case where both background-position/repeat-x and -y are the same CSS-wide
value keyword as well as cases involving "initial". The general case above
handles these properly, but background-position/repeat have their own code,
which needed to repeat some of the same logic.
(WebCore::StyleProperties::PropertyReference::cssText const): Use makeString
instead of StringBuilder.

* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged): Removed incorrect code that
detached the CSS object model style wrapper from the element when the style
attribute was removed. This was incorrect behavior; it should stay attached.
This fix happens to be tested by the same file as the "revert"/"Revert" fix
and I wanted the whole file to pass, not just one more test.

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::addBlockStyle): Rewrote for simplicity, but
also so this works properly when inlineStyle is non-null but empty. This case
arises in one test now because of the change to StyledElement above.

2020-09-05 Darin Adler <darin@apple.com>

Implement serialization of CSSPropertyGap
@@ -32,7 +32,7 @@ namespace WebCore {

String CSSRevertValue::customCSSText() const
{
return "Revert"_s;
return "revert"_s;
}

} // namespace WebCore

0 comments on commit afe30bf

Please sign in to comment.