mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibWeb: Fix insert/delete rule invalidation for adopted style sheets
Invalidation for adopted style sheets was broken because we had an assumption that "active" style sheet is always attached to StyleSheetList which is not true for adopted style sheets. This change addresses that by keeping track of all documents/shadow roots that own a style sheet and notifying them about invalidation instead of going through the StyleSheetList.
This commit is contained in:
parent
24e374d7e1
commit
98691810b1
Notes:
github-actions[bot]
2025-01-13 22:04:04 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 98691810b1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3217
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/tcl3
9 changed files with 103 additions and 43 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/CSS/CSSRuleList.h>
|
||||
#include <LibWeb/CSS/CSSStyleRule.h>
|
||||
#include <LibWeb/CSS/StyleSheet.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/WebIDL/Types.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
@ -62,8 +63,9 @@ public:
|
|||
bool evaluate_media_queries(HTML::Window const&);
|
||||
void for_each_effective_keyframes_at_rule(Function<void(CSSKeyframesRule const&)> const& callback) const;
|
||||
|
||||
GC::Ptr<StyleSheetList> style_sheet_list() const { return m_style_sheet_list; }
|
||||
void set_style_sheet_list(Badge<StyleSheetList>, StyleSheetList*);
|
||||
void add_owning_document_or_shadow_root(DOM::Node& document_or_shadow_root);
|
||||
void remove_owning_document_or_shadow_root(DOM::Node& document_or_shadow_root);
|
||||
void invalidate_owners(DOM::StyleInvalidationReason);
|
||||
|
||||
Optional<FlyString> default_namespace() const;
|
||||
GC::Ptr<CSSNamespaceRule> default_namespace_rule() const { return m_default_namespace_rule; }
|
||||
|
@ -109,11 +111,11 @@ private:
|
|||
HashMap<FlyString, GC::Ptr<CSSNamespaceRule>> m_namespace_rules;
|
||||
Vector<GC::Ref<CSSImportRule>> m_import_rules;
|
||||
|
||||
GC::Ptr<StyleSheetList> m_style_sheet_list;
|
||||
GC::Ptr<CSSRule> m_owner_css_rule;
|
||||
|
||||
Optional<URL::URL> m_base_url;
|
||||
GC::Ptr<DOM::Document const> m_constructor_document;
|
||||
HashTable<GC::Ptr<DOM::Node>> m_owning_documents_or_shadow_roots;
|
||||
bool m_constructed { false };
|
||||
bool m_disallow_modification { false };
|
||||
Optional<bool> m_did_match;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue