Skip to content

Commit

Permalink
Remove FormAssociatedCustomElementsEnabled preference
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271155

Reviewed by Ryosuke Niwa.

It's been stable for over a year.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp:
(WebCore::JSCustomElementRegistry::define):
* Source/WebCore/dom/ElementInternals.idl:
* Source/WebCore/html/HTMLElement.idl:

Canonical link: https://commits.webkit.org/276287@main
  • Loading branch information
annevk committed Mar 18, 2024
1 parent dbbb87d commit d4ecd74
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 42 deletions.
14 changes: 0 additions & 14 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2726,20 +2726,6 @@ ForceWebGLUsesLowPower:
WebCore:
default: false

FormAssociatedCustomElementsEnabled:
type: bool
status: stable
category: dom
humanReadableName: "Form-associated custom elements"
humanReadableDescription: "Support for form-associated custom elements"
defaultValue:
WebKitLegacy:
default: true
WebKit:
default: true
WebCore:
default: true

FullScreenEnabled:
type: bool
status: embedder
Expand Down
48 changes: 23 additions & 25 deletions Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,32 +168,30 @@ JSValue JSCustomElementRegistry::define(JSGlobalObject& lexicalGlobalObject, Cal
elementInterface->disableShadow();
}

if (registry.document() && registry.document()->settings().formAssociatedCustomElementsEnabled()) {
auto formAssociatedValue = constructor->get(&lexicalGlobalObject, Identifier::fromString(vm, "formAssociated"_s));
auto formAssociatedValue = constructor->get(&lexicalGlobalObject, Identifier::fromString(vm, "formAssociated"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formAssociatedValue.toBoolean(&lexicalGlobalObject)) {
elementInterface->setIsFormAssociated();

auto* formAssociatedCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formAssociatedCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formAssociatedValue.toBoolean(&lexicalGlobalObject)) {
elementInterface->setIsFormAssociated();

auto* formAssociatedCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formAssociatedCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formAssociatedCallback)
elementInterface->setFormAssociatedCallback(formAssociatedCallback);

auto* formResetCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formResetCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formResetCallback)
elementInterface->setFormResetCallback(formResetCallback);

auto* formDisabledCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formDisabledCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formDisabledCallback)
elementInterface->setFormDisabledCallback(formDisabledCallback);

auto* formStateRestoreCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formStateRestoreCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formStateRestoreCallback)
elementInterface->setFormStateRestoreCallback(formStateRestoreCallback);
}
if (formAssociatedCallback)
elementInterface->setFormAssociatedCallback(formAssociatedCallback);

auto* formResetCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formResetCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formResetCallback)
elementInterface->setFormResetCallback(formResetCallback);

auto* formDisabledCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formDisabledCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formDisabledCallback)
elementInterface->setFormDisabledCallback(formDisabledCallback);

auto* formStateRestoreCallback = getCustomElementCallback(lexicalGlobalObject, prototypeObject, Identifier::fromString(vm, "formStateRestoreCallback"_s));
RETURN_IF_EXCEPTION(scope, { });
if (formStateRestoreCallback)
elementInterface->setFormStateRestoreCallback(formStateRestoreCallback);
}

if (auto promise = registry.addElementDefinition(WTFMove(elementInterface)))
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/dom/ElementInternals.idl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
[
GenerateIsReachable=ImplElementRoot,
GenerateAddOpaqueRoot=element,
Exposed=Window,
EnabledBySetting=FormAssociatedCustomElementsEnabled,
Exposed=Window
] interface ElementInternals {
readonly attribute ShadowRoot? shadowRoot;

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

[CEReactions=Needed] attribute [LegacyNullToEmptyString] DOMString innerText;

[EnabledBySetting=FormAssociatedCustomElementsEnabled] ElementInternals attachInternals();
ElementInternals attachInternals();

[CEReactions=Needed, Reflect] attribute boolean inert;

Expand Down

0 comments on commit d4ecd74

Please sign in to comment.