mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibWeb: Implement and use "parse a CSS stylesheet" algorithm
`parse_a_stylesheet()` should not do any conversion on its rules. This change corrects that. There are other places where we get this wrong, but one thing at a time. :^)
This commit is contained in:
parent
fc3d51c59e
commit
85d8c652e9
2 changed files with 27 additions and 15 deletions
|
@ -89,8 +89,6 @@ public:
|
|||
Parser(ParsingContext const&, StringView input, String const& encoding = "utf-8");
|
||||
~Parser() = default;
|
||||
|
||||
// The normal parser entry point, for parsing stylesheets.
|
||||
NonnullRefPtr<CSSStyleSheet> parse_as_stylesheet(Optional<AK::URL> location);
|
||||
// For the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of <CDO-token> and <CDC-token>.
|
||||
NonnullRefPtrVector<CSSRule> parse_as_list_of_rules();
|
||||
// For use by the CSSStyleSheet#insertRule method, and similar functions which might exist, which parse text into a single rule.
|
||||
|
@ -105,6 +103,7 @@ public:
|
|||
Vector<StyleComponentValueRule> parse_as_list_of_component_values();
|
||||
Vector<Vector<StyleComponentValueRule>> parse_as_comma_separated_list_of_component_values();
|
||||
|
||||
NonnullRefPtr<CSSStyleSheet> parse_as_css_stylesheet(Optional<AK::URL> location);
|
||||
RefPtr<ElementInlineCSSStyleDeclaration> parse_as_style_attribute(DOM::Element&);
|
||||
|
||||
enum class SelectorParsingMode {
|
||||
|
@ -134,8 +133,14 @@ private:
|
|||
SyntaxError,
|
||||
};
|
||||
|
||||
// "Parse a stylesheet" is intended to be the normal parser entry point, for parsing stylesheets.
|
||||
struct ParsedStyleSheet {
|
||||
Optional<AK::URL> location;
|
||||
NonnullRefPtrVector<StyleRule> rules;
|
||||
};
|
||||
template<typename T>
|
||||
NonnullRefPtr<CSSStyleSheet> parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
|
||||
ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
|
||||
|
||||
template<typename T>
|
||||
NonnullRefPtrVector<CSSRule> parse_a_list_of_rules(TokenStream<T>&);
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue