mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibHTML: Batch style updates and make them start from the root
Use a zero-timer to schedule a style update after invalidating style on any node. Nodes now have a needs_style_update flag which helps us batch and coalesce the work. We also start style updates at the root and work our way through the document, updating any node that has the needs_style_update flag set. This is slower than what we were doing before, but far more correct. There is a ton of room for improvement here. :^)
This commit is contained in:
parent
0d8aaaaa44
commit
96f34d26c9
5 changed files with 46 additions and 10 deletions
|
@ -70,6 +70,9 @@ public:
|
|||
|
||||
virtual bool is_child_allowed(const Node&) const { return true; }
|
||||
|
||||
bool needs_style_update() const { return m_needs_style_update; }
|
||||
void set_needs_style_update(bool value) { m_needs_style_update = value; }
|
||||
|
||||
void invalidate_style();
|
||||
|
||||
protected:
|
||||
|
@ -78,6 +81,7 @@ protected:
|
|||
Document& m_document;
|
||||
mutable LayoutNode* m_layout_node { nullptr };
|
||||
NodeType m_type { NodeType::INVALID };
|
||||
bool m_needs_style_update { false };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue