Changeset 288879 in webkit


Ignore:
Timestamp:
Feb 1, 2022 8:41:43 AM (6 months ago)
Author:
Oriol Brufau
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):

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r288869 r288879  
     12022-02-01  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-cascade] Fix removal of not yet loaded CSS @import
     4        https://bugs.webkit.org/show_bug.cgi?id=235930
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add new test.
     9
     10        * web-platform-tests/css/css-cascade/import-removal-expected.html: Added.
     11        * web-platform-tests/css/css-cascade/import-removal.html: Added.
     12
    1132022-02-01  Tim Nguyen  <ntim@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r288874 r288879  
     12022-02-01  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-cascade] Fix removal of not yet loaded CSS @import
     4        https://bugs.webkit.org/show_bug.cgi?id=235930
     5
     6        Reviewed by Antti Koivisto.
     7
     8        When removing a not yet loaded CSS @import, the hasPendingSheet() flag
     9        was not cleared. This resulted in a completely blank page.
     10        This patch makes sure to cancel the load before deleting the rule.
     11
     12        Test: imported/w3c/web-platform-tests/css/css-cascade/import-removal.html
     13
     14        * css/StyleRuleImport.cpp:
     15        (WebCore::StyleRuleImport::cancelLoad):
     16        * css/StyleRuleImport.h:
     17        * css/StyleSheetContents.cpp:
     18        (WebCore::StyleSheetContents::wrapperDeleteRule):
     19
    1202022-02-01  Antti Koivisto  <antti@apple.com>
    221
  • trunk/Source/WebCore/css/StyleRuleImport.cpp

    r288362 r288879  
    5151    if (!m_mediaQueries)
    5252        m_mediaQueries = MediaQuerySet::create(String(), MediaQueryParserContext());
     53}
     54
     55void StyleRuleImport::cancelLoad()
     56{
     57    if (!isLoading())
     58        return;
     59
     60    m_loading = false;
     61    if (m_parentStyleSheet)
     62        m_parentStyleSheet->checkLoaded();
    5363}
    5464
  • trunk/Source/WebCore/css/StyleRuleImport.h

    r281928 r288879  
    4343    void setParentStyleSheet(StyleSheetContents* sheet) { ASSERT(sheet); m_parentStyleSheet = sheet; }
    4444    void clearParentStyleSheet() { m_parentStyleSheet = 0; }
     45    void cancelLoad();
    4546
    4647    String href() const { return m_strHref; }
  • trunk/Source/WebCore/css/StyleSheetContents.cpp

    r286949 r288879  
    326326
    327327    if (childVectorIndex < m_importRules.size()) {
     328        m_importRules[childVectorIndex]->cancelLoad();
    328329        m_importRules[childVectorIndex]->clearParentStyleSheet();
    329330        m_importRules.remove(childVectorIndex);
Note: See TracChangeset for help on using the changeset viewer.