mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Start implementing render-blocking mechanism from HTML spec
This change implements enough spec steps to block rendering until execution of sync scripts inserted from HTML parser is complete.
This commit is contained in:
parent
75168fa4d6
commit
da579e11b0
Notes:
github-actions[bot]
2025-02-05 17:29:43 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: da579e11b0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3455
7 changed files with 99 additions and 3 deletions
|
@ -71,6 +71,37 @@ void HTMLElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_popover_close_watcher);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#block-rendering
|
||||
void HTMLElement::block_rendering()
|
||||
{
|
||||
// 1. Let document be el's node document.
|
||||
auto& document = this->document();
|
||||
|
||||
// 2. If document allows adding render-blocking elements, then append el to document's render-blocking element set.
|
||||
if (document.allows_adding_render_blocking_elements()) {
|
||||
document.add_render_blocking_element(*this);
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#unblock-rendering
|
||||
void HTMLElement::unblock_rendering()
|
||||
{
|
||||
// 1. Let document be el's node document.
|
||||
auto& document = this->document();
|
||||
|
||||
// 2. Remove el from document's render-blocking element set.
|
||||
document.remove_render_blocking_element(*this);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#potentially-render-blocking
|
||||
bool HTMLElement::is_potentially_render_blocking()
|
||||
{
|
||||
// An element is potentially render-blocking if
|
||||
// FIXME: its blocking tokens set contains "render",
|
||||
// or if it is implicitly potentially render-blocking, which will be defined at the individual elements.
|
||||
return is_implicitly_potentially_render_blocking();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-dir
|
||||
StringView HTMLElement::dir() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue