-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readonly attribute should only apply on certain input types
https://bugs.webkit.org/show_bug.cgi?id=240343 <rdar://93173726> Reviewed by Chris Dumez. We should only apply the readonly attribute on certain input types: https://html.spec.whatwg.org/multipage/input.html#do-not-apply Except in the constraint validation case (willValidate) for compat reasons, since it affects the :in-range/:out-of-range pseudo-classes, the relevant test has been updated to reflect that. This also was the resolution of whatwg/html#8133 in the HTML spec triage meeting. Also introduce isMutable() which corresponds to the spec concept of mutable form control. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: Added. * Source/WebCore/html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::valueMissing const): (WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent): * Source/WebCore/html/ColorInputType.cpp: (WebCore::ColorInputType::isKeyboardFocusable const): * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::HTMLFormControlElement): (WebCore::HTMLFormControlElement::parseAttribute): (WebCore::HTMLFormControlElement::computeWillValidate const): * Source/WebCore/html/HTMLFormControlElement.h: (WebCore::HTMLFormControlElement::supportsReadOnly const): (WebCore::HTMLFormControlElement::isReadOnly const): (WebCore::HTMLFormControlElement::isMutable const): (WebCore::HTMLFormControlElement::isDisabledOrReadOnly const): Deleted. * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): (WebCore::HTMLInputElement::supportsReadOnly const): (WebCore::HTMLInputElement::showPicker): (WebCore::HTMLInputElement::matchesReadWritePseudoClass const): (WebCore::HTMLInputElement::createInnerTextStyle): * Source/WebCore/html/HTMLInputElement.h: * Source/WebCore/html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass const): * Source/WebCore/html/HTMLTextAreaElement.h: * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const): * Source/WebCore/html/SearchInputType.cpp: (WebCore::SearchInputType::handleKeydownEvent): * Source/WebCore/html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::valueMissing const): (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents const): (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): (WebCore::TextFieldInputType::shouldDrawAutoFillButton const): * Source/WebCore/html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::handleTouchEvent): * Source/WebCore/html/shadow/TextControlInnerElements.cpp: (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEventsWithEditability const): Canonical link: https://commits.webkit.org/253321@main
- Loading branch information
Showing
18 changed files
with
112 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
46 changes: 46 additions & 0 deletions
46
...m-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
PASS input[type=button] showPicker() throws when disabled | ||
PASS input[type=checkbox] showPicker() throws when disabled | ||
PASS input[type=color] showPicker() throws when disabled | ||
PASS input[type=date] showPicker() throws when disabled | ||
PASS input[type=datetime-local] showPicker() throws when disabled | ||
PASS input[type=email] showPicker() throws when disabled | ||
PASS input[type=file] showPicker() throws when disabled | ||
PASS input[type=hidden] showPicker() throws when disabled | ||
PASS input[type=image] showPicker() throws when disabled | ||
PASS input[type=month] showPicker() throws when disabled | ||
PASS input[type=number] showPicker() throws when disabled | ||
PASS input[type=password] showPicker() throws when disabled | ||
PASS input[type=radio] showPicker() throws when disabled | ||
PASS input[type=range] showPicker() throws when disabled | ||
PASS input[type=reset] showPicker() throws when disabled | ||
PASS input[type=search] showPicker() throws when disabled | ||
PASS input[type=submit] showPicker() throws when disabled | ||
PASS input[type=tel] showPicker() throws when disabled | ||
PASS input[type=text] showPicker() throws when disabled | ||
PASS input[type=time] showPicker() throws when disabled | ||
PASS input[type=url] showPicker() throws when disabled | ||
PASS input[type=week] showPicker() throws when disabled | ||
PASS input[type=button] showPicker() doesn't throw when readonly | ||
PASS input[type=checkbox] showPicker() doesn't throw when readonly | ||
FAIL input[type=color] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0 | ||
PASS input[type=date] showPicker() throws when readonly | ||
PASS input[type=datetime-local] showPicker() throws when readonly | ||
PASS input[type=email] showPicker() throws when readonly | ||
PASS input[type=file] showPicker() doesn't throw when readonly | ||
PASS input[type=hidden] showPicker() doesn't throw when readonly | ||
PASS input[type=image] showPicker() doesn't throw when readonly | ||
PASS input[type=month] showPicker() throws when readonly | ||
PASS input[type=number] showPicker() throws when readonly | ||
PASS input[type=password] showPicker() throws when readonly | ||
PASS input[type=radio] showPicker() doesn't throw when readonly | ||
PASS input[type=range] showPicker() doesn't throw when readonly | ||
PASS input[type=reset] showPicker() doesn't throw when readonly | ||
PASS input[type=search] showPicker() throws when readonly | ||
PASS input[type=submit] showPicker() doesn't throw when readonly | ||
PASS input[type=tel] showPicker() throws when readonly | ||
PASS input[type=text] showPicker() throws when readonly | ||
PASS input[type=time] showPicker() throws when readonly | ||
PASS input[type=url] showPicker() throws when readonly | ||
PASS input[type=week] showPicker() throws when readonly | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.