haikuwebkit/LayoutTests/fast/forms/inputmode-attribute-textare...

48 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

[iOS] Support the inputmode attribute on contenteditable elements https://bugs.webkit.org/show_bug.cgi?id=188878 Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/html/dom/reflection-misc-expected.txt: Rebaseline. Source/WebCore: The inputmode attribute should apply to contenteditable elements, in addition to textfield inputs and textareas. Moved the inputmode attribute from HTMLInputElement.idl and HTMLTextAreaElement.idl to HTMLElement.idl to reflect the specification. Also moved all logic to convert between the InputMode enum and string values into InputMode.cpp to avoid exposing unnecessary details to WebKit. Furthermore, InputMode::Auto was renamed to InputMode::Unspecified to avoid confusion with the specification. Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute Tests: fast/forms/inputmode-attribute-contenteditable.html fast/forms/inputmode-attribute-input.html fast/forms/inputmode-attribute-textarea.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * html/HTMLElement.cpp: (WebCore::HTMLElement::canonicalInputMode const): (WebCore::HTMLElement::inputMode const): (WebCore::HTMLElement::setInputMode): * html/HTMLElement.h: * html/HTMLElement.idl: * html/HTMLInputElement.idl: * html/HTMLTextAreaElement.idl: * html/HTMLTextFormControlElement.cpp: * html/HTMLTextFormControlElement.h: * html/InputMode.cpp: Renamed from Source/WebCore/html/InputModeNames.cpp. (WebCore::inputModeForAttributeValue): (WebCore::stringForInputMode): * html/InputMode.h: Renamed from Source/WebCore/html/InputModeNames.h. Source/WebKit: Ensured that the assistedNodeInformation for a contenteditable element reflects the value of the element's inputmode attribute. Moved logic to obtain the InputMode from the attribute value into WebCore. * Shared/AssistedNodeInformation.h: * UIProcess/ios/WKContentViewInteraction.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getAssistedNodeInformation): LayoutTests: Added additional tests to verify the inputmode attribute is accessible on HTMLElements. * fast/forms/inputmode-attribute-contenteditable-expected.txt: Added. * fast/forms/inputmode-attribute-contenteditable.html: Added. * fast/forms/inputmode-attribute-input-expected.txt: Renamed from LayoutTests/fast/forms/inputmode-attribute-expected.txt. * fast/forms/inputmode-attribute-input.html: Renamed from LayoutTests/fast/forms/inputmode-attribute.html. * fast/forms/inputmode-attribute-textarea-expected.txt: Added. * fast/forms/inputmode-attribute-textarea.html: Added. * js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaseline. Canonical link: https://commits.webkit.org/203950@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-23 21:24:42 +00:00
Test inputmode attribute on textarea
Missing value default:
PASS textarea.inputMode is ""
PASS textarea.getAttribute("inputmode") is null
Invalid value default:
PASS textarea.inputMode = "foobar"; textarea.inputMode is ""
PASS textarea.getAttribute("inputmode") is "foobar"
PASS textarea.setAttribute("inputmode", "baz"); textarea.inputMode is ""
Valid values:
[iOS] Support inputmode=none https://bugs.webkit.org/show_bug.cgi?id=188896 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/html/dom/reflection-misc-expected.txt: Rebaseline. Source/WebCore: Updated InputMode.cpp to ensure that "none" is recognized as a valid value for the inputmode attribute. This keyword is useful for content that renders its own keyboard control. Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities%3A-the-inputmode-attribute Test: fast/forms/ios/inputmode-none.html * html/InputMode.cpp: (WebCore::inputModeForAttributeValue): (WebCore::stringForInputMode): (WebCore::InputModeNames::none): * html/InputMode.h: Source/WebKit: inputmode=none is used by content that renders its own keyboard control. Consequently, we should not display the virtual keyboard when a user interacts with an element that has the inputmode attribute set to the "none" value. In order to achieve this behavior, we return a UIView with a bounds of CGRectZero as the inputView of the WKContentView when inputmode=none is present. Furthermore, we do not provide an accessory view in this case. Updated the logic that zooms and scrolls to a control when it gains focus, as that behavior currently relies on an accessory view being present. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _displayFormNodeInputView]): (-[WKContentView inputView]): (-[WKContentView requiresAccessoryView]): (-[WKContentView textInputTraits]): LayoutTests: Added new test to verify that the system keyboard does not show for inputs with inputmode=none. Updated existing inputmode tests to reflect the addition of the "none" value. * fast/forms/inputmode-attribute-contenteditable-expected.txt: * fast/forms/inputmode-attribute-contenteditable.html: * fast/forms/inputmode-attribute-input-expected.txt: * fast/forms/inputmode-attribute-input.html: * fast/forms/inputmode-attribute-textarea-expected.txt: * fast/forms/inputmode-attribute-textarea.html: * fast/forms/ios/inputmode-none-expected.txt: Added. * fast/forms/ios/inputmode-none.html: Added. * resources/ui-helper.js: (window.UIHelper.activateFormControl): (window.UIHelper.inputViewBounds): Canonical link: https://commits.webkit.org/204080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235426 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-28 16:34:25 +00:00
PASS textarea.inputMode = "none"; textarea.inputMode is "none"
PASS textarea.getAttribute("inputmode") is "none"
PASS textarea.setAttribute("inputmode", "none"); textarea.inputMode is "none"
[iOS] Support the inputmode attribute on contenteditable elements https://bugs.webkit.org/show_bug.cgi?id=188878 Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/html/dom/reflection-misc-expected.txt: Rebaseline. Source/WebCore: The inputmode attribute should apply to contenteditable elements, in addition to textfield inputs and textareas. Moved the inputmode attribute from HTMLInputElement.idl and HTMLTextAreaElement.idl to HTMLElement.idl to reflect the specification. Also moved all logic to convert between the InputMode enum and string values into InputMode.cpp to avoid exposing unnecessary details to WebKit. Furthermore, InputMode::Auto was renamed to InputMode::Unspecified to avoid confusion with the specification. Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute Tests: fast/forms/inputmode-attribute-contenteditable.html fast/forms/inputmode-attribute-input.html fast/forms/inputmode-attribute-textarea.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * html/HTMLElement.cpp: (WebCore::HTMLElement::canonicalInputMode const): (WebCore::HTMLElement::inputMode const): (WebCore::HTMLElement::setInputMode): * html/HTMLElement.h: * html/HTMLElement.idl: * html/HTMLInputElement.idl: * html/HTMLTextAreaElement.idl: * html/HTMLTextFormControlElement.cpp: * html/HTMLTextFormControlElement.h: * html/InputMode.cpp: Renamed from Source/WebCore/html/InputModeNames.cpp. (WebCore::inputModeForAttributeValue): (WebCore::stringForInputMode): * html/InputMode.h: Renamed from Source/WebCore/html/InputModeNames.h. Source/WebKit: Ensured that the assistedNodeInformation for a contenteditable element reflects the value of the element's inputmode attribute. Moved logic to obtain the InputMode from the attribute value into WebCore. * Shared/AssistedNodeInformation.h: * UIProcess/ios/WKContentViewInteraction.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getAssistedNodeInformation): LayoutTests: Added additional tests to verify the inputmode attribute is accessible on HTMLElements. * fast/forms/inputmode-attribute-contenteditable-expected.txt: Added. * fast/forms/inputmode-attribute-contenteditable.html: Added. * fast/forms/inputmode-attribute-input-expected.txt: Renamed from LayoutTests/fast/forms/inputmode-attribute-expected.txt. * fast/forms/inputmode-attribute-input.html: Renamed from LayoutTests/fast/forms/inputmode-attribute.html. * fast/forms/inputmode-attribute-textarea-expected.txt: Added. * fast/forms/inputmode-attribute-textarea.html: Added. * js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaseline. Canonical link: https://commits.webkit.org/203950@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-23 21:24:42 +00:00
PASS textarea.inputMode = "text"; textarea.inputMode is "text"
PASS textarea.getAttribute("inputmode") is "text"
PASS textarea.setAttribute("inputmode", "text"); textarea.inputMode is "text"
PASS textarea.inputMode = "tel"; textarea.inputMode is "tel"
PASS textarea.getAttribute("inputmode") is "tel"
PASS textarea.setAttribute("inputmode", "tel"); textarea.inputMode is "tel"
PASS textarea.inputMode = "url"; textarea.inputMode is "url"
PASS textarea.getAttribute("inputmode") is "url"
PASS textarea.setAttribute("inputmode", "url"); textarea.inputMode is "url"
PASS textarea.inputMode = "email"; textarea.inputMode is "email"
PASS textarea.getAttribute("inputmode") is "email"
PASS textarea.setAttribute("inputmode", "email"); textarea.inputMode is "email"
PASS textarea.inputMode = "numeric"; textarea.inputMode is "numeric"
PASS textarea.getAttribute("inputmode") is "numeric"
PASS textarea.setAttribute("inputmode", "numeric"); textarea.inputMode is "numeric"
PASS textarea.inputMode = "decimal"; textarea.inputMode is "decimal"
PASS textarea.getAttribute("inputmode") is "decimal"
PASS textarea.setAttribute("inputmode", "decimal"); textarea.inputMode is "decimal"
PASS textarea.inputMode = "search"; textarea.inputMode is "search"
PASS textarea.getAttribute("inputmode") is "search"
PASS textarea.setAttribute("inputmode", "search"); textarea.inputMode is "search"
Valid case-insensitive values:
PASS textarea.inputMode = "tExt"; textarea.inputMode is "text"
PASS textarea.getAttribute("inputmode") is "tExt"
PASS textarea.setAttribute("inputmode", "tExt"); textarea.inputMode is "text"
PASS successfullyParsed is true
TEST COMPLETE