mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb/DOM: Avoid repeated calls to Node::navigable
Minor optimization to avoid looking up the navigable during a layout operation.
This commit is contained in:
parent
74d644a216
commit
02ba51f203
Notes:
github-actions[bot]
2024-07-21 19:54:40 +00:00
Author: https://github.com/zecke Commit: https://github.com/LadybirdBrowser/ladybird/commit/02ba51f203e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/699 Reviewed-by: https://github.com/kalenikaliaksandr
1 changed files with 4 additions and 7 deletions
|
@ -1071,13 +1071,13 @@ static void propagate_overflow_to_viewport(Element& root_element, Layout::Viewpo
|
|||
|
||||
void Document::update_layout()
|
||||
{
|
||||
if (!is_active())
|
||||
auto navigable = this->navigable();
|
||||
if (!navigable || navigable->active_document() != this)
|
||||
return;
|
||||
|
||||
// NOTE: If our parent document needs a relayout, we must do that *first*.
|
||||
// This is necessary as the parent layout may cause our viewport to change.
|
||||
auto navigable = this->navigable();
|
||||
if (navigable && navigable->container())
|
||||
if (navigable->container())
|
||||
navigable->container()->document().update_layout();
|
||||
|
||||
update_style();
|
||||
|
@ -1089,11 +1089,8 @@ void Document::update_layout()
|
|||
if (m_created_for_appropriate_template_contents)
|
||||
return;
|
||||
|
||||
if (!navigable)
|
||||
return;
|
||||
|
||||
auto* document_element = this->document_element();
|
||||
auto viewport_rect = this->viewport_rect();
|
||||
auto viewport_rect = navigable->viewport_rect();
|
||||
|
||||
if (!m_layout_root) {
|
||||
Layout::TreeBuilder tree_builder;
|
||||
|
|
Loading…
Reference in a new issue