mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Coalesce layouts that happen in response to style changes
Instead of doing a forced layout synchronously whenever an element's style is changed, use a zero-timer to do the forced relayout on next event loop iteration. This effectively coalesces a lot of layouts and makes many pages such as GitHub spend way less time doing redundant layout work.
This commit is contained in:
@@ -132,6 +132,7 @@ public:
|
||||
Layout::InitialContainingBlockBox* layout_node();
|
||||
|
||||
void schedule_style_update();
|
||||
void schedule_forced_layout();
|
||||
|
||||
NonnullRefPtrVector<Element> get_elements_by_name(const String&) const;
|
||||
NonnullRefPtrVector<Element> get_elements_by_tag_name(const FlyString&) const;
|
||||
@@ -262,6 +263,7 @@ private:
|
||||
Optional<Color> m_visited_link_color;
|
||||
|
||||
RefPtr<Core::Timer> m_style_update_timer;
|
||||
RefPtr<Core::Timer> m_forced_layout_timer;
|
||||
|
||||
String m_source;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user