Title: [289331] branches/safari-613-branch
Revision
289331
Author
[email protected]
Date
2022-02-07 18:56:57 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288879. rdar://problem/88322836

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288879 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog (289330 => 289331)


--- branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-02-08 02:56:53 UTC (rev 289330)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-02-08 02:56:57 UTC (rev 289331)
@@ -1,5 +1,50 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288879. rdar://problem/88322836
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-01  Oriol Brufau  <[email protected]>
+
+            [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-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288783. rdar://problem/88052073
 
     REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath

Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html (0 => 289331)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal-expected.html	2022-02-08 02:56:57 UTC (rev 289331)
@@ -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: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html (0 => 289331)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/import-removal.html	2022-02-08 02:56:57 UTC (rev 289331)
@@ -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: branches/safari-613-branch/Source/WebCore/ChangeLog (289330 => 289331)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:56:53 UTC (rev 289330)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:56:57 UTC (rev 289331)
@@ -1,5 +1,57 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288879. rdar://problem/88322836
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-01  Oriol Brufau  <[email protected]>
+
+            [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-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288874. rdar://problem/88217815
 
     AX: nullptr crash under AccessibilityRenderObject::computeAccessibilityIsIgnored

Modified: branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.cpp (289330 => 289331)


--- branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.cpp	2022-02-08 02:56:53 UTC (rev 289330)
+++ branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.cpp	2022-02-08 02:56:57 UTC (rev 289331)
@@ -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: branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.h (289330 => 289331)


--- branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.h	2022-02-08 02:56:53 UTC (rev 289330)
+++ branches/safari-613-branch/Source/WebCore/css/StyleRuleImport.h	2022-02-08 02:56:57 UTC (rev 289331)
@@ -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: branches/safari-613-branch/Source/WebCore/css/StyleSheetContents.cpp (289330 => 289331)


--- branches/safari-613-branch/Source/WebCore/css/StyleSheetContents.cpp	2022-02-08 02:56:53 UTC (rev 289330)
+++ branches/safari-613-branch/Source/WebCore/css/StyleSheetContents.cpp	2022-02-08 02:56:57 UTC (rev 289331)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to