mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09: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: 97616fa108
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.
|
// 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
|
stop_intersection_observing_a_lazy_loading_element(entry.target());
|
||||||
// 1. Let doc be element's node document.
|
|
||||||
// NOTE: It's `this`.
|
|
||||||
|
|
||||||
// 2. Assert: doc's lazy load intersection observer is not null.
|
// 5. Set entry.target's lazy load resumption steps to null.
|
||||||
VERIFY(m_lazy_load_intersection_observer);
|
entry.target()->take_lazy_load_resumption_steps({});
|
||||||
|
|
||||||
// 3. Call doc's lazy load intersection observer unobserve method with element as the argument.
|
|
||||||
m_lazy_load_intersection_observer->unobserve(entry.target());
|
|
||||||
|
|
||||||
// 6. Invoke resumptionSteps.
|
// 6. Invoke resumptionSteps.
|
||||||
resumption_steps->function()();
|
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);
|
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
|
// 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)
|
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 run_the_update_intersection_observations_steps(HighResolutionTime::DOMHighResTimeStamp time);
|
||||||
|
|
||||||
void start_intersection_observing_a_lazy_loading_element(Element&);
|
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);
|
void shared_declarative_refresh_steps(StringView input, GC::Ptr<HTML::HTMLMetaElement const> meta_element = nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue