1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

LibWeb: Reimplement the <style> element following the spec

We now follow the "update a style block" algorithm from the HTML spec
instead of using the ad-hoc CSSLoader mechanism.

This necessitated improving our StyleSheet and CSSStyleSheet classes as
well, so that's baked into this commit.
This commit is contained in:
Andreas Kling 2021-09-29 23:46:16 +02:00
parent 6cda24097b
commit d462a6720a
7 changed files with 163 additions and 24 deletions

View file

@ -27,6 +27,8 @@ public:
virtual ~CSSStyleSheet() override;
void set_owner_css_rule(CSSRule* rule) { m_owner_css_rule = rule; }
virtual String type() const override { return "text/css"; }
CSSRuleList const& rules() const { return m_rules; }
@ -76,6 +78,9 @@ private:
explicit CSSStyleSheet(NonnullRefPtrVector<CSSRule>);
NonnullRefPtr<CSSRuleList> m_rules;
// FIXME: Use WeakPtr.
CSSRule* m_owner_css_rule { nullptr };
};
}