Diff
Modified: trunk/LayoutTests/ChangeLog (286948 => 286949)
--- trunk/LayoutTests/ChangeLog 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/LayoutTests/ChangeLog 2021-12-13 16:50:00 UTC (rev 286949)
@@ -1,3 +1,12 @@
+2021-12-13 Antti Koivisto <an...@apple.com>
+
+ [CSS Cascade Layers] Unflake and fix web-platform-tests/css/css-cascade/layer-statement-before-import.html
+ https://bugs.webkit.org/show_bug.cgi?id=233944
+
+ Reviewed by Simon Fraser.
+
+ * TestExpectations:
+
2021-12-13 Tyler Wilcock <tyle...@apple.com>
AX: Make aria-hidden-update.html, focusable-div.html, mac/invalid-status-for-input-types.html, and mac/css-speech-speak.html pass in --release isolated tree mode
Modified: trunk/LayoutTests/TestExpectations (286948 => 286949)
--- trunk/LayoutTests/TestExpectations 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/LayoutTests/TestExpectations 2021-12-13 16:50:00 UTC (rev 286949)
@@ -2185,7 +2185,6 @@
webkit.org/b/233937 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-010.html [ ImageOnlyFailure ]
webkit.org/b/233937 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-011.html [ ImageOnlyFailure ]
webkit.org/b/233937 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-012.html [ ImageOnlyFailure ]
-webkit.org/b/233944 imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import.html [ Pass Failure ]
webkit.org/b/148801 imported/w3c/web-platform-tests/css/css-color/t422-rgba-onscreen-b.xht [ ImageOnlyFailure ]
webkit.org/b/148801 imported/w3c/web-platform-tests/css/css-color/t422-rgba-onscreen-multiple-boxes-c.xht [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286948 => 286949)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-12-13 16:50:00 UTC (rev 286949)
@@ -1,3 +1,16 @@
+2021-12-13 Antti Koivisto <an...@apple.com>
+
+ [CSS Cascade Layers] Unflake and fix web-platform-tests/css/css-cascade/layer-statement-before-import.html
+ https://bugs.webkit.org/show_bug.cgi?id=233944
+
+ Reviewed by Simon Fraser.
+
+ * web-platform-tests/css/css-cascade/layer-statement-before-import-expected.txt:
+ * web-platform-tests/css/css-cascade/layer-statement-before-import.html:
+
+ Data URLs in @imports are not guaranteed to decode synchronously so make the test async.
+ Also catch exceptions from asserts for cleanup so failures don't affect other subtests.
+
2021-12-13 Youenn Fablet <you...@apple.com>
Implement step 17 of main fetch algorithm
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import-expected.txt (286948 => 286949)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import-expected.txt 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import-expected.txt 2021-12-13 16:50:00 UTC (rev 286949)
@@ -1,12 +1,10 @@
-CONSOLE MESSAGE: TypeError: Illegal constructor
-Harness Error (FAIL), message = TypeError: Illegal constructor
+PASS length and item
+PASS insertRule before imports
+PASS insertRule after imports
+PASS insert other rules to pre-import layer statements fails
+PASS insert other rules before the first layer statement without imports
+PASS deleteRule before imports
+PASS deleteRule after imports
+FAIL replaceSync clears stale layer statements promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL length and item assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL insertRule before imports assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL insertRule after imports assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL insert other rules to pre-import layer statements fails assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL insert other rules before the first layer statement without imports The operation would yield an incorrect node tree.
-FAIL deleteRule before imports assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL deleteRule after imports assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import.html (286948 => 286949)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import.html 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import.html 2021-12-13 16:50:00 UTC (rev 286949)
@@ -159,26 +159,32 @@
const reference = document.getElementById('reference');
for (let testCase of testCases) {
- let styleElement;
- let sheet;
- if (!testCase.constructedStyleSheet) {
- styleElement = document.createElement('style');
- styleElement.textContent = testCase.style;
- document.head.append(styleElement);
- sheet = styleElement.sheet;
- } else {
- sheet = new CSSStyleSheet();
- sheet.replaceSync(testCase.style);
- document.adoptedStyleSheets = [sheet];
- }
+ promise_test(async t => {
+ let styleElement;
+ let sheet;
+ if (!testCase.constructedStyleSheet) {
+ styleElement = document.createElement('style');
+ styleElement.textContent = testCase.style;
+ await new Promise(resolve => {
+ styleElement._onload_ = resolve;
+ styleElement._onerror_ = resolve;
+ document.head.append(styleElement);
+ });
+ sheet = styleElement.sheet;
+ } else {
+ sheet = new CSSStyleSheet();
+ sheet.replaceSync(testCase.style);
+ document.adoptedStyleSheets = [sheet];
+ }
- test(() => {
- testCase.operations(sheet);
- assert_equals(getComputedStyle(target).color, getComputedStyle(reference).color);
- },testCase.title);
-
- if (styleElement)
- styleElement.remove();
- document.adoptedStyleSheets = [];
+ try {
+ testCase.operations(sheet);
+ assert_equals(getComputedStyle(target).color, getComputedStyle(reference).color);
+ } finally {
+ if (styleElement)
+ styleElement.remove();
+ document.adoptedStyleSheets = [];
+ }
+ }, testCase.title);
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (286948 => 286949)
--- trunk/Source/WebCore/ChangeLog 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/Source/WebCore/ChangeLog 2021-12-13 16:50:00 UTC (rev 286949)
@@ -1,3 +1,15 @@
+2021-12-13 Antti Koivisto <an...@apple.com>
+
+ [CSS Cascade Layers] Unflake and fix web-platform-tests/css/css-cascade/layer-statement-before-import.html
+ https://bugs.webkit.org/show_bug.cgi?id=233944
+
+ Reviewed by Simon Fraser.
+
+ Inserting rules before early layer statements may be legal if they are moved to the regular rule list.
+
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::wrapperInsertRule):
+
2021-12-13 Adrian Perez de Castro <ape...@igalia.com>
Fix non-unified builds after r286853
Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (286948 => 286949)
--- trunk/Source/WebCore/css/StyleSheetContents.cpp 2021-12-13 16:20:39 UTC (rev 286948)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp 2021-12-13 16:50:00 UTC (rev 286949)
@@ -237,7 +237,20 @@
ASSERT_WITH_SECURITY_IMPLICATION(index <= ruleCount());
// Parser::parseRule doesn't currently allow @charset so we don't need to deal with it.
ASSERT(!rule->isCharsetRule());
-
+
+ // Maybe the insert will be legal if we treat early layer statement rules as normal child rules?
+ auto shouldMoveLayerRulesBeforeImportToNormalChildRules = [&] {
+ if (index >= m_layerRulesBeforeImportRules.size())
+ return false;
+ if (!m_importRules.isEmpty() || !m_namespaceRules.isEmpty())
+ return false;
+ bool isLayerStatement = is<StyleRuleLayer>(rule) && downcast<StyleRuleLayer>(rule.get()).isStatement();
+ return !rule->isImportRule() && !rule->isNamespaceRule() && !isLayerStatement;
+ };
+
+ if (shouldMoveLayerRulesBeforeImportToNormalChildRules())
+ m_childRules.insertVector(0, std::exchange(m_layerRulesBeforeImportRules, { }));
+
unsigned childVectorIndex = index;
if (childVectorIndex < m_layerRulesBeforeImportRules.size() || (childVectorIndex == m_layerRulesBeforeImportRules.size() && is<StyleRuleLayer>(rule))) {
if (!is<StyleRuleLayer>(rule))
@@ -268,7 +281,7 @@
childVectorIndex -= m_importRules.size();
if (childVectorIndex < m_namespaceRules.size() || (childVectorIndex == m_namespaceRules.size() && rule->isNamespaceRule())) {
- // Inserting non-namespace rules other than import rule before @namespace is
+ // Inserting non-namespace rules other than import and layer statement rules before @namespace is
// not allowed.
if (!is<StyleRuleNamespace>(rule))
return false;