1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Make StyleSheet and CSSStyleSheet GC-allocated

This commit is contained in:
Andreas Kling 2022-08-07 13:14:54 +02:00
parent 0fe923e355
commit 5d60212076
21 changed files with 166 additions and 96 deletions

View file

@ -34,7 +34,7 @@ namespace Web::CSS::Parser {
class ParsingContext {
public:
ParsingContext() = default;
ParsingContext();
explicit ParsingContext(DOM::Document const&);
explicit ParsingContext(DOM::Document const&, AK::URL);
explicit ParsingContext(DOM::ParentNode&);
@ -46,7 +46,10 @@ public:
PropertyID current_property_id() const { return m_current_property_id; }
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
Bindings::WindowObject& window_object() const { return m_window_object; }
private:
Bindings::WindowObject& m_window_object;
DOM::Document const* m_document { nullptr };
PropertyID m_current_property_id { PropertyID::Invalid };
AK::URL m_url;
@ -122,7 +125,7 @@ public:
Parser(ParsingContext const&, StringView input, String const& encoding = "utf-8");
~Parser() = default;
NonnullRefPtr<CSSStyleSheet> parse_as_css_stylesheet(Optional<AK::URL> location);
CSSStyleSheet* parse_as_css_stylesheet(Optional<AK::URL> location);
RefPtr<ElementInlineCSSStyleDeclaration> parse_as_style_attribute(DOM::Element&);
RefPtr<CSSRule> parse_as_css_rule();
Optional<StyleProperty> parse_as_supports_condition();
@ -416,7 +419,7 @@ private:
namespace Web {
RefPtr<CSS::CSSStyleSheet> parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<AK::URL> location = {});
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<AK::URL> location = {});
RefPtr<CSS::ElementInlineCSSStyleDeclaration> parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&);
RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingContext const&, StringView);