mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibWeb: Add special "potentially delay the load event" logic for iframes
`<iframe>`s only potentially delay the load event when their `current_navigation_was_lazy_loaded` flag is false, so let's wire that up to the flag's setter, and actually call it!
This commit is contained in:
parent
7f509317fd
commit
72376ad15a
2 changed files with 14 additions and 5 deletions
|
@ -69,7 +69,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
|
||||||
// 1. If element's srcdoc attribute is specified, then:
|
// 1. If element's srcdoc attribute is specified, then:
|
||||||
if (has_attribute(HTML::AttributeNames::srcdoc)) {
|
if (has_attribute(HTML::AttributeNames::srcdoc)) {
|
||||||
// 1. Set element's current navigation was lazy loaded boolean to false.
|
// 1. Set element's current navigation was lazy loaded boolean to false.
|
||||||
m_current_navigation_was_lazy_loaded = false;
|
set_current_navigation_was_lazy_loaded(false);
|
||||||
|
|
||||||
// 2. If the will lazy load element steps given element return true, then:
|
// 2. If the will lazy load element steps given element return true, then:
|
||||||
if (will_lazy_load_element()) {
|
if (will_lazy_load_element()) {
|
||||||
|
@ -82,7 +82,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. Set element's current navigation was lazy loaded boolean to true.
|
// 2. Set element's current navigation was lazy loaded boolean to true.
|
||||||
m_current_navigation_was_lazy_loaded = true;
|
set_current_navigation_was_lazy_loaded(true);
|
||||||
|
|
||||||
// 3. Start intersection-observing a lazy loading element for element.
|
// 3. Start intersection-observing a lazy loading element for element.
|
||||||
document().start_intersection_observing_a_lazy_loading_element(*this);
|
document().start_intersection_observing_a_lazy_loading_element(*this);
|
||||||
|
@ -120,7 +120,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
|
||||||
auto referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;
|
auto referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;
|
||||||
|
|
||||||
// 5. Set element's current navigation was lazy loaded boolean to false.
|
// 5. Set element's current navigation was lazy loaded boolean to false.
|
||||||
m_current_navigation_was_lazy_loaded = false;
|
set_current_navigation_was_lazy_loaded(false);
|
||||||
|
|
||||||
// 6. If the will lazy load element steps given element return true, then:
|
// 6. If the will lazy load element steps given element return true, then:
|
||||||
if (will_lazy_load_element()) {
|
if (will_lazy_load_element()) {
|
||||||
|
@ -131,7 +131,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. Set element's current navigation was lazy loaded boolean to true.
|
// 2. Set element's current navigation was lazy loaded boolean to true.
|
||||||
m_current_navigation_was_lazy_loaded = true;
|
set_current_navigation_was_lazy_loaded(true);
|
||||||
|
|
||||||
// 3. Start intersection-observing a lazy loading element for element.
|
// 3. Start intersection-observing a lazy loading element for element.
|
||||||
document().start_intersection_observing_a_lazy_loading_element(*this);
|
document().start_intersection_observing_a_lazy_loading_element(*this);
|
||||||
|
@ -203,4 +203,13 @@ void HTMLIFrameElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visit_lazy_loading_element(visitor);
|
visit_lazy_loading_element(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HTMLIFrameElement::set_current_navigation_was_lazy_loaded(bool value)
|
||||||
|
{
|
||||||
|
m_current_navigation_was_lazy_loaded = value;
|
||||||
|
|
||||||
|
// An iframe element whose current navigation was lazy loaded boolean is false potentially delays the load event.
|
||||||
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:potentially-delays-the-load-event
|
||||||
|
set_potentially_delays_the_load_event(!value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
|
|
||||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||||
|
|
||||||
void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; }
|
void set_current_navigation_was_lazy_loaded(bool value);
|
||||||
|
|
||||||
Optional<HighResolutionTime::DOMHighResTimeStamp> const& pending_resource_start_time() const { return m_pending_resource_start_time; }
|
Optional<HighResolutionTime::DOMHighResTimeStamp> const& pending_resource_start_time() const { return m_pending_resource_start_time; }
|
||||||
void set_pending_resource_start_time(Optional<HighResolutionTime::DOMHighResTimeStamp> time) { m_pending_resource_start_time = time; }
|
void set_pending_resource_start_time(Optional<HighResolutionTime::DOMHighResTimeStamp> time) { m_pending_resource_start_time = time; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue