mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Stop putting the FormattingState nodes in a slow hash map
Instead, put them in a Vector<OwnPtr<NodeState>>. Each layout node has a unique index into the vector. It's a simple serial ID assigned during layout tree construction. Every new layout restarts the sequence at 0 for the next ICB. This is a huge layout speed improvement on all content.
This commit is contained in:
parent
f6a97ff7d5
commit
0cacaf025d
Notes:
sideshowbarker
2024-07-17 10:05:47 +09:00
Author: https://github.com/awesomekling
Commit: 0cacaf025d
6 changed files with 45 additions and 45 deletions
|
@ -606,11 +606,13 @@ void Document::update_layout()
|
|||
auto viewport_rect = browsing_context()->viewport_rect();
|
||||
|
||||
if (!m_layout_root) {
|
||||
m_next_layout_node_serial_id = 0;
|
||||
Layout::TreeBuilder tree_builder;
|
||||
m_layout_root = static_ptr_cast<Layout::InitialContainingBlock>(tree_builder.build(*this));
|
||||
}
|
||||
|
||||
Layout::FormattingState formatting_state;
|
||||
formatting_state.nodes.resize(layout_node_count());
|
||||
Layout::BlockFormattingContext root_formatting_context(formatting_state, *m_layout_root, nullptr);
|
||||
|
||||
auto& icb = static_cast<Layout::InitialContainingBlock&>(*m_layout_root);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue