LibWeb: Store whether sheet being parsed is a UA stylesheet

UA stylesheets allow some things that regular stylesheets don't, for
instance allowing use of "non-overridable" `@counter-style` names.
This commit is contained in:
Callum Law
2026-02-07 21:40:54 +13:00
committed by Sam Atkins
parent 73b07d25ac
commit 3e9cdb2cf4
Notes: github-actions[bot] 2026-02-23 11:22:46 +00:00
3 changed files with 19 additions and 4 deletions

View File

@@ -92,14 +92,21 @@ enum class ParsingMode {
SVGPresentationAttribute, // See https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value
};
enum class IsUAStyleSheet {
Yes,
No,
};
struct ParsingParams {
explicit ParsingParams(ParsingMode = ParsingMode::Normal);
explicit ParsingParams(JS::Realm&, ParsingMode = ParsingMode::Normal);
explicit ParsingParams(JS::Realm&, IsUAStyleSheet);
explicit ParsingParams(DOM::Document const&, ParsingMode = ParsingMode::Normal);
GC::Ptr<JS::Realm> realm;
GC::Ptr<DOM::Document const> document;
ParsingMode mode { ParsingMode::Normal };
IsUAStyleSheet is_ua_style_sheet { IsUAStyleSheet::No };
Vector<ValueParsingContext> value_context;
Vector<RuleContext> rule_context;
@@ -599,6 +606,7 @@ private:
GC::Ptr<DOM::Document const> m_document;
GC::Ptr<JS::Realm> m_realm;
ParsingMode m_parsing_mode { ParsingMode::Normal };
IsUAStyleSheet m_is_ua_style_sheet { IsUAStyleSheet::No };
Vector<Token> m_tokens;
TokenStream<Token> m_token_stream;