Skip to content
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

Introduce form-associated custom element #4383

Merged
merged 1 commit into from
May 16, 2019

Conversation

tkent-google
Copy link
Collaborator

@tkent-google tkent-google commented Feb 21, 2019

@rniwa
Copy link
Collaborator

rniwa commented Feb 22, 2019

Could you summarize the changes these two PR would make in WICG/webcomponents#187 ? There is a lot of spec changes happening here, and it's hard to follow what the proposed API looks like.

@tkent-google
Copy link
Collaborator Author

Could you summarize the changes these two PR would make in w3c/webcomponents#187 ? There is a lot of spec changes happening here, and it's hard to follow what the proposed API looks like.

Sure. I'll add a summary.

aarongable pushed a commit to chromium/chromium that referenced this pull request Feb 27, 2019
to match to the latest pull request [1].

- If the element has zero-length name attribute, it should not add an entry.
- The first argument of setFormValue() should be nullable, and the null
  value should add no entry.

[1] whatwg/html#4383

Bug: 905922
Change-Id: I5bcacd633e43050e5065682043d126359bdeca7c
Reviewed-on: https://chromium-review.googlesource.com/c/1491051
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635890}
aarongable pushed a commit to chromium/chromium that referenced this pull request Feb 27, 2019
…w NotSupportedError instead of InvalidStateError

to match to the latest specification pull request [1].
Also, 'labels' attribute should throw a NotSupportedError.

[1] whatwg/html#4383

Change-Id: Ie1679e0746d72d5f2c06423eba70d8f570b61911
Bug: 905922
Reviewed-on: https://chromium-review.googlesource.com/c/1491055
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635895}
domenic added a commit to whatwg/html-build that referenced this pull request Feb 27, 2019
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually looks good to me. In penance for the review delay, I did the editorial changes myself. It would be good to have someone do another pass, and we should definitely wait for more implementers to get a chance to weigh in before merging, but it's top-notch work and seems detailed enough to be interoperably implementable, with good developer-facing documentation built in, and the like. I'm sold.

I would like to get a bit more explanation in the spec about state vs. submission value, but otherwise it all seems to work out pretty well.

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@domenic
Copy link
Member

domenic commented Mar 12, 2019

Let's pull the submission value / state discussion out of the inline comments for more visibility. Continuing from #4383 (comment) and #4383 (comment) .

I like that the current architecture supports both. For example, consider a very hypothetical numeric control that takes various forms of numeric input as the "state", and converts them to a canonical decimal number string for submission to the server. So if I type "five" or "五" or "V" (Roman numerals), those strings are the state. But the control will convert them to the value "5". And if the UA needs to restore the state, e.g. via autocomplete or session restore or bfcache or whatever, then the UA will send a restoreStateCallback() with the "five" state, and the control can re-compute that the value should be "5". Makes sense, and we should include an example of that sort in the spec.

And I like how most control authors who don't care about the distinction can just do setFormValue(value) and the value will be used as both the state and the value.

So I think that, besides better documentation/examples, the main question is about the API surface that is currently setFormValue(state, value). I think that would be clearer as something like:

  • setFormValueAndState(value, state)
  • setFormValue(value, { state })

or something like that.

I also wonder why you can't use an entry list (i.e. a FormData JS object) for the state. It seems like the browser could serialize and restore that just as well as it could a File/USVString. Thoughts?

@tkent-google
Copy link
Collaborator Author

Re: setFormValue()

I had an uncomfortable feeling with supporting FormData for state because a FormData object contains entry names, which are not a part of element state. However now I think allowing FormData for state would make the API simpler and clearer. I made a local experimental implementation for the FormData support today, and found its implementation cost was not high.

So, I'd like to change setFormValue() to:

void setFormValue((File or USVString or FormData)? value,
                  optional (File or USVString or FormData)? state);

setFormValue(v) is equivalent to setFormValue(v, v).

@tkent-google
Copy link
Collaborator Author

I updated the patch.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you for those examples and extra explanations; they were very clarifying.

From an editor point of view I am happy with this. It would be good to get more implementers' feedback, but I have no concerns, and indeed am really excited with and happy about this spec.

aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 18, 2019
to match to the latest specification pull request [1].

Old:
  void setFormValue((File or USVString)? value,
                    optional FormData entrySource);
New:
  void setFormValue((File or USVString or FormData)? value,
                    optional (File or USVString or FormData)? state);

Types of 'submission value' and 'state' of form-associate custom
element completely match. Blink needs to support state-restoring for
a FormData object, and the argument type of "restoreValueCallback" is
also updated.

* element_internals.*:
  - Change the arguments of setFormValue
  - Support FormData state restore

* form_data.*:
  - Support state restore

[1] whatwg/html#4383

Bug: 905922
Change-Id: Iaa618f45f854bf82f928d36ca071d3adf3b969b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525788
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641541}
aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 18, 2019
to "restoreStateCallback" to match to the latest specification
pull-request [1].

[1] whatwg/html#4383

Bug: 905922
Change-Id: I5525e3c835cceec74ab7c726a0e07abbb6f92017
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1528026
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641547}
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a couple of things that seemed worth pointing out. Thanks for working on this!

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
@sideshowbarker sideshowbarker added the impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation label Apr 8, 2019
@sideshowbarker
Copy link
Contributor

heads-up @whatwg/documentation

@chrisdavidmills
Copy link

Recorded at https://trello.com/c/M46uVg89/24-web-components-related-updates for potential docs requirement

@tkent-google
Copy link
Collaborator Author

I updated the patch to add another argument to ElementInternals' setValidity() for WICG/webcomponents#187 (comment) .

@domenic
Copy link
Member

domenic commented May 14, 2019

@annevk do you want to take another look? I think this is ready to merge, especially now that you've approved #4324. And my read of the web components F2F was that we had multi-vendor support.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple nits (and left some other minor blocking comments on the blocking PRs), but this looks really great overall. Besides implementers this also has a huge interest from component developers so very glad to see it close to completion.

source Show resolved Hide resolved
source Show resolved Hide resolved
initially.</p>

<p>Each <span>form-associated custom element</span> has a
<dfn data-x="face-validation-anchor">validation anchor</dfn> element. It is null initially.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this in v1? It seems the UA could focus the control for now which coupled with the invalid event should give it enough to go on?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it came directly out of developer feedback, and it's a "should" behavior, I'm inclined to keep it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for it? It's yet another way to focus an element and we don't really understand focus.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have tests for the validation step that it's a shadow-including descendant. We could add optional tests for the focus, but they can't be required since it's only a "may" that you focus "or otherwise draw attention to" invalid controls.

To be clear, the normative impact of this field only appears in the following context:

User agents may focus one of those elements in the process, by running the focusing steps for that element, and may change the scrolling position of the document, or perform some other action that brings the element to the user's attention. For elements that are form-associated custom elements, user agents should use their validation anchor instead, for the purposes of these actions.

source Outdated Show resolved Hide resolved
@annevk annevk added addition/proposal New features or enhancements topic: forms labels May 15, 2019
@domenic
Copy link
Member

domenic commented May 15, 2019

OK, cool :D. I will fix the nits and merge today, assuming we have straightened out the ElementInternals which-exception questions.

Edit: I see we haven't quite straightened them out, so we'll delay another sleep cycle. New plan at #4324 (comment).

@domenic domenic added the topic: custom elements Relates to custom elements (as defined in DOM and HTML) label May 15, 2019
domenic pushed a commit that referenced this pull request May 16, 2019
This provides the ElementInternals interface, which can be obtained for
custom elements via the element.attachInternals() method. For now
ElementInternals is empty, but it will gain members in #4383.

This also adds the ability for custom elements to set the
disabledFeatures static property, to disable element internals and
shadow DOM. Some DOM-side infrastructure work there is necessary in
whatwg/dom#760.

Tests:
- web-platform-tests/wpt#15123
- web-platform-tests/wpt#15516
- web-platform-tests/wpt#16853

Fixes WICG/webcomponents#758.
domenic pushed a commit to web-platform-tests/wpt that referenced this pull request May 16, 2019
@domenic domenic merged commit ab73443 into whatwg:master May 16, 2019
domenic pushed a commit to web-platform-tests/wpt that referenced this pull request May 16, 2019
@gregwhitworth
Copy link

Quick question on this, and this may not be the right place for such a question - but why is the form value being considered a 'state'? Isn't this actually a property or attribute of the component, not its state? @domenic @tkent-google @annevk

@domenic
Copy link
Member

domenic commented May 16, 2019

Did you read the section that clarifies the difference between state and value? https://html.spec.whatwg.org/multipage/custom-elements.html#face-submission-value

@gregwhitworth
Copy link

Yes, that is what confused me, especially given this example:

Suppose that we have a form-associated custom element which asks a user to specify a date. The user specifies "3/15/2019", but the control wishes to submit "2019-03-15" to the server. "3/15/2019" would be a state of the element, and "2019-03-15" would be a submission value.

How is 3/15/2019 a state? The only state that I can think that maps to this would be something like "has-entry" or something similar. 3/15/2019 is the original author provided value, the only difference is that the submittedValue has been adjusted for what the server needs.

This paradigm can actually be seen on the web already, 3/15/2019 would be stored in value="3/15/2019" and on submit the listen to the submit event and xhr (or fetch 😉) the sanitized value actively stored in the value attribute.

Ultimately, I think conflating the original value with the likes of checked, unchecked, disabled, etc will cause author confusion.

@domenic
Copy link
Member

domenic commented May 17, 2019

This paradigm can actually be seen on the web already, 3/15/2019 would be stored in value="3/15/2019" and on submit the listen to the submit event and xhr (or fetch 😉) the sanitized value actively stored in the value attribute.

That's not quite accurate. The form submission value is that is stored in the value attribute at all times. What's seen on the screen, and other internal state of the form, is mapped to the value continuously, not on submit. In other words, dateInput.value === "2019-03-15" at all times; what the user typed is never directly accessible, but instead stored as internal state.

Maybe the issue is that you aren't thinking of state as a complex thing such as a string, but only booleans like "has entry" or "checked"? The spec is using state in the CS sense, or the component-library sense (think React's setState). Note that this is only a spec term; it isn't exposed in the API.

The checkbox provides a more straightforward example. Its internal state is given by two boolean fields: checkedness, and indeterminate. (These are also exposed externally via getters.) Thus it has 2x2 = 4 states. But the value, what is submitted to the server and reflected in the value attribute and accessible via new FormData(formElementContainingTheCheckbox), is either null or "some string" (where checkboxInputEl.value === "some string").

When you want to save and restore the state, either because of autofill or session restore or the like, you want to restore the checkedness and indeterminate booleans. You don't care about the value, because that's determined automatically as a derived function of the value="" attribute plus the state.

The API doesn't conflate state and value; it allows them to be optionally separate.

I hope this helps; let us know if there's any way the spec could explain it better.

@gregwhitworth
Copy link

@domenic much appreciated, that does indeed make more sense with the explanation.

@tkent-google tkent-google deleted the tkent-form-associated-ce branch May 17, 2019 02:29
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 19, 2019
…ements', a=testonly

Automatic update from web-platform-tests
Add tests for form-associated custom elements

This is for WICG/webcomponents#187.

Specification PR: whatwg/html#4383.
--

wp5At-commits: 3ccd79e32ced5ddab58f52e79f982d2ebfc7f98c
wpt-pr: 15740
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request Jun 19, 2019
…ements', a=testonly

Automatic update from web-platform-tests
Add tests for form-associated custom elements

This is for WICG/webcomponents#187.

Specification PR: whatwg/html#4383.
--

wp5At-commits: 3ccd79e32ced5ddab58f52e79f982d2ebfc7f98c
wpt-pr: 15740
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 23, 2019
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 4, 2019
…ements', a=testonly

Automatic update from web-platform-tests
Add tests for form-associated custom elements

This is for WICG/webcomponents#187.

Specification PR: whatwg/html#4383.
--

wp5At-commits: 3ccd79e32ced5ddab58f52e79f982d2ebfc7f98c
wpt-pr: 15740

UltraBlame original commit: 10764d9717ef7db00aa99d016a50f282e0d9d7b1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 4, 2019
…ements', a=testonly

Automatic update from web-platform-tests
Add tests for form-associated custom elements

This is for WICG/webcomponents#187.

Specification PR: whatwg/html#4383.
--

wp5At-commits: 3ccd79e32ced5ddab58f52e79f982d2ebfc7f98c
wpt-pr: 15740

UltraBlame original commit: 10764d9717ef7db00aa99d016a50f282e0d9d7b1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…ements', a=testonly

Automatic update from web-platform-tests
Add tests for form-associated custom elements

This is for WICG/webcomponents#187.

Specification PR: whatwg/html#4383.
--

wp5At-commits: 3ccd79e32ced5ddab58f52e79f982d2ebfc7f98c
wpt-pr: 15740

UltraBlame original commit: 10764d9717ef7db00aa99d016a50f282e0d9d7b1
webkit-commit-queue pushed a commit to shvaikalesh/WebKit that referenced this pull request Jan 6, 2023
https://bugs.webkit.org/show_bug.cgi?id=197963

Reviewed by Ryosuke Niwa.

This change implements form-associated custom elements as per spec [1], with exception of
formStateRestoreCallback() being called for autofill and support of File interface
for saving / restoring state.

For not yet upgraded custom elements to become fully operational form controls if
their interface gets defined as form-associated, HTMLMaybeFormAssociatedCustomElement
class has beed introduced.

To avoid severe memory bloat for all custom elements, HTMLMaybeFormAssociatedCustomElement
keeps its form-associated internals in ElementRareData, initializing only on demand.

That internal data is a subclass of ValidatedFormListedElement, which was extracted from
HTMLFormControlElement to include only the logic relevant to both native and custom element
form controls, such as constraint validation, watching disabled state, "readonly" attribute,
and error reporting.

Since HTMLFormControlElementWithState used to extend HTMLFormControlElement, and with this
change form-associated custom elements can also have state, it has been merged into
ValidatedFormListedElement, with exception of the insertionIndex() method, which was removed
to avoid increasing sizeof(HTMLButtonElement).

insertionIndex() wasn't actually necessary (DOM order is sufficient), and the sorting by `formKey`
was refactored using a HashMap. Another important change is in form signature generator: we need
to account for not yet upgraded, potentially form-associated custom elements, otherwise signatures
for the same <form> won't match, hence the introduction of shouldBeUsedForFormSignature().

Per spec, ElementInternals can only be attached in "precustomized" or "custom" state [2],
but it's not clear whether or not its methods should throw in "error" state. This change
aligns WebKit with Firefox in this regard, arguing that if internals can't be attached in
given state, they shouldn't be operational.

During the upgrade, in the constructor, form-associated custom element has no notion of its
surroundings: its form owner, whether it's inside a <datalist> or disabled <fieldset>,
has a "readonly" attribute etc, so all that won't affect its `willValidate` / `validity`.
That is pretty sensible given the best practices for authoring custom elements forbid DOM
access in constructor to support `new XFoo()` usage.

This detail greatly reduces fragility: by delaying form-association until the "custom"
state, we ensure that once an element becomes "form listed", it will never roll back,
which we assert multiple times in HTMLFormElement.cpp.

However, if an author performs setValidity() in the constructor, that will work as expected.
Aligns WebKit with Blink and partly Firefox; the spec in unclear.

[1] whatwg/html#4383
[2] https://html.spec.whatwg.org/multipage/custom-elements.html#dom-attachinternals

* LayoutTests/fast/forms/state-restore-per-form-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-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-labels.html:
* 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/ElementInternals-validation.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/fieldset-elements-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/form-associated/form-elements-namedItem-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-reset-callback-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/label-delegatesFocus-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/upgrading/*: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isShowingValidationMessage const):
(WebCore::AccessibilityObject::validationMessage const):
* Source/WebCore/bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::createElement):
(WebCore::JSCustomElementInterface::upgradeElement):
(WebCore::JSCustomElementInterface::invokeFormAssociatedCallback):
(WebCore::JSCustomElementInterface::invokeFormResetCallback):
(WebCore::JSCustomElementInterface::invokeFormDisabledCallback):
(WebCore::JSCustomElementInterface::invokeFormStateRestoreCallback):
* Source/WebCore/bindings/js/JSCustomElementInterface.h:
(WebCore::JSCustomElementInterface::isFormAssociated const):
(WebCore::JSCustomElementInterface::hasFormAssociatedCallback const):
(WebCore::JSCustomElementInterface::hasFormResetCallback const):
(WebCore::JSCustomElementInterface::hasFormDisabledCallback const):
(WebCore::JSCustomElementInterface::hasFormStateRestoreCallback const):
* Source/WebCore/bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement):
(WebCore::JSHTMLElement::pushEventHandlerScope const):
* Source/WebCore/css/SelectorCheckerTestFunctions.h:
(WebCore::matchesUserInvalidPseudoClass):
(WebCore::matchesUserValidPseudoClass):
* Source/WebCore/dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem):
(WebCore::CustomElementReactionQueueItem::invoke):
(WebCore::CustomElementReactionQueue::enqueueFormAssociatedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormResetCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormDisabledCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormStateRestoreCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::isFormAssociated const):
* Source/WebCore/dom/CustomElementReactionQueue.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::createUpgradeCandidateElement):
(WebCore::createFallbackHTMLElement):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isFormAssociatedCustomElement const):
(WebCore::Element::canAccessFormAssociatedInternals const):
(WebCore::Element::asFormListedElement):
(WebCore::Element::asValidatedFormListedElement):
(WebCore::Element::ensureFormAssociatedCustomElement):
(WebCore::Element::matchesUserValidPseudoClass const):
(WebCore::Element::matchesUserInvalidPseudoClass const):
* Source/WebCore/dom/Element.h:
(WebCore::Element::isFormListedElement const):
(WebCore::Element::isValidatedFormListedElement const):
(WebCore::Element::isMaybeFormAssociatedCustomElement const):
(WebCore::Element::isFormControlElementWithState const): Deleted.
* Source/WebCore/dom/ElementInternals.cpp:
(WebCore::ElementInternals::form const):
(WebCore::ElementInternals::setFormValue):
(WebCore::ElementInternals::setValidity):
(WebCore::ElementInternals::willValidate):
(WebCore::ElementInternals::validity):
(WebCore::ElementInternals::validationMessage):
(WebCore::ElementInternals::reportValidity):
(WebCore::ElementInternals::checkValidity):
(WebCore::ElementInternals::labels):
* Source/WebCore/dom/ElementInternals.h:
* Source/WebCore/dom/ElementInternals.idl:
* Source/WebCore/dom/ElementRareData.cpp:
* Source/WebCore/dom/ElementRareData.h:
(WebCore::ElementRareData::formAssociatedCustomElement):
(WebCore::ElementRareData::setFormAssociatedCustomElement):
(WebCore::ElementRareData::useTypes const):
* Source/WebCore/dom/NodeRareData.h:
* Source/WebCore/dom/ValidityStateFlags.h: Copied from Source/WebCore/dom/ElementInternals.h.
(WebCore::ValidityStateFlags::isValid const):
* Source/WebCore/dom/ValidityStateFlags.idl: Copied from Source/WebCore/dom/ElementInternals.h.
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::scanForForm):
(WebCore::findFormControlElementAncestor):
(WebCore::FrameSelection::currentForm const):
* Source/WebCore/html/FormAssociatedCustomElement.cpp: Added.
(WebCore::FormAssociatedCustomElement::FormAssociatedCustomElement):
(WebCore::FormAssociatedCustomElement::create):
(WebCore::FormAssociatedCustomElement::setValidity):
(WebCore::FormAssociatedCustomElement::validationMessage const):
(WebCore::cloneFormDataIfNeccessary):
(WebCore::FormAssociatedCustomElement::setFormValue):
(WebCore::FormAssociatedCustomElement::anchorElement):
(WebCore::FormAssociatedCustomElement::computeValidity const):
(WebCore::FormAssociatedCustomElement::appendFormData):
(WebCore::FormAssociatedCustomElement::formWillBeDestroyed):
(WebCore::FormAssociatedCustomElement::reset):
(WebCore::FormAssociatedCustomElement::disabledStateChanged):
(WebCore::FormAssociatedCustomElement::didChangeForm):
(WebCore::FormAssociatedCustomElement::didUpgrade):
(WebCore::FormAssociatedCustomElement::invalidateElementsCollectionCachesInAncestors):
(WebCore::FormAssociatedCustomElement::formControlType const):
(WebCore::FormAssociatedCustomElement::saveFormControlState const):
(WebCore::FormAssociatedCustomElement::restoreFormControlState):
* Source/WebCore/html/FormAssociatedCustomElement.h: Added.
* Source/WebCore/html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::ref const):
(WebCore::FormAssociatedElement::deref const):
(WebCore::FormAssociatedElement::ref): Deleted.
(WebCore::FormAssociatedElement::deref): Deleted.
* Source/WebCore/html/FormController.cpp:
(WebCore::ownerForm):
(WebCore::formSignature):
(WebCore::FormController::FormKeyGenerator::formKey):
(WebCore::FormController::formElementsState const):
(WebCore::FormController::takeStateForFormElement):
(WebCore::FormController::restoreControlStateFor):
(WebCore::FormController::restoreControlStateIn):
* Source/WebCore/html/FormController.h:
* Source/WebCore/html/FormListedElement.cpp:
(WebCore::FormListedElement::didMoveToNewDocument):
(WebCore::FormListedElement::resetFormOwner):
(WebCore::FormListedElement::parseAttribute):
(WebCore::FormListedElement::parseFormAttribute):
(WebCore::FormListedElement::formAttributeChanged): Deleted.
(WebCore::FormListedElement::isFormControlElementWithState const): Deleted.
* Source/WebCore/html/FormListedElement.h:
(WebCore::FormListedElement::clearForm):
(): Deleted.
* Source/WebCore/html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::canBeActuallyDisabled const):
(WebCore::HTMLElement::form const): Deleted.
(WebCore::HTMLElement::asFormListedElement): Deleted.
* Source/WebCore/html/HTMLElement.h:
* Source/WebCore/html/HTMLFieldSetElement.cpp:
(WebCore::firstFormControlElementWithin):
(WebCore::nextFormControlElementSkippingChildren):
(WebCore::nextFormControlElement):
(WebCore::updateFromControlElementsAncestorDisabledStateUnder):
(WebCore::HTMLFieldSetElement::addInvalidDescendant):
(WebCore::HTMLFieldSetElement::removeInvalidDescendant):
* Source/WebCore/html/HTMLFieldSetElement.h:
* Source/WebCore/html/HTMLFieldSetElement.idl:
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::HTMLFormControlElement):
(WebCore::HTMLFormControlElement::parseAttribute):
(WebCore::HTMLFormControlElement::disabledStateChanged):
(WebCore::HTMLFormControlElement::readOnlyStateChanged):
(WebCore::HTMLFormControlElement::didFinishInsertingNode):
(WebCore::HTMLFormControlElement::didMoveToNewDocument):
(WebCore::HTMLFormControlElement::finishParsingChildren):
(WebCore::HTMLFormControlElement::insertedIntoAncestor):
(WebCore::HTMLFormControlElement::removedFromAncestor):
(WebCore::HTMLFormControlElement::~HTMLFormControlElement): Deleted.
(WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const): Deleted.
(WebCore::HTMLFormControlElement::setAncestorDisabled): Deleted.
(WebCore::HTMLFormControlElement::disabledAttributeChanged): Deleted.
(WebCore::addInvalidElementToAncestorFromInsertionPoint): Deleted.
(WebCore::removeInvalidElementToAncestorFromInsertionPoint): Deleted.
(WebCore::HTMLFormControlElement::setInteractedWithSinceLastFormSubmitEvent): Deleted.
(WebCore::HTMLFormControlElement::supportsFocus const): Deleted.
(WebCore::HTMLFormControlElement::matchesValidPseudoClass const): Deleted.
(WebCore::HTMLFormControlElement::matchesInvalidPseudoClass const): Deleted.
(WebCore::HTMLFormControlElement::endDelayingUpdateValidity): Deleted.
(WebCore::HTMLFormControlElement::computeWillValidate const): Deleted.
(WebCore::HTMLFormControlElement::willValidate const): Deleted.
(WebCore::HTMLFormControlElement::updateWillValidateAndValidity): Deleted.
(WebCore::HTMLFormControlElement::updateVisibleValidationMessage): Deleted.
(WebCore::HTMLFormControlElement::hideVisibleValidationMessage): Deleted.
(WebCore::HTMLFormControlElement::checkValidity): Deleted.
(WebCore::HTMLFormControlElement::isFocusingWithValidationMessage const): Deleted.
(WebCore::HTMLFormControlElement::isShowingValidationMessage const): Deleted.
(WebCore::HTMLFormControlElement::reportValidity): Deleted.
(WebCore::HTMLFormControlElement::focusAndShowValidationMessage): Deleted.
(WebCore::HTMLFormControlElement::isValidFormControlElement const): Deleted.
(WebCore::HTMLFormControlElement::willChangeForm): Deleted.
(WebCore::HTMLFormControlElement::didChangeForm): Deleted.
(WebCore::HTMLFormControlElement::updateValidity): Deleted.
(WebCore::HTMLFormControlElement::setCustomValidity): Deleted.
(WebCore::HTMLFormControlElement::validationMessageShadowTreeContains const): Deleted.
(WebCore::HTMLFormControlElement::matchesUserInvalidPseudoClass const): Deleted.
(WebCore::HTMLFormControlElement::matchesUserValidPseudoClass const): Deleted.
* Source/WebCore/html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::isReadOnly const):
(WebCore::HTMLFormControlElement::isMutable const):
(WebCore::HTMLFormControlElement::reset): Deleted.
(WebCore::HTMLFormControlElement::wasInteractedWithSinceLastFormSubmitEvent const): Deleted.
(WebCore::HTMLFormControlElement::supportsReadOnly const): Deleted.
(WebCore::HTMLFormControlElement::disabledByAncestorFieldset const): Deleted.
(WebCore::HTMLFormControlElement::startDelayingUpdateValidity): Deleted.
(WebCore::DelayedUpdateValidityScope::DelayedUpdateValidityScope): Deleted.
(WebCore::DelayedUpdateValidityScope::~DelayedUpdateValidityScope): Deleted.
* Source/WebCore/html/HTMLFormControlElementWithState.cpp: Removed.
* Source/WebCore/html/HTMLFormControlElementWithState.h: Removed.
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::validateInteractively):
(WebCore::HTMLFormElement::resetListedFormControlElements):
(WebCore::HTMLFormElement::shouldAutocorrect const):
(WebCore::HTMLFormElement::formElementIndex):
(WebCore::HTMLFormElement::addInvalidFormControl):
(WebCore::HTMLFormElement::removeInvalidFormControlIfNeeded):
(WebCore::HTMLFormElement::checkValidity):
(WebCore::HTMLFormElement::checkInvalidControlsAndCollectUnhandled):
(WebCore::HTMLFormElement::assertItemCanBeInPastNamesMap const):
(WebCore::HTMLFormElement::copyValidatedListedElementsVector const):
* Source/WebCore/html/HTMLFormElement.h:
* Source/WebCore/html/HTMLFormElement.idl:
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::shouldSaveAndRestoreFormControlState const):
* Source/WebCore/html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::form const):
* Source/WebCore/html/HTMLLabelElement.h:
* Source/WebCore/html/HTMLLegendElement.h:
* Source/WebCore/html/HTMLMaybeFormAssociatedCustomElement.cpp: Added.
(WebCore::HTMLMaybeFormAssociatedCustomElement::HTMLMaybeFormAssociatedCustomElement):
(WebCore::HTMLMaybeFormAssociatedCustomElement::create):
(WebCore::HTMLMaybeFormAssociatedCustomElement::isFormListedElement const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::isValidatedFormListedElement const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::asFormAssociatedElement):
(WebCore::HTMLMaybeFormAssociatedCustomElement::asFormListedElement):
(WebCore::HTMLMaybeFormAssociatedCustomElement::asValidatedFormListedElement):
(WebCore::HTMLMaybeFormAssociatedCustomElement::asFormAssociatedCustomElement):
(WebCore::HTMLMaybeFormAssociatedCustomElement::matchesValidPseudoClass const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::matchesInvalidPseudoClass const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::matchesUserValidPseudoClass const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::matchesUserInvalidPseudoClass const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::supportsFocus const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::supportLabels const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::isDisabledFormControl const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::impl const):
(WebCore::HTMLMaybeFormAssociatedCustomElement::finishParsingChildren):
(WebCore::HTMLMaybeFormAssociatedCustomElement::didFinishInsertingNode):
(WebCore::HTMLMaybeFormAssociatedCustomElement::didMoveToNewDocument):
(WebCore::HTMLMaybeFormAssociatedCustomElement::insertedIntoAncestor):
(WebCore::HTMLMaybeFormAssociatedCustomElement::removedFromAncestor):
(WebCore::HTMLMaybeFormAssociatedCustomElement::parseAttribute):
(WebCore::HTMLMaybeFormAssociatedCustomElement::didUpgrade):
* Source/WebCore/html/HTMLMaybeFormAssociatedCustomElement.h: Added.
(isType):
* Source/WebCore/html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parseAttribute):
(WebCore::HTMLObjectElement::didMoveToNewDocument):
* Source/WebCore/html/HTMLObjectElement.h:
* Source/WebCore/html/HTMLOptionElement.h:
* Source/WebCore/html/HTMLSelectElement.cpp:
* Source/WebCore/html/HTMLSelectElement.h:
* Source/WebCore/html/HTMLTextAreaElement.h:
* Source/WebCore/html/HTMLTextFormControlElement.cpp:
* Source/WebCore/html/HTMLTextFormControlElement.h:
* Source/WebCore/html/RadioNodeList.cpp:
(WebCore::RadioNodeList::elementMatches const):
* Source/WebCore/html/ValidatedFormListedElement.cpp: Added.
(WebCore::ValidatedFormListedElement::ValidatedFormListedElement):
(WebCore::ValidatedFormListedElement::~ValidatedFormListedElement):
(WebCore::ValidatedFormListedElement::willValidate const):
(WebCore::ValidatedFormListedElement::computeWillValidate const):
(WebCore::ValidatedFormListedElement::updateVisibleValidationMessage):
(WebCore::ValidatedFormListedElement::hideVisibleValidationMessage):
(WebCore::ValidatedFormListedElement::checkValidity):
(WebCore::ValidatedFormListedElement::reportValidity):
(WebCore::ValidatedFormListedElement::focusableAnchorElementForValidationMessage):
(WebCore::ValidatedFormListedElement::focusAndShowValidationMessage):
(WebCore::ValidatedFormListedElement::reportNonFocusableControlError):
(WebCore::ValidatedFormListedElement::isShowingValidationMessage const):
(WebCore::ValidatedFormListedElement::validationMessageShadowTreeContains const):
(WebCore::ValidatedFormListedElement::isFocusingWithValidationMessage const):
(WebCore::ValidatedFormListedElement::setAncestorDisabled):
(WebCore::addInvalidElementToAncestorFromInsertionPoint):
(WebCore::removeInvalidElementToAncestorFromInsertionPoint):
(WebCore::ValidatedFormListedElement::updateValidity):
(WebCore::ValidatedFormListedElement::parseAttribute):
(WebCore::ValidatedFormListedElement::parseDisabledAttribute):
(WebCore::ValidatedFormListedElement::parseReadonlyAttribute):
(WebCore::ValidatedFormListedElement::disabledAttributeChanged):
(WebCore::ValidatedFormListedElement::insertedIntoAncestor):
(WebCore::ValidatedFormListedElement::resetDataListAncestorState):
(WebCore::ValidatedFormListedElement::syncWithFieldsetAncestors):
(WebCore::ValidatedFormListedElement::removedFromAncestor):
(WebCore::ValidatedFormListedElement::computeIsDisabledByFieldsetAncestor const):
(WebCore::ValidatedFormListedElement::willChangeForm):
(WebCore::ValidatedFormListedElement::didChangeForm):
(WebCore::ValidatedFormListedElement::disabledStateChanged):
(WebCore::ValidatedFormListedElement::readOnlyStateChanged):
(WebCore::ValidatedFormListedElement::updateWillValidateAndValidity):
(WebCore::ValidatedFormListedElement::didFinishInsertingNode):
(WebCore::ValidatedFormListedElement::setCustomValidity):
(WebCore::ValidatedFormListedElement::endDelayingUpdateValidity):
(WebCore::ValidatedFormListedElement::isCandidateForSavingAndRestoringState const):
(WebCore::ValidatedFormListedElement::shouldAutocomplete const):
(WebCore::ValidatedFormListedElement::saveFormControlState const):
(WebCore::ValidatedFormListedElement::finishParsingChildren):
(WebCore::ValidatedFormListedElement::matchesValidPseudoClass const):
(WebCore::ValidatedFormListedElement::matchesInvalidPseudoClass const):
(WebCore::ValidatedFormListedElement::matchesUserInvalidPseudoClass const):
(WebCore::ValidatedFormListedElement::matchesUserValidPseudoClass const):
(WebCore::ValidatedFormListedElement::setInteractedWithSinceLastFormSubmitEvent):
* Source/WebCore/html/ValidatedFormListedElement.h: Added.
(WebCore::ValidatedFormListedElement::reset):
(WebCore::ValidatedFormListedElement::supportsReadOnly const):
(WebCore::ValidatedFormListedElement::isDisabled const):
(WebCore::ValidatedFormListedElement::hasReadOnlyAttribute const):
(WebCore::ValidatedFormListedElement::isValidFormControlElement const):
(WebCore::ValidatedFormListedElement::wasInteractedWithSinceLastFormSubmitEvent const):
(WebCore::ValidatedFormListedElement::shouldSaveAndRestoreFormControlState const):
(WebCore::ValidatedFormListedElement::restoreFormControlState):
(WebCore::ValidatedFormListedElement::disabledByAncestorFieldset const):
(WebCore::ValidatedFormListedElement::startDelayingUpdateValidity):
(WebCore::DelayedUpdateValidityScope::DelayedUpdateValidityScope):
(WebCore::DelayedUpdateValidityScope::~DelayedUpdateValidityScope):
* Source/WebCore/html/ValidationMessage.cpp:
(WebCore::ValidationMessage::ValidationMessage):
(WebCore::ValidationMessage::updateValidationMessage):
* Source/WebCore/html/ValidationMessage.h:
* Source/WebCore/html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::searchForLabelsBeforeElement):
* Source/WebCore/style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):

Canonical link: https://commits.webkit.org/258561@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: custom elements Relates to custom elements (as defined in DOM and HTML) topic: forms
Development

Successfully merging this pull request may close these issues.

Need callback for form submit data
7 participants