<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[281928] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/281928">281928</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2021-09-02 09:33:06 -0700 (Thu, 02 Sep 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Cascade Layers] Support layer argument in @import rules
https://bugs.webkit.org/show_bug.cgi?id=229795

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-cascade/layer-import-expected.txt:

Source/WebCore:

Add support for

@import "style.css" layer;
@import "style.css" layer(foo);

* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::create):
(WebCore::StyleRuleImport::StyleRuleImport):

Add layer name member.

* css/StyleRuleImport.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::consumeCascadeLayerName):

Factor into a standalone function.

(WebCore::CSSParserImpl::consumeImportRule):

Parse layer and layer() arguments for @import.

(WebCore::CSSParserImpl::consumeLayerRule):
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::Builder::addRulesFromSheet):

Register the layers specified in import rules.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscsscascadelayerimportexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-import-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImportcpp">trunk/Source/WebCore/css/StyleRuleImport.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImporth">trunk/Source/WebCore/css/StyleRuleImport.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserImplcpp">trunk/Source/WebCore/css/parser/CSSParserImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleRuleSetcpp">trunk/Source/WebCore/style/RuleSet.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2021-09-02  Antti Koivisto  <antti@apple.com>
+
+        [CSS Cascade Layers] Support layer argument in @import rules
+        https://bugs.webkit.org/show_bug.cgi?id=229795
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-cascade/layer-import-expected.txt:
+
</ins><span class="cx"> 2021-09-02  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Migrate LibWebRTCMediaEndpoint from OnRenegotiationNeeded to OnRenegotiationNeededEvent
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscsscascadelayerimportexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-import-expected.txt (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-import-expected.txt      2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-import-expected.txt 2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -3,23 +3,23 @@
</span><span class="cx"> PASS A2 Layer rules with import
</span><span class="cx"> PASS A3 Layer rules with import
</span><span class="cx"> PASS A4 Layer rules with import
</span><del>-FAIL B1 Anonymous imports assert_equals: B1 Anonymous imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL B2 Anonymous imports assert_equals: B2 Anonymous imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</del><ins>+PASS B1 Anonymous imports
+PASS B2 Anonymous imports
</ins><span class="cx"> PASS B3 Anonymous imports
</span><del>-FAIL B4 Anonymous imports assert_equals: B4 Anonymous imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL C1 Named imports assert_equals: C1 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL C2 Named imports assert_equals: C2 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</del><ins>+PASS B4 Anonymous imports
+PASS C1 Named imports
+PASS C2 Named imports
</ins><span class="cx"> PASS C3 Named imports
</span><del>-FAIL C4 Named imports assert_equals: C4 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</del><ins>+PASS C4 Named imports
</ins><span class="cx"> PASS C5 Named imports
</span><span class="cx"> PASS C6 Named imports
</span><del>-FAIL C7 Named imports assert_equals: C7 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL C8 Named imports assert_equals: C8 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL C9 Named imports assert_equals: C9 Named imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL D1 Layer statement with imports assert_equals: D1 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</del><ins>+PASS C7 Named imports
+PASS C8 Named imports
+PASS C9 Named imports
+PASS D1 Layer statement with imports
</ins><span class="cx"> FAIL D2 Layer statement with imports assert_equals: D2 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</span><span class="cx"> FAIL D3 Layer statement with imports assert_equals: D3 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</span><span class="cx"> FAIL D4 Layer statement with imports assert_equals: D4 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</span><span class="cx"> FAIL D5 Layer statement with imports assert_equals: D5 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</span><del>-FAIL D6 Layer statement with imports assert_equals: D6 Layer statement with imports, target 'first' expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
</del><ins>+PASS D6 Layer statement with imports
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/Source/WebCore/ChangeLog      2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2021-09-02  Antti Koivisto  <antti@apple.com>
+
+        [CSS Cascade Layers] Support layer argument in @import rules
+        https://bugs.webkit.org/show_bug.cgi?id=229795
+
+        Reviewed by Simon Fraser.
+
+        Add support for
+
+        @import "style.css" layer;
+        @import "style.css" layer(foo);
+
+        * css/StyleRuleImport.cpp:
+        (WebCore::StyleRuleImport::create):
+        (WebCore::StyleRuleImport::StyleRuleImport):
+
+        Add layer name member.
+
+        * css/StyleRuleImport.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::consumeCascadeLayerName):
+
+        Factor into a standalone function.
+
+        (WebCore::CSSParserImpl::consumeImportRule):
+
+        Parse layer and layer() arguments for @import.
+
+        (WebCore::CSSParserImpl::consumeLayerRule):
+        * style/RuleSet.cpp:
+        (WebCore::Style::RuleSet::Builder::addRulesFromSheet):
+
+        Register the layers specified in import rules.
+
</ins><span class="cx"> 2021-09-02  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Migrate LibWebRTCMediaEndpoint from OnRenegotiationNeeded to OnRenegotiationNeededEvent
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImportcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.cpp     2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp        2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -36,16 +36,17 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref<StyleRuleImport> StyleRuleImport::create(const String& href, Ref<MediaQuerySet>&& media)
</del><ins>+Ref<StyleRuleImport> StyleRuleImport::create(const String& href, Ref<MediaQuerySet>&& media, std::optional<CascadeLayerName>&& cascadeLayerName)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new StyleRuleImport(href, WTFMove(media)));
</del><ins>+    return adoptRef(*new StyleRuleImport(href, WTFMove(media), WTFMove(cascadeLayerName)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-StyleRuleImport::StyleRuleImport(const String& href, Ref<MediaQuerySet>&& media)
</del><ins>+StyleRuleImport::StyleRuleImport(const String& href, Ref<MediaQuerySet>&& media, std::optional<CascadeLayerName>&& cascadeLayerName)
</ins><span class="cx">     : StyleRuleBase(StyleRuleType::Import)
</span><span class="cx">     , m_styleSheetClient(this)
</span><span class="cx">     , m_strHref(href)
</span><span class="cx">     , m_mediaQueries(WTFMove(media))
</span><ins>+    , m_cascadeLayerName(WTFMove(cascadeLayerName))
</ins><span class="cx"> {
</span><span class="cx">     if (!m_mediaQueries)
</span><span class="cx">         m_mediaQueries = MediaQuerySet::create(String(), MediaQueryParserContext());
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImporth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.h (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.h       2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/Source/WebCore/css/StyleRuleImport.h  2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> class StyleRuleImport final : public StyleRuleBase {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static Ref<StyleRuleImport> create(const String& href, Ref<MediaQuerySet>&&);
</del><ins>+    static Ref<StyleRuleImport> create(const String& href, Ref<MediaQuerySet>&&, std::optional<CascadeLayerName>&&);
</ins><span class="cx"> 
</span><span class="cx">     ~StyleRuleImport();
</span><span class="cx">     
</span><span class="lines">@@ -52,10 +52,12 @@
</span><span class="cx">     void requestStyleSheet();
</span><span class="cx">     const CachedCSSStyleSheet* cachedCSSStyleSheet() const { return m_cachedSheet.get(); }
</span><span class="cx"> 
</span><ins>+    const std::optional<CascadeLayerName>& cascadeLayerName() const { return m_cascadeLayerName; }
+
</ins><span class="cx"> private:
</span><span class="cx">     // NOTE: We put the CachedStyleSheetClient in a member instead of inheriting from it
</span><span class="cx">     // to avoid adding a vptr to StyleRuleImport.
</span><del>-class ImportedStyleSheetClient final : public CachedStyleSheetClient {
</del><ins>+    class ImportedStyleSheetClient final : public CachedStyleSheetClient {
</ins><span class="cx">     public:
</span><span class="cx">         ImportedStyleSheetClient(StyleRuleImport* ownerRule) : m_ownerRule(ownerRule) { }
</span><span class="cx">         virtual ~ImportedStyleSheetClient() = default;
</span><span class="lines">@@ -70,7 +72,7 @@
</span><span class="cx">     void setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet*);
</span><span class="cx">     friend class ImportedStyleSheetClient;
</span><span class="cx"> 
</span><del>-    StyleRuleImport(const String& href, Ref<MediaQuerySet>&&);
</del><ins>+    StyleRuleImport(const String& href, Ref<MediaQuerySet>&&, std::optional<CascadeLayerName>&&);
</ins><span class="cx"> 
</span><span class="cx">     StyleSheetContents* m_parentStyleSheet { nullptr };
</span><span class="cx"> 
</span><span class="lines">@@ -78,6 +80,7 @@
</span><span class="cx">     String m_strHref;
</span><span class="cx">     RefPtr<MediaQuerySet> m_mediaQueries;
</span><span class="cx">     RefPtr<StyleSheetContents> m_styleSheet;
</span><ins>+    std::optional<CascadeLayerName> m_cascadeLayerName;
</ins><span class="cx">     CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
</span><span class="cx">     bool m_loading { false };
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp   2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -507,6 +507,32 @@
</span><span class="cx">     return StyleRuleCharset::create();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+enum class AllowAnonymous { Yes, No };
+static std::optional<CascadeLayerName> consumeCascadeLayerName(CSSParserTokenRange& range, AllowAnonymous allowAnonymous)
+{
+    CascadeLayerName name;
+    if (range.atEnd()) {
+        if (allowAnonymous == AllowAnonymous::Yes)
+            return name;
+        return { };
+    }
+
+    while (true) {
+        auto nameToken = range.consume();
+        if (nameToken.type() != IdentToken)
+            return { };
+
+        name.append(nameToken.value().toAtomString());
+
+        if (range.peek().type() != DelimiterToken || range.peek().delimiter() != '.')
+            break;
+        range.consume();
+    }
+
+    range.consumeWhitespace();
+    return name;
+}
+
</ins><span class="cx"> RefPtr<StyleRuleImport> CSSParserImpl::consumeImportRule(CSSParserTokenRange prelude)
</span><span class="cx"> {
</span><span class="cx">     AtomString uri(consumeStringOrURI(prelude));
</span><span class="lines">@@ -520,8 +546,29 @@
</span><span class="cx">         m_observerWrapper->observer().startRuleBody(endOffset);
</span><span class="cx">         m_observerWrapper->observer().endRuleBody(endOffset);
</span><span class="cx">     }
</span><ins>+
+    prelude.consumeWhitespace();
+
+    auto consumeCascadeLayer = [&]() -> std::optional<CascadeLayerName> {
+        if (!m_context.cascadeLayersEnabled)
+            return { };
+        
+        auto& token = prelude.peek();
+        if (token.type() == FunctionToken && equalIgnoringASCIICase(token.value(), "layer")) {
+            auto contents = CSSPropertyParserHelpers::consumeFunction(prelude);
+            return consumeCascadeLayerName(contents, AllowAnonymous::No);
+        }
+        if (token.type() == IdentToken && equalIgnoringASCIICase(token.value(), "layer")) {
+            prelude.consumeIncludingWhitespace();
+            return CascadeLayerName { };
+        }
+        return { };
+    };
+
+    auto cascadeLayerName = consumeCascadeLayer();
+    auto mediaQuerySet = MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context));
</ins><span class="cx">     
</span><del>-    return StyleRuleImport::create(uri, MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context)).releaseNonNull());
</del><ins>+    return StyleRuleImport::create(uri, mediaQuerySet.releaseNonNull(), WTFMove(cascadeLayerName));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr<StyleRuleNamespace> CSSParserImpl::consumeNamespaceRule(CSSParserTokenRange prelude)
</span><span class="lines">@@ -687,33 +734,11 @@
</span><span class="cx"> 
</span><span class="cx">     auto preludeCopy = prelude;
</span><span class="cx"> 
</span><del>-    auto consumeName = [&]() -> std::optional<CascadeLayerName> {
-        CascadeLayerName name;
-        // Anonymous case.
-        if (prelude.atEnd())
-            return name;
-
-        while (true) {
-            auto nameToken = prelude.consume();
-            if (nameToken.type() != IdentToken)
-                return { };
-
-            name.append(nameToken.value().toAtomString());
-
-            if (prelude.peek().type() != DelimiterToken || prelude.peek().delimiter() != '.')
-                break;
-            prelude.consume();
-        }
-
-        prelude.consumeWhitespace();
-        return name;
-    };
-
</del><span class="cx">     if (!block) {
</span><span class="cx">         // List syntax.
</span><span class="cx">         Vector<CascadeLayerName> nameList;
</span><span class="cx">         while (true) {
</span><del>-            auto name = consumeName();
</del><ins>+            auto name = consumeCascadeLayerName(prelude, AllowAnonymous::No);
</ins><span class="cx">             if (!name)
</span><span class="cx">                 return nullptr;
</span><span class="cx">             nameList.append(*name);
</span><span class="lines">@@ -737,7 +762,7 @@
</span><span class="cx">         return StyleRuleLayer::create(WTFMove(nameList));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto name = consumeName();
</del><ins>+    auto name = consumeCascadeLayerName(prelude, AllowAnonymous::Yes);
</ins><span class="cx">     if (!name)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorestyleRuleSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/RuleSet.cpp (281927 => 281928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/RuleSet.cpp   2021-09-02 16:22:16 UTC (rev 281927)
+++ trunk/Source/WebCore/style/RuleSet.cpp      2021-09-02 16:33:06 UTC (rev 281928)
</span><span class="lines">@@ -376,9 +376,17 @@
</span><span class="cx">     for (auto& rule : sheet.importRules()) {
</span><span class="cx">         if (!rule->styleSheet())
</span><span class="cx">             continue;
</span><ins>+        
+        if (mediaQueryCollector.pushAndEvaluate(rule->mediaQueries())) {
+            auto& cascadeLayerName = rule->cascadeLayerName();
+            if (cascadeLayerName)
+                pushCascadeLayer(*cascadeLayerName);
</ins><span class="cx"> 
</span><del>-        if (mediaQueryCollector.pushAndEvaluate(rule->mediaQueries()))
</del><span class="cx">             addRulesFromSheet(*rule->styleSheet());
</span><ins>+
+            if (cascadeLayerName)
+                popCascadeLayer(*cascadeLayerName);
+        }
</ins><span class="cx">         mediaQueryCollector.pop(rule->mediaQueries());
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>