-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Prototype streaming for declarative shadow DOM #4822
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
Conversation
|
EWS run on previous version of this PR (hash eefe965) Details |
|
EWS run on previous version of this PR (hash 4f0a1ea) Details |
cdumez
left a comment
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.
LGTM
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.
nit: Do we really need the WeakPtr { }?
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.
No needed after all. Will fix.
|
EWS run on current version of this PR (hash b2439e8) Details |
https://bugs.webkit.org/show_bug.cgi?id=245817 Reviewed by Chris Dumez. Add a very experimental internal settings to make declarative shadow DOM stream by attaching shadow root when the start tag of a template element is parsed instead of when the end tag is parsed as proposed. Having this internal setting allow us to analyze the performance characteristics of both approaches. * Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml: Added a new internal settings. We don't use experimental features since this feature needs to be disabled by default in WKTR. * Source/WebCore/html/HTMLTemplateElement.cpp: (WebCore::HTMLTemplateElement::fragmentForInsertion const): Added. This is an abstraction around regular template and template element, which is a parser macro for shadow root. (WebCore::HTMLTemplateElement::content const): Assert that nobody calls this version unless we're dealing with a regular template element (i.e. not a declarative shadow DOM). (WebCore::HTMLTemplateElement::setDeclarativeShadowRoot): Added. (WebCore::HTMLTemplateElement::attachAsDeclarativeShadowRootIfNeeded): Exit early if we had attached the shadow root with the start tag. * Source/WebCore/html/HTMLTemplateElement.h: * Source/WebCore/html/parser/HTMLConstructionSite.cpp: (WebCore::insert): (WebCore::HTMLConstructionSite::insertHTMLTemplateElement): Added. This implements the main logic of streaming declarative shadow DOM, which attaches shadow root as soon as the start tag is parsed. (WebCore::HTMLConstructionSite::ownerDocumentForCurrentNode): * Source/WebCore/html/parser/HTMLConstructionSite.h: * Source/WebCore/html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processTemplateStartTag): Canonical link: https://commits.webkit.org/255020@main
|
Committed 255020@main (c0bda73): https://commits.webkit.org/255020@main Reviewed commits have been landed. Closing PR #4822 and removing active labels. |
b2439e8 to
c0bda73
Compare
This follows the discussion on the HTML spec PR [1], and follows the approach suggested by @rniwa [2]. A template element is still created and added to the stack of open elements, but the template is *not* added to the document. And then the template contents are parsed directly into the open shadow root, so there is no moving of contents or removal of the template element at the end. The new behavior is behind the StreamingDeclarativeShadowDOM feature, which is enabled for experimental only. A virtual suite tests the old non-streaming behavior. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551}
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551}
A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551}
…adow DOM, a=testonly Automatic update from web-platform-tests Add support for streaming Declarative Shadow DOM A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551} -- wpt-commits: 80c57bdba06c47377a7abd550e3a371f8dd51b9f wpt-pr: 36597
…adow DOM, a=testonly Automatic update from web-platform-tests Add support for streaming Declarative Shadow DOM A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551} -- wpt-commits: 80c57bdba06c47377a7abd550e3a371f8dd51b9f wpt-pr: 36597
…adow DOM, a=testonly Automatic update from web-platform-tests Add support for streaming Declarative Shadow DOM A new feature flag, StreamingDeclarativeShadowDOM, guards the new behavior in this CL. When that flag is enabled, upon seeing the *opening* `<template>` tag, the parser will attach a shadow root to the `<template>`'s parent element. All subsequent template content will then be parsed *directly* into that shadow root. The closing `</template>` tag is then basically a no-op: there is no more moving of template content into shadow roots and removal of the `<template>` element. In this new mode, there is never an actual `<template>` element placed into the DOM tree. There is a "placeholder" template that gets added to the parser's stack of open elements, just to keep track of the parsing mode appropriately. If the StreamingDeclarativeShadowDOM flag is disabled, the "old" behavior is retained, of attaching the shadow root at the closing `</template>` tag. A virtual suite tests this the old non-streaming behavior. This approach follows the discussion on the HTML spec PR [1], and the approach suggested by @rniwa [2]. [1] whatwg/html#5465 [2] WebKit/WebKit#4822 Bug: 1042130,1379513 Change-Id: Iab9c9c1a2eb49eaa8f1f7c928f2477977e92b49b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967571 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1065551} -- wpt-commits: 80c57bdba06c47377a7abd550e3a371f8dd51b9f wpt-pr: 36597
c0bda73
b2439e8
🛠 mac-debug🧪 api-mac🧪 mac-AS-debug-wk2