mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb/CSS: Use CSSRule's context to parse new child rules
Keep track of which CSSRule owns a CSSRuleList, and then use that to produce a stack of RuleContexts for the CSS Parser to use. There are certainly other places we should do this!
This commit is contained in:
parent
763b1b0ee2
commit
658569b533
Notes:
github-actions[bot]
2025-04-23 10:39:55 +00:00
Author: https://github.com/AtkinsSJ
Commit: 658569b533
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4354
7 changed files with 32 additions and 15 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <AK/Function.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/CSS/CSSRule.h>
|
||||
#include <LibWeb/CSS/Parser/RuleContext.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/TraversalOrder.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
@ -62,6 +63,7 @@ public:
|
|||
// Returns whether the match state of any media queries changed after evaluation.
|
||||
bool evaluate_media_queries(HTML::Window const&);
|
||||
|
||||
void set_owner_rule(GC::Ref<CSSRule> owner_rule) { m_owner_rule = owner_rule; }
|
||||
void set_rules(Badge<CSSStyleSheet>, Vector<GC::Ref<CSSRule>> rules) { m_rules = move(rules); }
|
||||
|
||||
Function<void()> on_change;
|
||||
|
@ -72,7 +74,10 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Vector<Parser::RuleContext> rule_context() const;
|
||||
|
||||
Vector<GC::Ref<CSSRule>> m_rules;
|
||||
GC::Ptr<CSSRule> m_owner_rule;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue