Parcourir la source

Revert "LibWeb: Run IntersectionObserver steps only when needed"

This reverts commit 11b4216e65ea1be4704c66e9baf32f3357163a31.
Andreas Kling il y a 1 an
Parent
commit
4e4b9f440f

+ 0 - 3
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -1114,9 +1114,6 @@ void Document::update_layout()
 
     m_needs_layout = false;
     m_layout_update_timer->stop();
-
-    // OPTIMIZATION: We do this here instead of in HTML::EventLoop::process() to avoid redundant work.
-    run_the_update_intersection_observations_steps(HighResolutionTime::unsafe_shared_current_time());
 }
 
 [[nodiscard]] static Element::RequiredInvalidationAfterStyleChange update_style_recursively(Node& node)

+ 3 - 1
Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp

@@ -249,7 +249,9 @@ void EventLoop::process()
     });
 
     // 14. For each fully active Document in docs, run the update intersection observations steps for that Document, passing in now as the timestamp. [INTERSECTIONOBSERVER]
-    // OPTIMIZATION: We do this automatically after layout or viewport changes, so we don't need to do it here.
+    for_each_fully_active_document_in_docs([&](DOM::Document& document) {
+        document.run_the_update_intersection_observations_steps(now);
+    });
 
     // FIXME:     15. Invoke the mark paint timing algorithm for each Document object in docs.
 

+ 0 - 4
Userland/Libraries/LibWeb/HTML/Navigable.cpp

@@ -29,7 +29,6 @@
 #include <LibWeb/HTML/TraversableNavigable.h>
 #include <LibWeb/HTML/Window.h>
 #include <LibWeb/HTML/WindowProxy.h>
-#include <LibWeb/HighResolutionTime/TimeOrigin.h>
 #include <LibWeb/Infra/Strings.h>
 #include <LibWeb/Layout/Node.h>
 #include <LibWeb/Loader/GeneratedPagesLoader.h>
@@ -1949,9 +1948,6 @@ void Navigable::scroll_offset_did_change()
 
     // 3. Append doc to doc’s pending scroll event targets.
     doc->pending_scroll_event_targets().append(*doc);
-
-    // OPTIMIZATION: We do this here instead of in HTML::EventLoop::process() to avoid redundant work.
-    doc->run_the_update_intersection_observations_steps(HighResolutionTime::unsafe_shared_current_time());
 }
 
 CSSPixelRect Navigable::to_top_level_rect(CSSPixelRect const& a_rect)