Title: [288879] trunk
- Revision
- 288879
- Author
- obru...@igalia.com
- Date
- 2022-02-01 08:41:43 -0800 (Tue, 01 Feb 2022)
Log Message
[css-cascade] Fix removal of not yet loaded CSS @import
https://bugs.webkit.org/show_bug.cgi?id=235930
Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:
Add new test.
* web-platform-tests/css/css-cascade/import-removal-expected.html: Added.
* web-platform-tests/css/css-cascade/import-removal.html: Added.
Source/WebCore:
When removing a not yet loaded CSS @import, the hasPendingSheet() flag
was not cleared. This resulted in a completely blank page.
This patch makes sure to cancel the load before deleting the rule.
Test: imported/w3c/web-platform-tests/css/css-cascade/import-removal.html
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::cancelLoad):
* css/StyleRuleImport.h:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::wrapperDeleteRule):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288878 => 288879)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-01 16:35:37 UTC (rev 288878)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-01 16:41:43 UTC (rev 288879)
@@ -1,3 +1,15 @@
+2022-02-01 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Fix removal of not yet loaded CSS @import
+ https://bugs.webkit.org/show_bug.cgi?id=235930
+
+ Reviewed by Antti Koivisto.
+
+ Add new test.
+
+ * web-platform-tests/css/css-cascade/import-removal-expected.html: Added.
+ * web-platform-tests/css/css-cascade/import-removal.html: Added.
+
2022-02-01 Tim Nguyen <n...@apple.com>
Entirely remove support for -apple-trailing-word
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html (0 => 288879)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html 2022-02-01 16:41:43 UTC (rev 288879)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href=""
+<p>Test passes if there is a filled green square.</p>
+<div style="width:100px; height:100px; background:green;"></div>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html (0 => 288879)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html 2022-02-01 16:41:43 UTC (rev 288879)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title></title>
+<link rel="author" title="Oriol Brufau" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="assert" content="Checks that the page is rendered correctly when @import rule is removed with JS.">
+<p>Test passes if there is a filled green square.</p>
+<div style="width:100px; height:100px;"></div>
+<script>
+const style = document.createElement("style");
+document.head.append(style);
+const {sheet} = style;
+sheet.insertRule("@import url('data:text/css,div { background: red !important }');");
+sheet.insertRule("div { background: green }", 1);
+sheet.deleteRule(0);
+</script>
Modified: trunk/Source/WebCore/ChangeLog (288878 => 288879)
--- trunk/Source/WebCore/ChangeLog 2022-02-01 16:35:37 UTC (rev 288878)
+++ trunk/Source/WebCore/ChangeLog 2022-02-01 16:41:43 UTC (rev 288879)
@@ -1,3 +1,22 @@
+2022-02-01 Oriol Brufau <obru...@igalia.com>
+
+ [css-cascade] Fix removal of not yet loaded CSS @import
+ https://bugs.webkit.org/show_bug.cgi?id=235930
+
+ Reviewed by Antti Koivisto.
+
+ When removing a not yet loaded CSS @import, the hasPendingSheet() flag
+ was not cleared. This resulted in a completely blank page.
+ This patch makes sure to cancel the load before deleting the rule.
+
+ Test: imported/w3c/web-platform-tests/css/css-cascade/import-removal.html
+
+ * css/StyleRuleImport.cpp:
+ (WebCore::StyleRuleImport::cancelLoad):
+ * css/StyleRuleImport.h:
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::wrapperDeleteRule):
+
2022-02-01 Antti Koivisto <an...@apple.com>
AX: nullptr crash under AccessibilityRenderObject::computeAccessibilityIsIgnored
Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (288878 => 288879)
--- trunk/Source/WebCore/css/StyleRuleImport.cpp 2022-02-01 16:35:37 UTC (rev 288878)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp 2022-02-01 16:41:43 UTC (rev 288879)
@@ -52,6 +52,16 @@
m_mediaQueries = MediaQuerySet::create(String(), MediaQueryParserContext());
}
+void StyleRuleImport::cancelLoad()
+{
+ if (!isLoading())
+ return;
+
+ m_loading = false;
+ if (m_parentStyleSheet)
+ m_parentStyleSheet->checkLoaded();
+}
+
StyleRuleImport::~StyleRuleImport()
{
if (m_styleSheet)
Modified: trunk/Source/WebCore/css/StyleRuleImport.h (288878 => 288879)
--- trunk/Source/WebCore/css/StyleRuleImport.h 2022-02-01 16:35:37 UTC (rev 288878)
+++ trunk/Source/WebCore/css/StyleRuleImport.h 2022-02-01 16:41:43 UTC (rev 288879)
@@ -42,6 +42,7 @@
StyleSheetContents* parentStyleSheet() const { return m_parentStyleSheet; }
void setParentStyleSheet(StyleSheetContents* sheet) { ASSERT(sheet); m_parentStyleSheet = sheet; }
void clearParentStyleSheet() { m_parentStyleSheet = 0; }
+ void cancelLoad();
String href() const { return m_strHref; }
StyleSheetContents* styleSheet() const { return m_styleSheet.get(); }
Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (288878 => 288879)
--- trunk/Source/WebCore/css/StyleSheetContents.cpp 2022-02-01 16:35:37 UTC (rev 288878)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp 2022-02-01 16:41:43 UTC (rev 288879)
@@ -325,6 +325,7 @@
childVectorIndex -= m_layerRulesBeforeImportRules.size();
if (childVectorIndex < m_importRules.size()) {
+ m_importRules[childVectorIndex]->cancelLoad();
m_importRules[childVectorIndex]->clearParentStyleSheet();
m_importRules.remove(childVectorIndex);
return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes