-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Document render-blocking with <link rel=expect> #31939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document render-blocking with <link rel=expect> #31939
Conversation
EWS run on previous version of this PR (hash e5a4d5a) |
e5a4d5a
to
8b06372
Compare
EWS run on previous version of this PR (hash 8b06372) |
8b06372
to
fc426ec
Compare
EWS run on previous version of this PR (hash fc426ec) |
fc426ec
to
c42f95f
Compare
EWS run on previous version of this PR (hash c42f95f) |
c42f95f
to
2ab0bf3
Compare
EWS run on previous version of this PR (hash 2ab0bf3) |
2ab0bf3
to
7bfb3ba
Compare
EWS run on previous version of this PR (hash 7bfb3ba) |
7bfb3ba
to
6ea2ce8
Compare
EWS run on previous version of this PR (hash 6ea2ce8) |
6ea2ce8
to
11d7d6a
Compare
EWS run on previous version of this PR (hash 11d7d6a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add describe the optimization you've done with the anchor elements? Just for posterity, so folks looking at this commit can have the context.
FAIL blocking defers frames until full parsing assert_false: expected false got true | ||
Harness Error (TIMEOUT), message = null | ||
|
||
TIMEOUT blocking defers frames until full parsing Test timed out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a follow up for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll file a bug. Something to do with emoji's vs percent-syntax not matching.
I believe it's unrelated to my new code, but would be good to fix.
@@ -1,4 +1,5 @@ | |||
function generateParserDelay(seconds = 1) { | |||
seconds += (Math.random() / 10.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't forget to export to WPT
@@ -83,6 +83,8 @@ class HTMLAnchorElement : public HTMLElement, public URLDecomposition { | |||
String referrerPolicyForBindings() const; | |||
ReferrerPolicy referrerPolicy() const; | |||
|
|||
Node::InsertedIntoAncestorResult insertedIntoAncestor(InsertionType , ContainerNode& parentOfInsertedTree) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node::InsertedIntoAncestorResult insertedIntoAncestor(InsertionType , ContainerNode& parentOfInsertedTree) override; | |
Node::InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode& parentOfInsertedTree) override; |
@@ -573,6 +655,18 @@ DOMTokenList& HTMLLinkElement::relList() | |||
return *m_relList; | |||
} | |||
|
|||
DOMTokenList& HTMLLinkElement::blocking() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11d7d6a
to
a58e9ec
Compare
EWS run on previous version of this PR (hash a58e9ec) |
a58e9ec
to
ff21813
Compare
EWS run on current version of this PR (hash ff21813) |
https://bugs.webkit.org/show_bug.cgi?id=268743 <rdar://122797243> Reviewed by Tim Nguyen. Implements the render-blocking concept on Document, and the rel=expect attribute for <link>. https://html.spec.whatwg.org/multipage/dom.html#block-rendering utils.js changed to generate a unique URL for each parser delay, otherwise we cache the loads (which may not be spec compliant, but unrelated to render-blocking). Render blocking uses the existing code addVisualUpdatePreventedReason to prevent rendering, and rAF. Some of the test fail because they have no render blocking (since an attempt was rejected due to a mismatched media query or similar). These tests expect rendering to happen mid-parsing, but don't due to our existing layer tree freezing code. I've opted not to change the existing behaviour for now, and only have this kick in when there is explicit (and active) render blocking elements. As an optimization, when an <a> element changes, we pass that element into the 'process internal resource links' algorithm. Rather than doing a tree search for each link looking for matching anchors, we can just directly check if the link matches the mutated <a>. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-004-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-005-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-007-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-009-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-010-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-013-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-014-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-015-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-016-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-017-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-018-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-019-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-020-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-021-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-022-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-023-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-025-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-026-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-028-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-029-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-030-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-031-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-032-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-034-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-035-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-036-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-037-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/element-render-blocking-038-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/remove-element-unblocks-rendering.optional-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/render-blocking/support/utils.js: (generateParserDelay): * LayoutTests/imported/w3c/web-platform-tests/loading/resources/dummy.js: Added. * LayoutTests/platform/glib/TestExpectations: * Source/WebCore/dom/Document.cpp: (WebCore::Document::setReadyState): (WebCore::Document::setVisualUpdatesAllowed): (WebCore::Document::addVisualUpdatePreventedReason): (WebCore::Document::removeVisualUpdatePreventedReason): (WebCore::Document::visualUpdatesSuppressionTimerFired): (WebCore::Document::setVisualUpdatesAllowedByClient): (WebCore::Document::suspend): (WebCore::Document::resume): (WebCore::Document::allowsAddingRenderBlockedElements const): (WebCore::Document::isRenderBlocked const): (WebCore::Document::blockRenderingOn): (WebCore::Document::unblockRenderingOn): (WebCore::Document::processInternalResourceLinks): * Source/WebCore/dom/Document.h: (WebCore::Document::visualUpdatesAllowed const): * Source/WebCore/html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::attributeChanged): (WebCore::HTMLAnchorElement::insertedIntoAncestor): * Source/WebCore/html/HTMLAnchorElement.h: * Source/WebCore/html/HTMLAttributeNames.in: * Source/WebCore/html/HTMLLinkElement.cpp: (WebCore::ExpectIdTargetObserver::ExpectIdTargetObserver): (WebCore::ExpectIdTargetObserver::idTargetChanged): (WebCore::HTMLLinkElement::attributeChanged): (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::processInternalResourceLink): (WebCore::HTMLLinkElement::unblockRendering): (WebCore::HTMLLinkElement::removedFromAncestor): (WebCore::HTMLLinkElement::blocking): * Source/WebCore/html/HTMLLinkElement.h: * Source/WebCore/html/HTMLLinkElement.idl: * Source/WebCore/html/LinkRelAttribute.cpp: (WebCore::LinkRelAttribute::LinkRelAttribute): * Source/WebCore/html/LinkRelAttribute.h: Canonical link: https://commits.webkit.org/282279@main
ff21813
to
0e9bbd9
Compare
Committed 282279@main (0e9bbd9): https://commits.webkit.org/282279@main Reviewed commits have been landed. Closing PR #31939 and removing active labels. |
0e9bbd9
ff21813
🧪 api-gtk