mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Remove a bunch of redundant Document::navigable() lookups
Document::navigable() can be unpleasantly slow, since we don't have a direct link between documents and navigables at the moment. So let's not call it twice when once is enough.
This commit is contained in:
parent
77d98b5697
commit
43c720db81
Notes:
sideshowbarker
2024-07-17 02:06:40 +09:00
Author: https://github.com/awesomekling
Commit: 43c720db81
Pull-request: https://github.com/SerenityOS/serenity/pull/23602
4 changed files with 21 additions and 14 deletions
|
@ -158,7 +158,8 @@ void EventLoop::process()
|
|||
|
||||
// 2. Rendering opportunities: Remove from docs all Document objects whose node navigables do not have a rendering opportunity.
|
||||
docs.remove_all_matching([&](auto& document) {
|
||||
return document->navigable() && !document->navigable()->has_a_rendering_opportunity();
|
||||
auto navigable = document->navigable();
|
||||
return navigable && !navigable->has_a_rendering_opportunity();
|
||||
});
|
||||
|
||||
// 3. If docs is not empty, then set hasARenderingOpportunity to true
|
||||
|
@ -254,7 +255,8 @@ void EventLoop::process()
|
|||
|
||||
// 16. For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state.
|
||||
for_each_fully_active_document_in_docs([&](DOM::Document& document) {
|
||||
if (document.navigable() && document.navigable()->needs_repaint()) {
|
||||
auto navigable = document.navigable();
|
||||
if (navigable && navigable->needs_repaint()) {
|
||||
auto* browsing_context = document.browsing_context();
|
||||
auto& page = browsing_context->page();
|
||||
page.client().schedule_repaint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue