mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibWeb: Add support for "User" CascadeOrigin
User styles are applied after the UserAgent's built-in styles, and before the Author styles that are part of the web page. Because they're neither part of the page, but can still be modified while the page is open, caching is a little tricky. The approach here is to piggy-back on the StyleComputer's rule caches, which already get rebuilt whenever the styles change. This is not the smartest approach, since it means re-parsing the style sheet more often than is necessary, but it's simple and works. :^)
This commit is contained in:
parent
7bc5949e35
commit
6dcd8d4a2c
4 changed files with 46 additions and 5 deletions
|
@ -168,6 +168,7 @@ private:
|
|||
|
||||
struct MatchingRuleSet {
|
||||
Vector<MatchingRule> user_agent_rules;
|
||||
Vector<MatchingRule> user_rules;
|
||||
Vector<MatchingRule> author_rules;
|
||||
};
|
||||
|
||||
|
@ -202,7 +203,9 @@ private:
|
|||
void ensure_animation_timer() const;
|
||||
|
||||
OwnPtr<RuleCache> m_author_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_agent_rule_cache;
|
||||
JS::Handle<CSSStyleSheet> m_user_style_sheet;
|
||||
|
||||
mutable FontCache m_font_cache;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue