Title: [290864] trunk
- Revision
- 290864
- Author
- obru...@igalia.com
- Date
- 2022-03-05 03:18:55 -0800 (Sat, 05 Mar 2022)
Log Message
[css-cascade] Let 'revert-layer' in lowest layer roll back to user styles
https://bugs.webkit.org/show_bug.cgi?id=237486
Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:
Add test. It still has some remaining failures due to bug 236272.
* web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt: Added.
* web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html: Added.
Source/WebCore:
When 'revert-layer' was used in the lowest @layer, then it would behave
as 'unset'. This patch fixes ensureRollbackCascadeForRevertLayer() to
not return nullptr and instead return ensureRollbackCascadeForRevert()
in that case. This imples that 'revert-layer' will behave like 'revert'
and roll back to user (or UA) styles.
Test: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::ensureRollbackCascadeForRevertLayer):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290863 => 290864)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-05 07:22:15 UTC (rev 290863)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-05 11:18:55 UTC (rev 290864)
@@ -1,3 +1,15 @@
+2022-03-05 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Let 'revert-layer' in lowest layer roll back to user styles
+ https://bugs.webkit.org/show_bug.cgi?id=237486
+
+ Reviewed by Antti Koivisto.
+
+ Add test. It still has some remaining failures due to bug 236272.
+
+ * web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt: Added.
+ * web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html: Added.
+
2022-03-04 Chris Dumez <cdu...@apple.com>
Home link on weather.gov is not working
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt (0 => 290864)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt 2022-03-05 11:18:55 UTC (rev 290864)
@@ -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
+FAIL del assert_equals: text-decoration expected "line-through" but got "none"
+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
+FAIL ins assert_equals: text-decoration expected "underline" but got "none"
+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
+FAIL s assert_equals: text-decoration expected "line-through" but got "none"
+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
+FAIL u assert_equals: text-decoration expected "underline" but got "none"
+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-layer-noop.html (0 => 290864)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html 2022-03-05 11:18:55 UTC (rev 290864)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Cascade: "all: revert-layer"</title>
+<link rel="author" title="Oriol Brufau" href=""
+<link rel="help" href=""
+<meta name="assert" content="Checks that adding 'all: revert-layer' inside @layer has no effect on elements with no other author rules.">
+
+<style>
+@layer {
+ .revert-all {
+ all: revert-layer;
+ }
+}
+</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 (290863 => 290864)
--- trunk/Source/WebCore/ChangeLog 2022-03-05 07:22:15 UTC (rev 290863)
+++ trunk/Source/WebCore/ChangeLog 2022-03-05 11:18:55 UTC (rev 290864)
@@ -1,3 +1,21 @@
+2022-03-05 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Let 'revert-layer' in lowest layer roll back to user styles
+ https://bugs.webkit.org/show_bug.cgi?id=237486
+
+ Reviewed by Antti Koivisto.
+
+ When 'revert-layer' was used in the lowest @layer, then it would behave
+ as 'unset'. This patch fixes ensureRollbackCascadeForRevertLayer() to
+ not return nullptr and instead return ensureRollbackCascadeForRevert()
+ in that case. This imples that 'revert-layer' will behave like 'revert'
+ and roll back to user (or UA) styles.
+
+ Test: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html
+
+ * style/StyleBuilder.cpp:
+ (WebCore::Style::Builder::ensureRollbackCascadeForRevertLayer):
+
2022-03-04 Simon Fraser <simon.fra...@apple.com>
Optimize the padding in StyleRareInheritedData
Modified: trunk/Source/WebCore/style/StyleBuilder.cpp (290863 => 290864)
--- trunk/Source/WebCore/style/StyleBuilder.cpp 2022-03-05 07:22:15 UTC (rev 290863)
+++ trunk/Source/WebCore/style/StyleBuilder.cpp 2022-03-05 11:18:55 UTC (rev 290864)
@@ -399,7 +399,7 @@
auto& property = *m_state.m_currentProperty;
auto rollbackLayerPriority = property.cascadeLayerPriority;
if (!rollbackLayerPriority)
- return nullptr;
+ return ensureRollbackCascadeForRevert();
ASSERT(property.fromStyleAttribute == FromStyleAttribute::No || property.cascadeLayerPriority == RuleSet::cascadeLayerPriorityForUnlayered);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes