mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb/CSS: Make ParsingContext's Realm optional
We only need a Realm to allocate CSSOM objects on the GC heap. Style values are not such objects, and over time, we'll be changing the parser to only produce non-CSSOM objects.
This commit is contained in:
parent
861f6e3965
commit
863ce746dc
Notes:
github-actions[bot]
2024-12-05 19:01:02 +00:00
Author: https://github.com/AtkinsSJ
Commit: 863ce746dc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2783
2 changed files with 12 additions and 2 deletions
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
namespace Web::CSS::Parser {
|
namespace Web::CSS::Parser {
|
||||||
|
|
||||||
|
ParsingContext::ParsingContext(Mode mode)
|
||||||
|
: m_mode(mode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
ParsingContext::ParsingContext(JS::Realm& realm, Mode mode)
|
ParsingContext::ParsingContext(JS::Realm& realm, Mode mode)
|
||||||
: m_realm(realm)
|
: m_realm(realm)
|
||||||
, m_mode(mode)
|
, m_mode(mode)
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
SVGPresentationAttribute, // See https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value
|
SVGPresentationAttribute, // See https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
explicit ParsingContext(Mode = Mode::Normal);
|
||||||
explicit ParsingContext(JS::Realm&, Mode = Mode::Normal);
|
explicit ParsingContext(JS::Realm&, Mode = Mode::Normal);
|
||||||
explicit ParsingContext(JS::Realm&, URL::URL, Mode = Mode::Normal);
|
explicit ParsingContext(JS::Realm&, URL::URL, Mode = Mode::Normal);
|
||||||
explicit ParsingContext(DOM::Document const&, Mode = Mode::Normal);
|
explicit ParsingContext(DOM::Document const&, Mode = Mode::Normal);
|
||||||
|
@ -36,10 +37,14 @@ public:
|
||||||
PropertyID current_property_id() const { return m_current_property_id; }
|
PropertyID current_property_id() const { return m_current_property_id; }
|
||||||
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
||||||
|
|
||||||
JS::Realm& realm() const { return m_realm; }
|
JS::Realm& realm() const
|
||||||
|
{
|
||||||
|
VERIFY(m_realm);
|
||||||
|
return *m_realm;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GC::Ref<JS::Realm> m_realm;
|
GC::Ptr<JS::Realm> m_realm;
|
||||||
GC::Ptr<DOM::Document const> m_document;
|
GC::Ptr<DOM::Document const> m_document;
|
||||||
PropertyID m_current_property_id { PropertyID::Invalid };
|
PropertyID m_current_property_id { PropertyID::Invalid };
|
||||||
URL::URL m_url;
|
URL::URL m_url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue