mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Add callback for when a CSSRuleList's rules change
This commit is contained in:
parent
62f15f94d2
commit
496db17c2d
Notes:
sideshowbarker
2024-07-17 23:07:41 +09:00
Author: https://github.com/AtkinsSJ
Commit: 496db17c2d
Pull-request: https://github.com/SerenityOS/serenity/pull/20283
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/stelar7
2 changed files with 6 additions and 0 deletions
|
@ -93,6 +93,8 @@ WebIDL::ExceptionOr<unsigned> CSSRuleList::insert_a_css_rule(Variant<StringView,
|
|||
m_rules.insert(index, *new_rule);
|
||||
|
||||
// 8. Return index.
|
||||
if (on_change)
|
||||
on_change();
|
||||
return index;
|
||||
}
|
||||
|
||||
|
@ -118,6 +120,8 @@ WebIDL::ExceptionOr<void> CSSRuleList::remove_a_css_rule(u32 index)
|
|||
old_rule.set_parent_rule(nullptr);
|
||||
old_rule.set_parent_style_sheet(nullptr);
|
||||
|
||||
if (on_change)
|
||||
on_change();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
bool evaluate_media_queries(HTML::Window const&);
|
||||
void for_each_effective_keyframes_at_rule(Function<void(CSSKeyframesRule const&)> const& callback) const;
|
||||
|
||||
Function<void()> on_change;
|
||||
|
||||
private:
|
||||
explicit CSSRuleList(JS::Realm&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue