LibWeb: Invalidate styles after CSSImportRule loads

This replicates the behavior of StyleSheetList::add_sheet, making sure
the rules added by the imported style sheet are applied.
This commit is contained in:
Simon Wanner 2022-03-14 20:56:05 +01:00 committed by Andreas Kling
parent 1ed5e79478
commit 1f9d76c7b8
Notes: sideshowbarker 2024-07-17 17:26:34 +09:00
4 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1 @@
@import "css-import-4b.css";

View File

@ -0,0 +1 @@
p.fourth { background-color: lime; }

View File

@ -5,6 +5,7 @@
@import "css-import-1.css";
@import url("css-import-2.css");
@import url(css-import-3.css);
@import "css-import-relative/css-import-4a.css";
</style>
</head>
<body>
@ -12,6 +13,7 @@
<p class="first">If this is green, <code>@import "string";</code> works!</p>
<p class="second">If this is green, <code>@import url("string");</code> works!</p>
<p class="third">If this is green, <code>@import url(unquoted-string);</code> works!</p>
<p class="fourth">If this is green, relative <code>@import</code> resolves correctly!</p>
</div>
</body>
</html>

View File

@ -84,6 +84,9 @@ void CSSImportRule::resource_did_load()
}
m_style_sheet = move(sheet);
m_document->style_sheets().bump_generation();
m_document->invalidate_style();
}
}