Repository navigation
Implement ElementInternals - #2690
Merged
webkit-early-warning-system merged 1 commit intoAug 10, 2022
Merged
webkit-early-warning-system merged 1 commit into
webkit-early-warning-system merged 1 commit into
Conversation
shvaikalesh
requested review from
cdumez,
dcrousso,
patrickangle and
rniwa
as code owners
July 24, 2022 00:39
shvaikalesh
force-pushed
the
eng/Implement-ElementInternals
branch
from
July 24, 2022 13:04
0dcf08f to
b82c949
Compare
rniwa
approved these changes
Jul 24, 2022
Member
|
Thanks for updating the patch! I'm excited for this feature to land. |
shvaikalesh
force-pushed
the
eng/Implement-ElementInternals
branch
2 times, most recently
from
August 4, 2022 23:23
eb80c3b to
1d4d4ad
Compare
Member
Author
|
Thank you for review! I've applied all the suggestions ( |
shvaikalesh
force-pushed
the
eng/Implement-ElementInternals
branch
2 times, most recently
from
August 10, 2022 17:17
04c7257 to
9619bb6
Compare
https://bugs.webkit.org/show_bug.cgi?id=197960 Reviewed by Ryosuke Niwa. This change implements ElementInternals interface [1] with a `shadowRoot` getter only, as well as allowing to disable attachInternals() via `disabledFeatures` property. To avoid breaking web sites and polyfills that rely on form-associated custom elements being fully supported if attachInternals() is present, ElementInternals is carefully hidden behind a runtime flag. To ensure attachInternals() can be called in a custom element constructor but not if upgrading fails, the spec introduced a fifth custom element state of "precustomized", which is very similar to "failed". This change avoids adding CustomElementState::Precustomized to preserve free bits in Node::RareDataBitFields, and instead leverages that "precustomized" state is set only in upgrade algorithm, is very similar to "failed", and we can distinguish them by checking Node::IsUnknownElement flag. For the same reason, not to increase sizeof(ElementRareData), ElementInternals attached flag is defined on CustomElementReactionQueue, which led to loosening up assertions in Element::reactionQueue() as it now may be invoked on a built-in element. Also, the introduction of CustomElementState::PrecustomizedOrFailed led to adjusting custom element state checks, bringing us closer to the spec steps / terminology by removing inverted checks in upgradeElement() / at isUndefinedCustomElement() call sites. [1] https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface Tests: imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry.html imported/w3c/web-platform-tests/custom-elements/HTMLElement-attachInternals.html imported/w3c/web-platform-tests/custom-elements/element-internals-shadowroot.html * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/HTMLElement-attachInternals-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/element-internals-shadowroot-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-NotSupportedError-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-accessibility-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-form-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-labels-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-setFormValue-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-validation-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-associated-callback-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-disabled-callback-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/state.tentative/ElementInternals-states-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/state.tentative/state-pseudo-class-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/ElementInternals-states-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/state-pseudo-class-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml: * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-input.xcfilelist: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::JSCustomElementInterface): (WebCore::JSCustomElementInterface::upgradeElement): (WebCore::JSCustomElementInterface::setFormAssociatedCallback): (WebCore::JSCustomElementInterface::setFormResetCallback): (WebCore::JSCustomElementInterface::setFormDisabledCallback): (WebCore::JSCustomElementInterface::setFormStateRestoreCallback): * Source/WebCore/bindings/js/JSCustomElementInterface.h: (WebCore::JSCustomElementInterface::disableElementInternals): (WebCore::JSCustomElementInterface::isElementInternalsDisabled const): (WebCore::JSCustomElementInterface::setIsFormAssociated): * Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): * Source/WebCore/bindings/js/JSElementInternalsCustom.cpp: Added. (WebCore::JSElementInternals::visitAdditionalChildren): * Source/WebCore/css/SelectorCheckerTestFunctions.h: (WebCore::isDefinedElement): * Source/WebCore/dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionQueue::isElementInternalsDisabled const): (WebCore::CustomElementReactionQueue::isElementInternalsAttached const): (WebCore::CustomElementReactionQueue::setElementInternalsAttached): * Source/WebCore/dom/CustomElementReactionQueue.h: * Source/WebCore/dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::document const): * Source/WebCore/dom/CustomElementRegistry.h: * Source/WebCore/dom/Element.cpp: (WebCore::Element::setIsFailedCustomElement): (WebCore::Element::setIsFailedOrPrecustomizedCustomElementWithoutClearingReactionQueue): (WebCore::Element::clearReactionQueueFromFailedOrPrecustomizedCustomElement): (WebCore::Element::enqueueToUpgrade): (WebCore::Element::reactionQueue const): (WebCore::Element::setIsFailedCustomElementWithoutClearingReactionQueue): Deleted. (WebCore::Element::clearReactionQueueFromFailedCustomElement): Deleted. * Source/WebCore/dom/Element.h: * Source/WebCore/dom/ElementInternals.cpp: Added. (WebCore::ElementInternals::shadowRoot const): * Source/WebCore/dom/ElementInternals.h: Added. * Source/WebCore/dom/ElementInternals.idl: Added. * Source/WebCore/dom/Node.h: (WebCore::Node::isUncustomizedCustomElement const): (WebCore::Node::isFailedCustomElement const): (WebCore::Node::isFailedOrPrecustomizedCustomElement const): (WebCore::Node::isPrecustomizedCustomElement const): (WebCore::Node::isPrecustomizedOrDefinedCustomElement const): (WebCore::Node::isUndefinedCustomElement const): Deleted. * Source/WebCore/dom/ShadowRoot.cpp: (WebCore::ShadowRoot::ShadowRoot): * Source/WebCore/dom/ShadowRoot.h: * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::attachInternals): * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLElement.idl: * Source/WebCore/inspector/agents/InspectorDOMAgent.cpp: (WebCore::customElementState): Canonical link: https://commits.webkit.org/253303@main
webkit-early-warning-system
force-pushed
the
eng/Implement-ElementInternals
branch
from
August 10, 2022 20:04
9619bb6 to
c51d445
Compare
Collaborator
|
Committed 253303@main (c51d445): https://commits.webkit.org/253303@main Reviewed commits have been landed. Closing PR #2690 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
c51d445