dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / dom / document_6.lucb
#==============================================================================================
#
# document_6 - DOM::Document: focus, the indicated part, scrolling to the fragment, readiness
#
# DESCRIPTION:
# Port of LibWeb/DOM/Document.cpp (lines 2829-3609): the focused element and focus
# fixup, the target element and autofocus candidates, finding the indicated part of the
# document and scrolling to the fragment (the transition and animation event dispatch,
# lines 3101-3357, is in document_animations), readiness and readyState, lastModified, the page, the event parent and completely
# finishing loading.
#
#==============================================================================================
# mark: Focus ===================================================================================
## Invalidate the :focus, :focus-within and :focus-visible styles under `invalidation_root`.
func dom_document_invalidate_focus_pseudo_classes(this: DomDocument*, invalidation_root: DomNode*, node: DomNode*?):
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_node(css_data.PseudoClass.focus, this, &this.m_focused_area, invalidation_root, node)
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_node(css_data.PseudoClass.focus_within, this, &this.m_focused_area, invalidation_root, node)
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_node(css_data.PseudoClass.focus_visible, this, &this.m_focused_area, invalidation_root, node)
## The captures of set_focused_area's scroll task: `[new_focused_element]`.
struct DomDocumentSetFocusedAreaScrollTask:
var new_focused_element: DomElement*
## set_focused_area's scroll task: scroll the newly focused element into view if it is still focused.
func dom_document_set_focused_area_scroll_task(context: void*?):
let captures = (DomDocumentSetFocusedAreaScrollTask*)(context else trap("no captures"))
let new_focused_element = captures.new_focused_element
if dom_document_focused_area(dom_node_document(new_focused_element.dom_node())) != new_focused_element.dom_node():
return
var scroll_options = DomScrollIntoViewOptions()
dom_scroll_into_view_options_init_fields(&scroll_options)
scroll_options.block = BindScrollLogicalPosition.nearest
scroll_options.inline_ = BindScrollLogicalPosition.nearest
_ = dom_element_scroll_into_view(new_focused_element, .dom_scroll_into_view_options(scroll_options))
## Ported from Document.cpp:2829 Web::DOM::Document::set_focused_area.
pub func dom_document_set_focused_area(this: DomDocument*, node: DomNode*?):
if this.m_focused_area == node:
return
let old_focused_area = this.m_focused_area
if let old_area = old_focused_area:
if let old_focused_element = as_if_dom_element(old_area):
dom_element_did_lose_focus(old_focused_element)
let common_ancestor = dom_find_common_ancestor(old_focused_area, node)
var old_focused_node_root: DomNode*? = none
var new_focused_node_root: DomNode*? = none
if let old_area = old_focused_area:
old_focused_node_root = tree_node_root(old_area)
if let new_node = node:
new_focused_node_root = tree_node_root(new_node)
if old_focused_node_root != new_focused_node_root:
if let old_root = old_focused_node_root:
dom_document_invalidate_focus_pseudo_classes(this, old_root, node)
if let new_root = new_focused_node_root:
dom_document_invalidate_focus_pseudo_classes(this, new_root, node)
else:
let invalidation_root = common_ancestor else trap("focused areas in one tree have a common ancestor")
dom_document_invalidate_focus_pseudo_classes(this, invalidation_root, node)
this.m_focused_area = node
var new_focused_element: DomElement*? = none
if let new_node = node:
new_focused_element = as_if_dom_element(new_node)
if let element = new_focused_element:
dom_element_did_receive_focus(element)
dom_document_reset_cursor_blink_cycle(this)
dom_document_set_needs_repaint_invalidate_display_list(this)
# Scroll the viewport if necessary to make the newly focused element visible.
if let element = new_focused_element:
let captures = new DomDocumentSetFocusedAreaScrollTask(new_focused_element = element) else trap("out of memory")
_ = dom_element_queue_an_element_task(element, HtmlTaskSource.user_interaction, ak.Function0[unit](call = dom_document_set_focused_area_scroll_task, context = captures))
dom_document_update_active_element(this)
## Ported from Document.cpp:2889 Web::DOM::Document::active_element.
pub func dom_document_active_element(this: DomDocument*) -> DomElement*?:
if let active_element = this.m_active_element:
return active_element
let body = dom_document_body(this) else return none
return body.dom_element()
## Ported from Document.cpp:2894 Web::DOM::Document::set_active_element.
pub func dom_document_set_active_element(this: DomDocument*, element: DomElement*?):
if this.m_active_element == element:
return
this.m_active_element = element
dom_document_set_needs_repaint_invalidate_display_list(this)
## Ported from Document.cpp:2904 Web::DOM::Document::set_target_element.
pub func dom_document_set_target_element(this: DomDocument*, element: DomElement*?):
if this.m_target_element == element:
return
# move(m_target_element) leaves the member null until it is set below.
let old_target_element = this.m_target_element
this.m_target_element = none
let common_ancestor = dom_find_common_ancestor((DomNode*?)old_target_element, (DomNode*?)element)
var old_target_node_root: DomNode*? = none
var new_target_node_root: DomNode*? = none
if let old_target = old_target_element:
old_target_node_root = tree_node_root(old_target.dom_node())
if let new_target = element:
new_target_node_root = tree_node_root(new_target.dom_node())
if old_target_node_root != new_target_node_root:
if let old_root = old_target_node_root:
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_element(css_data.PseudoClass.target, this, &this.m_target_element, old_root, element)
if let new_root = new_target_node_root:
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_element(css_data.PseudoClass.target, this, &this.m_target_element, new_root, element)
else:
let invalidation_root = common_ancestor else trap("target elements in one tree have a common ancestor")
css_invalidation_invalidate_style_after_pseudo_class_state_change_dom_element(css_data.PseudoClass.target, this, &this.m_target_element, invalidation_root, element)
this.m_target_element = element
dom_document_set_needs_repaint_invalidate_display_list(this)
## Ported from Document.cpp:2936 Web::DOM::Document::flush_autofocus_candidates.
# https://html.spec.whatwg.org/multipage/interaction.html#flush-autofocus-candidates
pub func dom_document_flush_autofocus_candidates(this: DomDocument*):
# 1. If topDocument's autofocus processed flag is true, then return.
if this.m_autofocus_processed_flag:
return
# 2. Let candidates be topDocument's autofocus candidates.
let candidates = &this.m_autofocus_candidates
# 3. If candidates is empty, then return.
if ak.vector_is_empty(candidates):
return
# 4. If topDocument's focused area is not topDocument itself, or topDocument has non-null target element, then:
var focused_area_is_not_this = false
if let focused_area = this.m_focused_area:
focused_area_is_not_this = focused_area != this.dom_node()
if focused_area_is_not_this or this.m_target_element != none:
# 1. Empty candidates.
ak.vector_clear(candidates)
# 2. Set topDocument's autofocus processed flag to true.
this.m_autofocus_processed_flag = true
# 3. Return.
return
# 5. While candidates is not empty:
while not ak.vector_is_empty(candidates):
# 1. Let element be candidates[0].
let element = *ak.vector_first(candidates)
# 2. Let doc be element's node document.
let doc = dom_node_document(element.dom_node())
# 3. If doc is not fully active, then remove element from candidates, and continue.
if not dom_document_is_fully_active(doc):
_ = ak.vector_take_first(candidates)
continue
# 4. If doc's node navigable's top-level traversable is not the same as topDocument's node navigable, then
# remove element from candidates, and continue.
let doc_navigable = dom_document_navigable(doc)
var same_top_level_traversable = false
if let navigable = doc_navigable:
same_top_level_traversable = (HtmlNavigable*?)html_navigable_top_level_traversable(navigable) == dom_document_navigable(this)
if not same_top_level_traversable:
_ = ak.vector_take_first(candidates)
continue
let doc_navigable_value = doc_navigable else trap("unreachable: checked above")
# 5. If doc's script-blocking style sheet set is not empty, then return.
if not ak.hash_table_is_empty(&doc.m_script_blocking_style_sheet_set):
return
# 6. Remove element from candidates.
_ = ak.vector_take_first(candidates)
# 7. Let inclusiveAncestorDocuments be a list consisting of the active document of doc's inclusive ancestor navigables.
var inclusive_ancestor_documents: ak.Vector[DomDocument*]
ak.vector_append_t(&inclusive_ancestor_documents, doc)
var ancestor_navigable = html_navigable_parent(doc_navigable_value)
while let ancestor = ancestor_navigable:
if let active = html_navigable_active_document(ancestor):
ak.vector_append_t(&inclusive_ancestor_documents, active)
ancestor_navigable = html_navigable_parent(ancestor)
# 8. If any Document in inclusiveAncestorDocuments has non-null target element, then continue.
var any_ancestor_has_target = false
for ancestor in ak.vector_span(&inclusive_ancestor_documents):
if dom_document_target_element(ancestor) != none:
any_ancestor_has_target = true
break
if any_ancestor_has_target:
continue
# 9. Let target be element.
var target: DomElement*? = element
# FIXME: 10. If target is not a focusable area, then set target to the result of getting the
# focusable area for target.
# AD-HOC: We don't implement "get the focusable area" so for now, treat unconnected and non-focusable elements
# as having no focusable area.
if not dom_node_is_connected(element.dom_node()) or not dom_event_target_is_focusable(element.dom_event_target()):
target = none
# 11. If target is not null, then:
if let focus_target = target:
# 1. Empty candidates.
ak.vector_clear(candidates)
# 2. Set topDocument's autofocus processed flag to true.
this.m_autofocus_processed_flag = true
# 3. Run the focusing steps for target.
html_run_focusing_steps(focus_target.dom_node())
# mark: The indicated part ======================================================================
## Ported from Document.cpp:3036 Web::DOM::Document::determine_the_indicated_part.
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document
pub func dom_document_determine_the_indicated_part(this: DomDocument*) -> DomDocumentIndicatedPart:
# For an HTML document document, the following processing model must be followed to determine its indicated part:
# 1. Let fragment be document's URL's fragment.
let url = dom_document_url(this)
let fragment = web_url.url_fragment(&url)
# 2. If fragment is the empty string, then return the special value top of the document.
let fragment_value = fragment else return .dom_document_top_of_the_document(DomDocumentTopOfTheDocument())
if ak.string_is_empty(&fragment_value):
return .dom_document_top_of_the_document(DomDocumentTopOfTheDocument())
# 3. Let potentialIndicatedElement be the result of finding a potential indicated element given document and fragment.
var potential_indicated_element = dom_document_find_a_potential_indicated_element(this, ak.fly_string_from_string(fragment_value))
# 4. If potentialIndicatedElement is not null, then return potentialIndicatedElement.
if potential_indicated_element != none:
return .dom_element(potential_indicated_element)
# 5. Let fragmentBytes be the result of percent-decoding fragment.
# 6. Let decodedFragment be the result of running UTF-8 decode without BOM on fragmentBytes.
let fragment_bytes = web_url.percent_decode(ak.string_bytes_as_string_view(&fragment_value))
let decoded_fragment = ak.string_from_utf8_with_replacement_character(ak.byte_string_view(&fragment_bytes), ak.StringWithBomHandling.no)
# 7. Set potentialIndicatedElement to the result of finding a potential indicated element given document and decodedFragment.
potential_indicated_element = dom_document_find_a_potential_indicated_element(this, ak.fly_string_from_string(decoded_fragment))
# 8. If potentialIndicatedElement is not null, then return potentialIndicatedElement.
if potential_indicated_element != none:
return .dom_element(potential_indicated_element)
# 9. If decodedFragment is an ASCII case-insensitive match for the string top, then return the top of the document.
if ak.string_equals_ignoring_ascii_case_string_view(&decoded_fragment, ak.sv("top")):
return .dom_document_top_of_the_document(DomDocumentTopOfTheDocument())
# 10. Return null.
return .dom_element(none)
## Ported from Document.cpp:3074 Web::DOM::Document::find_a_potential_indicated_element.
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#find-a-potential-indicated-element
func dom_document_find_a_potential_indicated_element(this: DomDocument*, fragment: ak.FlyString) -> DomElement*?:
# To find a potential indicated element given a Document document and a string fragment, run these steps:
# 1. If there is an element in the document tree whose root is document and that has an ID equal to
# fragment, then return the first such element in tree order.
if let element = dom_parent_node_get_element_by_id(this.dom_parent_node(), fragment):
return element
# 2. If there is an a element in the document tree whose root is document that has a name attribute
# whose value is equal to fragment, then return the first such element in tree order.
for node in dom_node_subtree(tree_node_root(this.dom_node())):
let element = as_if_dom_element(node) else continue
if let name = dom_element_name(element):
if ak.fly_string_eq_fly_string(&name, &fragment):
return element
# 3. Return null.
return none
# mark: Scrolling to the fragment ===============================================================
## Ported from Document.cpp:3360 Web::DOM::Document::scroll_to_the_fragment.
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-the-fragment-identifier
pub func dom_document_scroll_to_the_fragment(this: DomDocument*):
# To scroll to the fragment given a Document document:
# 1. If document's indicated part is null, then set document's target element to null.
let indicated_part = dom_document_determine_the_indicated_part(this)
match indicated_part:
.dom_element(element):
if element == none:
dom_document_set_target_element(this, none)
# 3. Otherwise:
else:
# 1. Assert: document's indicated part is an element.
# 2. Let target be document's indicated part.
let target = element else trap("unreachable: checked above")
# 3. Set document's target element to target.
dom_document_set_target_element(this, target)
# FIXME: 4. Run the ancestor revealing algorithm on target.
# 5. Scroll target into view, with behavior set to "auto", block set to "start", and inline set to "nearest". [CSSOMVIEW]
var scroll_options = DomScrollIntoViewOptions()
dom_scroll_into_view_options_init_fields(&scroll_options)
scroll_options.block = BindScrollLogicalPosition.start
scroll_options.inline_ = BindScrollLogicalPosition.nearest
_ = dom_element_scroll_into_view(target, .dom_scroll_into_view_options(scroll_options))
# 6. Run the focusing steps for target, with the Document's viewport as the fallback target.
# FIXME: Pass the Document's viewport somehow.
html_run_focusing_steps(target.dom_node())
# FIXME: 7. Move the sequential focus navigation starting point to target.
# 2. Otherwise, if document's indicated part is top of the document, then:
.dom_document_top_of_the_document(_):
# 1. Set document's target element to null.
dom_document_set_target_element(this, none)
# 2. Scroll to the beginning of the document for document. [CSSOMVIEW]
dom_document_scroll_to_the_beginning_of_the_document(this)
# 3. Return.
return
## Ported from Document.cpp:3410 Web::DOM::Document::try_to_scroll_to_the_fragment.
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#try-to-scroll-to-the-fragment
pub func dom_document_try_to_scroll_to_the_fragment(this: DomDocument*):
# FIXME: According to the spec we should only scroll here if document has no parser or parsing has stopped.
# It should be ok to remove this after we implement navigation events and scrolling will happen in
# "process scroll behavior".
# To try to scroll to the fragment for a Document document, perform the following steps in parallel:
# 1. Wait for an implementation-defined amount of time. (This is intended to allow the user agent to
# optimize the user experience in the face of performance concerns.)
# 2. Queue a global task on the navigation and traversal task source given document's relevant global
# object to run these steps:
# 1. If document has no parser, or its parser has stopped parsing, or the user agent has reason to
# believe the user is no longer interested in scrolling to the fragment, then abort these steps.
# 2. Scroll to the fragment given document.
# 3. If document's indicated part is still null, then try to scroll to the fragment for document.
dom_document_scroll_to_the_fragment(this)
## Ported from Document.cpp:3429 Web::DOM::Document::scroll_to_the_beginning_of_the_document.
# https://drafts.csswg.org/cssom-view-1/#scroll-to-the-beginning-of-the-document
pub func dom_document_scroll_to_the_beginning_of_the_document(this: DomDocument*):
# FIXME: Actually implement this algorithm
if let navigable = dom_document_navigable(this):
html_navigable_perform_scroll_of_viewport_scrolling_box(navigable, gfx.CssPixelPoint())
# mark: Readiness ===============================================================================
## Ported from Document.cpp:3436 Web::DOM::Document::ready_state.
pub func dom_document_ready_state(this: DomDocument*) -> ak.StringView:
match this.m_readiness:
.loading: return ak.sv("loading")
.interactive: return ak.sv("interactive")
.complete: return ak.sv("complete")
_: trap("VERIFY_NOT_REACHED")
## Ported from Document.cpp:3450 Web::DOM::Document::update_readiness.
# https://html.spec.whatwg.org/multipage/dom.html#update-the-current-document-readiness
pub func dom_document_update_readiness(this: DomDocument*, readiness_value: HtmlDocumentReadyState):
# 1. If document's current document readiness equals readinessValue, then return.
if this.m_readiness == readiness_value:
return
# 2. Set document's current document readiness to readinessValue.
this.m_readiness = readiness_value
if readiness_value != HtmlDocumentReadyState.loading:
page_client_request_frame(page_client(dom_document_page(this)))
# 3. If document is associated with an HTML parser, then:
if this.m_parser != none:
# 1. Let now be the current high resolution time given document's relevant global object.
let now = high_resolution_time_current_high_resolution_time(html_relevant_global_object((JsObject*)this))
# 2. If readinessValue is "complete", and document's load timing info's DOM complete time is 0,
# then set document's load timing info's DOM complete time to now.
if readiness_value == HtmlDocumentReadyState.complete and this.m_load_timing_info.dom_complete_time == 0.0:
this.m_load_timing_info.dom_complete_time = now
# 3. Otherwise, if readinessValue is "interactive", and document's load timing info's DOM interactive time is 0,
# then set document's load timing info's DOM interactive time to now.
elif readiness_value == HtmlDocumentReadyState.interactive and this.m_load_timing_info.dom_interactive_time == 0.0:
this.m_load_timing_info.dom_interactive_time = now
# 4. Fire an event named readystatechange at document.
_ = dom_event_target_dispatch_event(this.dom_event_target(), dom_event_create(dom_document_realm(this), html_event_names_readystatechange))
if readiness_value == HtmlDocumentReadyState.complete:
var navigable_is_traversable = false
let navigable = dom_document_navigable(this)
if let current = navigable:
navigable_is_traversable = html_navigable_is_traversable(current)
if navigable_is_traversable:
let traversable_navigable = navigable else trap("unreachable: checked above")
if not dom_document_is_decoded_svg(this):
html_link_element_load_fallback_favicon_if_needed(this)
let traversable = html_navigable_traversable_navigable(traversable_navigable) else trap("a traversable navigable is its own traversable")
page_client_page_did_finish_loading(page_client(html_navigable_page(traversable.html_navigable())), dom_document_url(this))
else:
this.m_needs_to_call_page_did_load = true
dom_document_notify_document_observers_of_readiness(this, this.m_readiness)
## Ported from Document.cpp:3501 Web::DOM::Document::last_modified.
# https://html.spec.whatwg.org/multipage/dom.html#dom-document-lastmodified
pub func dom_document_last_modified(this: DomDocument*) -> ak.String:
# The lastModified attribute, on getting, must return the date and time of the Document's source file's
# last modification, in the user's local time zone, in the following format:
# 1. The month component of the date.
# 2. A U+002F SOLIDUS character (/).
# 3. The day component of the date.
# 4. A U+002F SOLIDUS character (/).
# 5. The year component of the date.
# 6. A U+0020 SPACE character.
# 7. The hours component of the time.
# 8. A U+003A COLON character (:).
# 9. The minutes component of the time.
# 10. A U+003A COLON character (:).
# 11. The seconds component of the time.
# The Document's source file's last modification date and time must be derived from relevant features
# of the networking protocols used, e.g. from the value of the HTTP `Last-Modified` header of the document,
# or from metadata in the file system for local files. If the last modification date and time are not known,
# the attribute must return the current date and time in the above format.
let format_string = ak.sv("%m/%d/%Y %H:%M:%S")
if let last_modified = this.m_last_modified:
return ak.unix_date_time_to_string(&last_modified, format_string) else trap("MUST: UnixDateTime::to_string")
let now = ak.unix_date_time_now()
return ak.unix_date_time_to_string(&now, format_string) else trap("MUST: UnixDateTime::to_string")
## Ported from Document.cpp:3530 Web::DOM::Document::page.
pub func dom_document_page(this: DomDocument*) -> Page*:
return this.m_page
## Ported from Document.cpp:3535 Web::DOM::Document::page.
pub func dom_document_page_const(this: DomDocument*) -> Page*:
return this.m_page
## Ported from Document.cpp:3540 Web::DOM::Document::get_parent (override).
pub func dom_document_get_parent_impl(base: DomEventTarget*, event: DomEvent*) -> DomEventTarget*?:
let this = (DomDocument*)base
let type_ = dom_event_type(event)
if ak.fly_string_eq_fly_string(&type_, &html_event_names_load):
return none
let window = this.m_window else return none
return window.dom_event_target()
# mark: Completely finishing loading ============================================================
## Ported from Document.cpp:3549 Web::DOM::Document::is_completely_loaded.
# https://html.spec.whatwg.org/multipage/document-lifecycle.html#completely-loaded
pub func dom_document_is_completely_loaded(this: DomDocument*) -> bool:
return this.m_completely_loaded_time != none
## The captures of completely_finish_loading's container tasks: `[container]`.
struct DomDocumentCompletelyFinishLoadingContainerTask:
var container: HtmlNavigableContainer*
## completely_finish_loading's iframe task: run the iframe load event steps given container.
func dom_document_completely_finish_loading_iframe_task(context: void*?):
let captures = (DomDocumentCompletelyFinishLoadingContainerTask*)(context else trap("no captures"))
html_run_iframe_load_event_steps(as_html_htmli_frame_element(captures.container.dom_node()))
## completely_finish_loading's container task: fire an event named load at container.
func dom_document_completely_finish_loading_load_task(context: void*?):
let captures = (DomDocumentCompletelyFinishLoadingContainerTask*)(context else trap("no captures"))
let container = captures.container
_ = dom_event_target_dispatch_event(container.dom_event_target(), dom_event_create(bind_platform_object_realm(container.bind_platform_object()), html_event_names_load))
## Ported from Document.cpp:3555 Web::DOM::Document::completely_finish_loading.
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#completely-finish-loading
pub func dom_document_completely_finish_loading(this: DomDocument*):
# 2. Set document's completely loaded time to the current time.
# AD-HOC: Set this unconditionally, even if the document has no navigable yet.
# In the async state machine, documents created during populate may complete
# loading before they are activated. The timestamp must still be recorded so
# that activate_history_entry can detect this and re-trigger the container
# notification steps.
if this.m_completely_loaded_time == none:
this.m_completely_loaded_time = ak.unix_date_time_now()
let maybe_navigable = dom_document_navigable(this)
if maybe_navigable == none:
this.m_completely_loaded_deferred = true
return
let navigable = maybe_navigable else trap("unreachable: checked above")
this.m_completely_loaded_deferred = false
# ScopeGuard notify_observers: tell the document observers on every exit from here on.
defer dom_document_notify_document_observers_completely_loaded(this)
# 1. Assert: document's browsing context is non-null.
assert(dom_document_browsing_context(this) != none)
# NOTE: See the end of shared_declarative_refresh_steps.
if let active_refresh_timer = this.m_active_refresh_timer:
core_timer_start(active_refresh_timer)
# 3. Let container be document's browsing context's container.
let container = html_navigable_container(navigable) else return
# 4. If container is an iframe element, then queue an element task on the DOM manipulation task source given container to run the iframe load event steps given container.
let captures = new DomDocumentCompletelyFinishLoadingContainerTask(container = container) else trap("out of memory")
if is_html_htmli_frame_element(container.dom_node()):
_ = dom_element_queue_an_element_task(container.dom_element(), HtmlTaskSource.dom_manipulation, ak.Function0[unit](call = dom_document_completely_finish_loading_iframe_task, context = captures))
# 5. Otherwise, if container is non-null, then queue an element task on the DOM manipulation task source given container to fire an event named load at container.
else:
_ = dom_element_queue_an_element_task(container.dom_element(), HtmlTaskSource.dom_manipulation, ak.Function0[unit](call = dom_document_completely_finish_loading_load_task, context = captures))
# AD-HOC: Script-created parsers (iframe document.open/write/close) don't reach set_ready_for_post_load_tasks, so
# the parent's load-event-delay phase wouldn't otherwise be re-evaluated when this iframe finishes loading.
dom_document_schedule_html_parser_end_check(dom_node_document(container.dom_node()))