mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb/DOM: Move "stop intersection observing..." code into a method
We'll need to call it from elsewhere. Also add a missing step 5 from where we previously called it.
This commit is contained in:
parent
c6a18f795d
commit
97616fa108
Notes:
github-actions[bot]
2025-01-11 10:11:52 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/97616fa108c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3171
2 changed files with 17 additions and 8 deletions
|
@ -4542,15 +4542,10 @@ void Document::start_intersection_observing_a_lazy_loading_element(Element& elem
|
|||
}
|
||||
|
||||
// 4. Stop intersection-observing a lazy loading element for entry.target.
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#stop-intersection-observing-a-lazy-loading-element
|
||||
// 1. Let doc be element's node document.
|
||||
// NOTE: It's `this`.
|
||||
stop_intersection_observing_a_lazy_loading_element(entry.target());
|
||||
|
||||
// 2. Assert: doc's lazy load intersection observer is not null.
|
||||
VERIFY(m_lazy_load_intersection_observer);
|
||||
|
||||
// 3. Call doc's lazy load intersection observer unobserve method with element as the argument.
|
||||
m_lazy_load_intersection_observer->unobserve(entry.target());
|
||||
// 5. Set entry.target's lazy load resumption steps to null.
|
||||
entry.target()->take_lazy_load_resumption_steps({});
|
||||
|
||||
// 6. Invoke resumptionSteps.
|
||||
resumption_steps->function()();
|
||||
|
@ -4572,6 +4567,19 @@ void Document::start_intersection_observing_a_lazy_loading_element(Element& elem
|
|||
m_lazy_load_intersection_observer->observe(element);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#stop-intersection-observing-a-lazy-loading-element
|
||||
void Document::stop_intersection_observing_a_lazy_loading_element(Element& element)
|
||||
{
|
||||
// 1. Let doc be element's node document.
|
||||
// NOTE: It's `this`.
|
||||
|
||||
// 2. Assert: doc's lazy load intersection observer is not null.
|
||||
VERIFY(m_lazy_load_intersection_observer);
|
||||
|
||||
// 3. Call doc's lazy load intersection observer unobserve method with element as the argument.
|
||||
m_lazy_load_intersection_observer->unobserve(element);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#shared-declarative-refresh-steps
|
||||
void Document::shared_declarative_refresh_steps(StringView input, GC::Ptr<HTML::HTMLMetaElement const> meta_element)
|
||||
{
|
||||
|
|
|
@ -613,6 +613,7 @@ public:
|
|||
void run_the_update_intersection_observations_steps(HighResolutionTime::DOMHighResTimeStamp time);
|
||||
|
||||
void start_intersection_observing_a_lazy_loading_element(Element&);
|
||||
void stop_intersection_observing_a_lazy_loading_element(Element&);
|
||||
|
||||
void shared_declarative_refresh_steps(StringView input, GC::Ptr<HTML::HTMLMetaElement const> meta_element = nullptr);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue