- Revision
- 291260
- Author
- obru...@igalia.com
- Date
- 2022-03-14 18:48:15 -0700 (Mon, 14 Mar 2022)
Log Message
[css-cascade] Fix 'revert' on low-priority properties
https://bugs.webkit.org/show_bug.cgi?id=236272
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Add one test and expect an existing one to pass.
* web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt:
* web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt.
* web-platform-tests/css/css-cascade/all-prop-revert-noop.html: Added.
Source/WebCore:
Some CSS properties are low-priority (a.k.a deferred or applied in parse
order). The logic for the 'revert' keyword was not taking these into
account, so it just behaved as 'unset'.
That made elements like <del>, <ins>, <s> and <u> lose the line-through
or underline thet they get in UA origin, when styled with 'all: revert'
or 'text-decoration: revert'.
This patch takes these properties into account so that 'revert' works.
Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html
imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html
* style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::setDeferred):
* style/PropertyCascade.h:
(WebCore::Style::PropertyCascade::hasDeferredProperty const):
(WebCore::Style::PropertyCascade::deferredProperty const):
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291259 => 291260)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-15 01:48:15 UTC (rev 291260)
@@ -1,3 +1,16 @@
+2022-03-14 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Fix 'revert' on low-priority properties
+ https://bugs.webkit.org/show_bug.cgi?id=236272
+
+ Reviewed by Darin Adler.
+
+ Add one test and expect an existing one to pass.
+
+ * web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt:
+ * web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt.
+ * web-platform-tests/css/css-cascade/all-prop-revert-noop.html: Added.
+
2022-03-14 Antoine Quint <grao...@webkit.org>
[web-animations] marker-start should support discrete animation
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt (291259 => 291260)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt 2022-03-15 01:48:15 UTC (rev 291260)
@@ -23,7 +23,7 @@
PASS data
PASS datalist
PASS dd
-FAIL del assert_equals: text-decoration expected "line-through" but got "none"
+PASS del
PASS details
PASS dfn
PASS dialog
@@ -51,7 +51,7 @@
PASS iframe
PASS img
PASS input
-FAIL ins assert_equals: text-decoration expected "underline" but got "none"
+PASS ins
PASS kbd
PASS label
PASS legend
@@ -79,7 +79,7 @@
PASS rp
PASS rt
PASS ruby
-FAIL s assert_equals: text-decoration expected "line-through" but got "none"
+PASS s
PASS samp
PASS script
PASS section
@@ -106,7 +106,7 @@
PASS title
PASS tr
PASS track
-FAIL u assert_equals: text-decoration expected "underline" but got "none"
+PASS u
PASS ul
PASS var
PASS video
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt (from rev 291259, trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt) (0 => 291260)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt 2022-03-15 01:48:15 UTC (rev 291260)
@@ -0,0 +1,125 @@
+
+PASS a
+PASS abbr
+PASS address
+PASS area
+PASS article
+PASS aside
+PASS audio
+PASS b
+PASS base
+PASS bdi
+PASS bdo
+PASS blockquote
+PASS body
+PASS br
+PASS button
+PASS canvas
+PASS caption
+PASS cite
+PASS code
+PASS col
+PASS colgroup
+PASS data
+PASS datalist
+PASS dd
+PASS del
+PASS details
+PASS dfn
+PASS dialog
+PASS div
+PASS dl
+PASS dt
+PASS em
+PASS embed
+PASS fieldset
+PASS figcaption
+PASS figure
+PASS footer
+PASS form
+PASS h1
+PASS h2
+PASS h3
+PASS h4
+PASS h5
+PASS h6
+PASS head
+PASS header
+PASS hr
+PASS html
+PASS i
+PASS iframe
+PASS img
+PASS input
+PASS ins
+PASS kbd
+PASS label
+PASS legend
+PASS li
+PASS link
+PASS main
+PASS map
+PASS mark
+PASS math
+PASS menu
+PASS meta
+PASS meter
+PASS nav
+PASS noscript
+PASS object
+PASS ol
+PASS optgroup
+PASS option
+PASS output
+PASS p
+PASS param
+PASS pre
+PASS progress
+PASS q
+PASS rp
+PASS rt
+PASS ruby
+PASS s
+PASS samp
+PASS script
+PASS section
+PASS select
+PASS slot
+PASS small
+PASS source
+PASS span
+PASS strong
+PASS style
+PASS sub
+PASS summary
+PASS sup
+PASS svg
+PASS table
+PASS tbody
+PASS td
+PASS template
+PASS textarea
+PASS tfoot
+PASS th
+PASS thead
+PASS time
+PASS title
+PASS tr
+PASS track
+PASS u
+PASS ul
+PASS var
+PASS video
+PASS wbr
+PASS z-custom
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html (0 => 291260)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html 2022-03-15 01:48:15 UTC (rev 291260)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Cascade: "all: revert"</title>
+<link rel="author" title="Oriol Brufau" href=""
+<link rel="help" href=""
+<meta name="assert" content="Checks that adding 'all: revert' has no effect on elements with no other author rules.">
+
+<style>
+.revert-all {
+ all: revert;
+}
+</style>
+
+<div id="log"></div>
+<div id="wrapper"></div>
+
+<script src=""
+<script src=""
+<script src=""
+<script>
+function cloneStyle(style) {
+ const clone = Object.create(null);
+ for (let property of style) {
+ clone[property] = style.getPropertyValue(property);
+ }
+ return clone;
+}
+
+function assertSameClones(clone1, clone2, callback) {
+ for (let property in clone1) {
+ const value1 = clone1[property];
+ const value2 = clone2[property];
+ // assert_equals is slow, so only call it if it's going to fail.
+ if (value1 !== value2) {
+ assert_equals(value1, value2, property);
+ }
+ }
+}
+
+const wrapper = document.getElementById("wrapper");
+const elementNames = [...HTML5_ELEMENTS, "math", "svg", "z-custom"].sort();
+for (let elementName of elementNames) {
+ test(function() {
+ const element = document.createElement(elementName);
+ wrapper.appendChild(element);
+ const style = getComputedStyle(element);
+ const clonedBaseStyle = cloneStyle(style);
+ element.classList.add("revert-all");
+ const clonedRevertedStyle = cloneStyle(style);
+ assertSameClones(clonedRevertedStyle, clonedBaseStyle);
+ }, elementName);
+}
+</script>
Modified: trunk/Source/WebCore/ChangeLog (291259 => 291260)
--- trunk/Source/WebCore/ChangeLog 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/Source/WebCore/ChangeLog 2022-03-15 01:48:15 UTC (rev 291260)
@@ -1,3 +1,30 @@
+2022-03-14 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Fix 'revert' on low-priority properties
+ https://bugs.webkit.org/show_bug.cgi?id=236272
+
+ Reviewed by Darin Adler.
+
+ Some CSS properties are low-priority (a.k.a deferred or applied in parse
+ order). The logic for the 'revert' keyword was not taking these into
+ account, so it just behaved as 'unset'.
+ That made elements like <del>, <ins>, <s> and <u> lose the line-through
+ or underline thet they get in UA origin, when styled with 'all: revert'
+ or 'text-decoration: revert'.
+
+ This patch takes these properties into account so that 'revert' works.
+
+ Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html
+ imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html
+
+ * style/PropertyCascade.cpp:
+ (WebCore::Style::PropertyCascade::setDeferred):
+ * style/PropertyCascade.h:
+ (WebCore::Style::PropertyCascade::hasDeferredProperty const):
+ (WebCore::Style::PropertyCascade::deferredProperty const):
+ * style/StyleBuilder.cpp:
+ (WebCore::Style::Builder::applyProperty):
+
2022-03-14 Eric Carlson <eric.carl...@apple.com>
[macOS] Use sRGB colorspace in ScreenCaptureKitCaptureSource
Modified: trunk/Source/WebCore/style/PropertyCascade.cpp (291259 => 291260)
--- trunk/Source/WebCore/style/PropertyCascade.cpp 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/Source/WebCore/style/PropertyCascade.cpp 2022-03-15 01:48:15 UTC (rev 291260)
@@ -173,6 +173,7 @@
Property property;
memset(property.cssValue, 0, sizeof(property.cssValue));
setPropertyInternal(property, id, cssValue, matchedProperties, cascadeLevel);
+ m_deferredPropertiesIndices.set(id, m_deferredProperties.size());
m_deferredProperties.append(property);
}
Modified: trunk/Source/WebCore/style/PropertyCascade.h (291259 => 291260)
--- trunk/Source/WebCore/style/PropertyCascade.h 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/Source/WebCore/style/PropertyCascade.h 2022-03-15 01:48:15 UTC (rev 291260)
@@ -62,6 +62,9 @@
bool hasProperty(CSSPropertyID) const;
const Property& property(CSSPropertyID) const;
+ bool hasDeferredProperty(CSSPropertyID) const;
+ const Property& deferredProperty(CSSPropertyID) const;
+
bool hasCustomProperty(const String&) const;
Property customProperty(const String&) const;
@@ -93,6 +96,8 @@
std::bitset<numCSSProperties + 2> m_propertyIsPresent;
Vector<Property, 8> m_deferredProperties;
+ HashMap<CSSPropertyID, unsigned> m_deferredPropertiesIndices;
+
HashMap<AtomString, Property> m_customProperties;
};
@@ -107,6 +112,19 @@
return m_properties[id];
}
+inline bool PropertyCascade::hasDeferredProperty(CSSPropertyID id) const
+{
+ return m_deferredPropertiesIndices.contains(id);
+}
+
+inline const PropertyCascade::Property& PropertyCascade::deferredProperty(CSSPropertyID id) const
+{
+ ASSERT(hasDeferredProperty(id));
+ unsigned index = m_deferredPropertiesIndices.get(id);
+ ASSERT(index < m_deferredProperties.size());
+ return m_deferredProperties[index];
+}
+
inline bool PropertyCascade::hasCustomProperty(const String& name) const
{
return m_customProperties.contains(name);
Modified: trunk/Source/WebCore/style/StyleBuilder.cpp (291259 => 291260)
--- trunk/Source/WebCore/style/StyleBuilder.cpp 2022-03-15 01:40:14 UTC (rev 291259)
+++ trunk/Source/WebCore/style/StyleBuilder.cpp 2022-03-15 01:48:15 UTC (rev 291260)
@@ -320,6 +320,10 @@
auto& property = rollbackCascade->property(id);
applyRollbackCascadeProperty(property, linkMatchMask);
return;
+ } else if (rollbackCascade->hasDeferredProperty(id)) {
+ auto& property = rollbackCascade->deferredProperty(id);
+ applyRollbackCascadeProperty(property, linkMatchMask);
+ return;
}
}