WebKit Bugzilla
Attachment 347898 Details for
Bug 188878
: [iOS] Support the inputmode attribute on contenteditable elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188878-20180822221404.patch (text/plain), 36.15 KB, created by
Aditya Keerthi
on 2018-08-22 22:14:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Aditya Keerthi
Created:
2018-08-22 22:14:05 PDT
Size:
36.15 KB
patch
obsolete
>Subversion Revision: 235210 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 552c69fa9884a3b9cd5979d16bd5c9150ac5efc0..64dc18f386ed5b5e4c1ba870293cdc18d50ea4ba 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2018-08-22 Aditya Keerthi <akeerthi@apple.com> >+ >+ [iOS] Support the inputmode attribute on contenteditable elements >+ https://bugs.webkit.org/show_bug.cgi?id=188878 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ >+ Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute >+ >+ * 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. >+ > 2018-08-22 Jiewen Tan <jiewen_tan@apple.com> > > Unreviewed, update "Web Authentication" from "Under Consideration" to "In Development" >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e857b72aa61132c923759670008bc2529f8deb25..8a68fdb169b2525ec16f38fe01a2bf8d9584f164 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2018-08-22 Aditya Keerthi <akeerthi@apple.com> >+ >+ [iOS] Support the inputmode attribute on contenteditable elements >+ https://bugs.webkit.org/show_bug.cgi?id=188878 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ > 2018-08-22 John Wilander <wilander@apple.com> > > The Storage Access API prompt should show the eTLD+1s, not the full host names >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 819a5d298aab733f6795d67b606cb08417669a18..5ea1925d8aa19207d31a7a4e4f8df928ac5b5ca6 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1056,7 +1056,7 @@ html/ImageBitmap.cpp > html/ImageData.cpp > html/ImageDocument.cpp > html/ImageInputType.cpp >-html/InputModeNames.cpp >+html/InputMode.cpp > html/InputType.cpp > html/InputTypeNames.cpp > html/LabelableElement.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index b0c2b0cd15a0f224cb09906b2290cae16eda4b6c..d306a6394054fa4a50b998685c09a41b9694ef68 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -4790,7 +4790,7 @@ > E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E517670220B88C1400D41167 /* DataListSuggestionInformation.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- E52EFDF42112875A00AD282A /* InputModeNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E52EFDF22112875A00AD282A /* InputModeNames.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ E52EFDF42112875A00AD282A /* InputMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E52EFDF22112875A00AD282A /* InputMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E58B45BA20AD07DD00991025 /* DataListButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E58B45B820AD07DD00991025 /* DataListButtonElement.h */; }; > E58B45BB20AD07DD00991025 /* DataListButtonElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */; }; > E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = E59DD4B721098285003C8B47 /* ListButtonArrow.png */; }; >@@ -14435,8 +14435,8 @@ > E526AF3E1727F8F200E41781 /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; }; > E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionsClient.h; sourceTree = "<group>"; }; > E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionPicker.h; sourceTree = "<group>"; }; >- E52EFDF22112875A00AD282A /* InputModeNames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InputModeNames.h; sourceTree = "<group>"; }; >- E52EFDF32112875A00AD282A /* InputModeNames.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InputModeNames.cpp; sourceTree = "<group>"; }; >+ E52EFDF22112875A00AD282A /* InputMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InputMode.h; sourceTree = "<group>"; }; >+ E52EFDF32112875A00AD282A /* InputMode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InputMode.cpp; sourceTree = "<group>"; }; > E55F4979151B888000BB67DB /* LengthFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthFunctions.cpp; sourceTree = "<group>"; }; > E58B45B820AD07DD00991025 /* DataListButtonElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListButtonElement.h; sourceTree = "<group>"; }; > E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DataListButtonElement.cpp; sourceTree = "<group>"; }; >@@ -20636,8 +20636,8 @@ > 97205AB21239291000B17380 /* ImageDocument.h */, > F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */, > F55B3D8E1251F12D003EF269 /* ImageInputType.h */, >- E52EFDF32112875A00AD282A /* InputModeNames.cpp */, >- E52EFDF22112875A00AD282A /* InputModeNames.h */, >+ E52EFDF32112875A00AD282A /* InputMode.cpp */, >+ E52EFDF22112875A00AD282A /* InputMode.h */, > 37E3524A12450C5200BAF5D9 /* InputType.cpp */, > 37E3524C12450C6600BAF5D9 /* InputType.h */, > C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */, >@@ -28269,7 +28269,7 @@ > 1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */, > 510A58E51BAA40B100C19282 /* InProcessIDBServer.h in Headers */, > 2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */, >- E52EFDF42112875A00AD282A /* InputModeNames.h in Headers */, >+ E52EFDF42112875A00AD282A /* InputMode.h in Headers */, > 37E3524D12450C6600BAF5D9 /* InputType.h in Headers */, > C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */, > 93309DEA099E64920056E581 /* InsertIntoTextNodeCommand.h in Headers */, >diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp >index 0934b1285bc646c08033f3dd7799c3c568309693..8336576bb473121264649bd7dfb2c9bc9efc051a 100644 >--- a/Source/WebCore/html/HTMLElement.cpp >+++ b/Source/WebCore/html/HTMLElement.cpp >@@ -1086,6 +1086,21 @@ void HTMLElement::setAutocorrect(bool autocorrect) > > #endif > >+InputMode HTMLElement::canonicalInputMode() const >+{ >+ return inputModeForAttributeValue(attributeWithoutSynchronization(inputmodeAttr)); >+} >+ >+const AtomicString& HTMLElement::inputMode() const >+{ >+ return stringForInputMode(canonicalInputMode()); >+} >+ >+void HTMLElement::setInputMode(const AtomicString& value) >+{ >+ setAttributeWithoutSynchronization(inputmodeAttr, value); >+} >+ > } // namespace WebCore > > #ifndef NDEBUG >diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h >index e598c7890cfc101cb46190407b5e2421a5f90418..b851909f8aaf5da927fc2ddce7d6dfc0705287b9 100644 >--- a/Source/WebCore/html/HTMLElement.h >+++ b/Source/WebCore/html/HTMLElement.h >@@ -26,6 +26,7 @@ > #include "Autocapitalize.h" > #endif > >+#include "InputMode.h" > #include "StyledElement.h" > > namespace WebCore { >@@ -107,6 +108,10 @@ public: > WEBCORE_EXPORT void setAutocorrect(bool); > #endif > >+ WEBCORE_EXPORT InputMode canonicalInputMode() const; >+ const AtomicString& inputMode() const; >+ void setInputMode(const AtomicString& value); >+ > protected: > HTMLElement(const QualifiedName& tagName, Document&, ConstructionType); > >diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl >index c94e9eb694ea7abb3f0164e8ee6c527525cbdcef..077e6ac3dfc943d97270292c3bfd5b214497ca19 100644 >--- a/Source/WebCore/html/HTMLElement.idl >+++ b/Source/WebCore/html/HTMLElement.idl >@@ -67,6 +67,8 @@ > > // FIXME: We are the only browser to support this now that Blink dropped it (http://crbug.com/688943). > [CEReactions, Reflect] attribute DOMString webkitdropzone; >+ >+ attribute DOMString inputMode; > }; > > HTMLElement implements ElementCSSInlineStyle; >diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl >index b06f9c4756f7d515533073447409f7b7beff52a9..e9658294f101badd4b744105e1d1d2dd6e29a150 100644 >--- a/Source/WebCore/html/HTMLInputElement.idl >+++ b/Source/WebCore/html/HTMLInputElement.idl >@@ -42,7 +42,6 @@ > [Reflect] attribute DOMString formTarget; > attribute unsigned long height; > attribute boolean indeterminate; >- attribute DOMString inputMode; > [Conditional=DATALIST_ELEMENT] readonly attribute HTMLElement list; > [Reflect] attribute DOMString max; > attribute long minLength; >diff --git a/Source/WebCore/html/HTMLTextAreaElement.idl b/Source/WebCore/html/HTMLTextAreaElement.idl >index bda362abf3e9b399783d4ce389545e266dff82a5..b8540165275e1cd3774583a4b7c7a67d81b22b93 100644 >--- a/Source/WebCore/html/HTMLTextAreaElement.idl >+++ b/Source/WebCore/html/HTMLTextAreaElement.idl >@@ -59,5 +59,4 @@ interface HTMLTextAreaElement : HTMLElement { > void setSelectionRange(optional long start = 0, optional long end = 0, optional DOMString direction); > > attribute DOMString autocomplete; >- attribute DOMString inputMode; > }; >diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp >index 033268a39e3d66bf0f02ce9c6efc64a7fc7be694..94eab766e26785999adf1d200841dd88b9ef6cbb 100644 >--- a/Source/WebCore/html/HTMLTextFormControlElement.cpp >+++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp >@@ -39,7 +39,6 @@ > #include "HTMLInputElement.h" > #include "HTMLNames.h" > #include "HTMLParserIdioms.h" >-#include "InputModeNames.h" > #include "LayoutDisallowedScope.h" > #include "Logging.h" > #include "NodeTraversal.h" >@@ -675,32 +674,6 @@ void HTMLTextFormControlElement::showPlaceholderIfNecessary() > } > #endif > >-String HTMLTextFormControlElement::inputMode() const >-{ >- const AtomicString& inputMode = attributeWithoutSynchronization(inputmodeAttr); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::text())) >- return InputModeNames::text(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::tel())) >- return InputModeNames::tel(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::url())) >- return InputModeNames::url(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::email())) >- return InputModeNames::email(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::numeric())) >- return InputModeNames::numeric(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::decimal())) >- return InputModeNames::decimal(); >- if (equalIgnoringASCIICase(inputMode, InputModeNames::search())) >- return InputModeNames::search(); >- >- return emptyString(); >-} >- >-void HTMLTextFormControlElement::setInputMode(const String& value) >-{ >- setAttributeWithoutSynchronization(inputmodeAttr, value); >-} >- > static void getNextSoftBreak(RootInlineBox*& line, Node*& breakNode, unsigned& breakOffset) > { > RootInlineBox* next; >diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h >index 7eac0b6c1478062b8ed70b8a136b4d874c0791af..c320f2fe993d81a423cc599363fb3b33d1cc05fc 100644 >--- a/Source/WebCore/html/HTMLTextFormControlElement.h >+++ b/Source/WebCore/html/HTMLTextFormControlElement.h >@@ -98,9 +98,6 @@ public: > WEBCORE_EXPORT void showPlaceholderIfNecessary(); > #endif > >- WEBCORE_EXPORT String inputMode() const; >- void setInputMode(const String&); >- > protected: > HTMLTextFormControlElement(const QualifiedName&, Document&, HTMLFormElement*); > bool isPlaceholderEmpty() const; >diff --git a/Source/WebCore/html/InputMode.cpp b/Source/WebCore/html/InputMode.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c048f503f61211e30f6efb0f77edd97ee13d9075 >--- /dev/null >+++ b/Source/WebCore/html/InputMode.cpp >@@ -0,0 +1,121 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "InputMode.h" >+ >+#include <wtf/NeverDestroyed.h> >+ >+namespace WebCore { >+ >+InputMode inputModeForAttributeValue(const AtomicString& value) >+{ >+ if (equalIgnoringASCIICase(value, InputModeNames::text())) >+ return InputMode::Text; >+ if (equalIgnoringASCIICase(value, InputModeNames::tel())) >+ return InputMode::Telephone; >+ if (equalIgnoringASCIICase(value, InputModeNames::url())) >+ return InputMode::Url; >+ if (equalIgnoringASCIICase(value, InputModeNames::email())) >+ return InputMode::Email; >+ if (equalIgnoringASCIICase(value, InputModeNames::numeric())) >+ return InputMode::Numeric; >+ if (equalIgnoringASCIICase(value, InputModeNames::decimal())) >+ return InputMode::Decimal; >+ if (equalIgnoringASCIICase(value, InputModeNames::search())) >+ return InputMode::Search; >+ >+ return InputMode::Auto; >+} >+ >+const AtomicString& stringForInputMode(InputMode mode) >+{ >+ switch (mode) { >+ case InputMode::Auto: >+ return emptyAtom(); >+ case InputMode::Text: >+ return InputModeNames::text(); >+ case InputMode::Telephone: >+ return InputModeNames::tel(); >+ case InputMode::Url: >+ return InputModeNames::url(); >+ case InputMode::Email: >+ return InputModeNames::email(); >+ case InputMode::Numeric: >+ return InputModeNames::numeric(); >+ case InputMode::Decimal: >+ return InputModeNames::decimal(); >+ case InputMode::Search: >+ return InputModeNames::search(); >+ } >+} >+ >+namespace InputModeNames { >+ >+const AtomicString& text() >+{ >+ static NeverDestroyed<AtomicString> mode("text", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& tel() >+{ >+ static NeverDestroyed<AtomicString> mode("tel", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& url() >+{ >+ static NeverDestroyed<AtomicString> mode("url", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& email() >+{ >+ static NeverDestroyed<AtomicString> mode("email", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& numeric() >+{ >+ static NeverDestroyed<AtomicString> mode("numeric", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& decimal() >+{ >+ static NeverDestroyed<AtomicString> mode("decimal", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+const AtomicString& search() >+{ >+ static NeverDestroyed<AtomicString> mode("search", AtomicString::ConstructFromLiteral); >+ return mode; >+} >+ >+} // namespace InputModeNames >+ >+} // namespace WebCore >diff --git a/Source/WebCore/html/InputMode.h b/Source/WebCore/html/InputMode.h >new file mode 100644 >index 0000000000000000000000000000000000000000..73d074c7cb848a5c48f9bef31e2dc49affee8372 >--- /dev/null >+++ b/Source/WebCore/html/InputMode.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/text/AtomicString.h> >+ >+namespace WebCore { >+ >+enum class InputMode : uint8_t { >+ Auto, >+ Text, >+ Telephone, >+ Url, >+ Email, >+ Numeric, >+ Decimal, >+ Search >+}; >+ >+InputMode inputModeForAttributeValue(const AtomicString&); >+const AtomicString& stringForInputMode(InputMode); >+ >+namespace InputModeNames { >+ >+const AtomicString& text(); >+const AtomicString& tel(); >+const AtomicString& url(); >+const AtomicString& email(); >+const AtomicString& numeric(); >+const AtomicString& decimal(); >+const AtomicString& search(); >+ >+} // namespace InputModeNames >+ >+} // namespace WebCore >diff --git a/Source/WebCore/html/InputModeNames.cpp b/Source/WebCore/html/InputModeNames.cpp >deleted file mode 100644 >index 61c9870773fa741ea6b065476838431681a5319d..0000000000000000000000000000000000000000 >--- a/Source/WebCore/html/InputModeNames.cpp >+++ /dev/null >@@ -1,79 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "InputModeNames.h" >- >-#include <wtf/NeverDestroyed.h> >- >-namespace WebCore { >- >-namespace InputModeNames { >- >-const AtomicString& text() >-{ >- static NeverDestroyed<AtomicString> mode("text", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& tel() >-{ >- static NeverDestroyed<AtomicString> mode("tel", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& url() >-{ >- static NeverDestroyed<AtomicString> mode("url", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& email() >-{ >- static NeverDestroyed<AtomicString> mode("email", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& numeric() >-{ >- static NeverDestroyed<AtomicString> mode("numeric", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& decimal() >-{ >- static NeverDestroyed<AtomicString> mode("decimal", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-const AtomicString& search() >-{ >- static NeverDestroyed<AtomicString> mode("search", AtomicString::ConstructFromLiteral); >- return mode; >-} >- >-} // namespace InputModeNames >- >-} // namespace WebCore >diff --git a/Source/WebCore/html/InputModeNames.h b/Source/WebCore/html/InputModeNames.h >deleted file mode 100644 >index caa259dc3859a35fd72af1b0394d9eb222523e61..0000000000000000000000000000000000000000 >--- a/Source/WebCore/html/InputModeNames.h >+++ /dev/null >@@ -1,44 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include <wtf/text/AtomicString.h> >- >-namespace WebCore { >- >-namespace InputModeNames { >- >-WEBCORE_EXPORT const AtomicString& text(); >-WEBCORE_EXPORT const AtomicString& tel(); >-WEBCORE_EXPORT const AtomicString& url(); >-WEBCORE_EXPORT const AtomicString& email(); >-WEBCORE_EXPORT const AtomicString& numeric(); >-WEBCORE_EXPORT const AtomicString& decimal(); >-WEBCORE_EXPORT const AtomicString& search(); >- >-} // namespace InputModeNames >- >-} // namespace WebCore >diff --git a/Source/WebKit/Shared/AssistedNodeInformation.h b/Source/WebKit/Shared/AssistedNodeInformation.h >index 0bc8fd3537b03a9eb2774ae6bc63da8183f1bcb7..ee8d10ac5b53af264c7f12b3d95e500232179eee 100644 >--- a/Source/WebKit/Shared/AssistedNodeInformation.h >+++ b/Source/WebKit/Shared/AssistedNodeInformation.h >@@ -29,6 +29,7 @@ > #include <WebCore/AutocapitalizeTypes.h> > #include <WebCore/Autofill.h> > #include <WebCore/Color.h> >+#include <WebCore/InputMode.h> > #include <WebCore/IntRect.h> > #include <WebCore/URL.h> > #include <wtf/text/WTFString.h> >@@ -59,17 +60,6 @@ enum class InputType { > #endif > }; > >-enum class InputMode : uint8_t { >- Auto, >- Text, >- Telephone, >- Url, >- Email, >- Numeric, >- Decimal, >- Search >-}; >- > #if PLATFORM(IOS) > struct OptionItem { > OptionItem() { } >@@ -121,7 +111,7 @@ struct AssistedNodeInformation { > bool insideFixedPosition { false }; > AutocapitalizeType autocapitalizeType { AutocapitalizeTypeDefault }; > InputType elementType { InputType::None }; >- InputMode inputMode { InputMode::Auto }; >+ WebCore::InputMode inputMode { WebCore::InputMode::Auto }; > String formAction; > Vector<OptionItem> selectOptions; > int selectedIndex { -1 }; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index d68f8b7eacfde092169a9dde1c00e5b1b17e7b80..2c7e6e5d5844eb2106f9ce712c2b29b179ce7d45 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -75,6 +75,7 @@ > #import <WebCore/Color.h> > #import <WebCore/DataDetection.h> > #import <WebCore/FloatQuad.h> >+#import <WebCore/InputMode.h> > #import <WebCore/LocalizedStrings.h> > #import <WebCore/NotImplemented.h> > #import <WebCore/Pasteboard.h> >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 973a04a65c4dd8c226d354248a2d07e1f575379b..ae58e0904e8d4db9a95856d623f00205e5d8e12e 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -87,7 +87,7 @@ > #import <WebCore/HTMLTextFormControlElement.h> > #import <WebCore/HistoryItem.h> > #import <WebCore/HitTestResult.h> >-#import <WebCore/InputModeNames.h> >+#import <WebCore/InputMode.h> > #import <WebCore/KeyboardEvent.h> > #import <WebCore/LibWebRTCProvider.h> > #import <WebCore/MediaSessionManagerIOS.h> >@@ -2314,27 +2314,6 @@ static IntRect elementRectInRootViewCoordinates(const Node& node, const Frame& f > return view->contentsToRootView(renderer->absoluteBoundingBoxRect()); > } > >-static InputMode inputModeForAssistedNode(const Node& node) >-{ >- const AtomicString& inputMode = downcast<HTMLTextFormControlElement>(node).inputMode(); >- if (inputMode == InputModeNames::text()) >- return InputMode::Text; >- if (inputMode == InputModeNames::tel()) >- return InputMode::Telephone; >- if (inputMode == InputModeNames::url()) >- return InputMode::Url; >- if (inputMode == InputModeNames::email()) >- return InputMode::Email; >- if (inputMode == InputModeNames::numeric()) >- return InputMode::Numeric; >- if (inputMode == InputModeNames::decimal()) >- return InputMode::Decimal; >- if (inputMode == InputModeNames::search()) >- return InputMode::Search; >- >- return InputMode::Auto; >-} >- > void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) > { > layoutIfNeeded(); >@@ -2440,7 +2419,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) > information.value = element.value(); > information.autofillFieldName = WebCore::toAutofillFieldName(element.autofillData().fieldName); > information.placeholder = element.attributeWithoutSynchronization(HTMLNames::placeholderAttr); >- information.inputMode = inputModeForAssistedNode(element); >+ information.inputMode = element.canonicalInputMode(); > } else if (is<HTMLInputElement>(*m_assistedNode)) { > HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode); > HTMLFormElement* form = element.form(); >@@ -2498,7 +2477,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) > } > #endif > >- information.inputMode = inputModeForAssistedNode(element); >+ information.inputMode = element.canonicalInputMode(); > information.isReadOnly = element.isReadOnly(); > information.value = element.value(); > information.valueAsNumber = element.valueAsNumber(); >@@ -2509,6 +2488,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) > auto& assistedElement = downcast<HTMLElement>(*m_assistedNode); > information.isAutocorrect = assistedElement.shouldAutocorrect(); > information.autocapitalizeType = assistedElement.autocapitalizeType(); >+ information.inputMode = assistedElement.canonicalInputMode(); > } else { > information.isAutocorrect = true; > information.autocapitalizeType = AutocapitalizeTypeDefault; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 51bfbdad17960e9460893fc02de1c30da096a6be..fb98211fc0590e0d2b60469732cb746def1513f6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-22 Aditya Keerthi <akeerthi@apple.com> >+ >+ [iOS] Support the inputmode attribute on contenteditable elements >+ https://bugs.webkit.org/show_bug.cgi?id=188878 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updated test to verify the inputmode attribute is accessible on HTMLElements. >+ >+ * fast/forms/inputmode-attribute-expected.txt: >+ * fast/forms/inputmode-attribute.html: >+ > 2018-08-22 John Wilander <wilander@apple.com> > > Further adjustments to http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html >diff --git a/LayoutTests/fast/forms/inputmode-attribute-expected.txt b/LayoutTests/fast/forms/inputmode-attribute-expected.txt >index ff2daef1dd5fdd89008e773c1f811cdcf1920f38..d3e5284d6904d7beb671a0c838ba553a6078e22a 100644 >--- a/LayoutTests/fast/forms/inputmode-attribute-expected.txt >+++ b/LayoutTests/fast/forms/inputmode-attribute-expected.txt >@@ -1,6 +1,6 @@ > Test inputmode attribute > >- >+ > Missing value default: > PASS input.inputMode is "" > PASS input.getAttribute("inputmode") is null >@@ -14,21 +14,21 @@ Valid values: > PASS input.inputMode = "text"; input.inputMode is "text" > PASS input.getAttribute("inputmode") is "text" > PASS input.setAttribute("inputmode", "text"); input.inputMode is "text" >-PASS input.inputMode = "tel"; input.inputMode is "tel" >-PASS input.getAttribute("inputmode") is "tel" >-PASS input.setAttribute("inputmode", "tel"); input.inputMode is "tel" >-PASS input.inputMode = "url"; input.inputMode is "url" >-PASS input.getAttribute("inputmode") is "url" >-PASS input.setAttribute("inputmode", "url"); input.inputMode is "url" >+PASS textarea.inputMode = "tel"; textarea.inputMode is "tel" >+PASS textarea.getAttribute("inputmode") is "tel" >+PASS textarea.setAttribute("inputmode", "tel"); textarea.inputMode is "tel" >+PASS editor.inputMode = "url"; editor.inputMode is "url" >+PASS editor.getAttribute("inputmode") is "url" >+PASS editor.setAttribute("inputmode", "url"); editor.inputMode is "url" > PASS input.inputMode = "email"; input.inputMode is "email" > PASS input.getAttribute("inputmode") is "email" > PASS input.setAttribute("inputmode", "email"); input.inputMode is "email" >-PASS input.inputMode = "numeric"; input.inputMode is "numeric" >-PASS input.getAttribute("inputmode") is "numeric" >-PASS input.setAttribute("inputmode", "numeric"); input.inputMode is "numeric" >-PASS input.inputMode = "decimal"; input.inputMode is "decimal" >-PASS input.getAttribute("inputmode") is "decimal" >-PASS input.setAttribute("inputmode", "decimal"); input.inputMode is "decimal" >+PASS textarea.inputMode = "numeric"; textarea.inputMode is "numeric" >+PASS textarea.getAttribute("inputmode") is "numeric" >+PASS textarea.setAttribute("inputmode", "numeric"); textarea.inputMode is "numeric" >+PASS editor.inputMode = "decimal"; editor.inputMode is "decimal" >+PASS editor.getAttribute("inputmode") is "decimal" >+PASS editor.setAttribute("inputmode", "decimal"); editor.inputMode is "decimal" > PASS input.inputMode = "search"; input.inputMode is "search" > PASS input.getAttribute("inputmode") is "search" > PASS input.setAttribute("inputmode", "search"); input.inputMode is "search" >diff --git a/LayoutTests/fast/forms/inputmode-attribute.html b/LayoutTests/fast/forms/inputmode-attribute.html >index 3dd408dcfe0fdfd7303becc58e1f751e3c0cd56a..868b8f1e8d34f3a0e4c16bb946ae072308331764 100644 >--- a/LayoutTests/fast/forms/inputmode-attribute.html >+++ b/LayoutTests/fast/forms/inputmode-attribute.html >@@ -4,6 +4,8 @@ > <script src="../../resources/js-test-pre.js"></script> > <p>Test inputmode attribute</p> > <input id="input"> >+<textarea id="textarea"></textarea> >+<div id="editor" contenteditable></div> > <div id=console></div> > <script> > debug('Missing value default:'); >@@ -21,21 +23,21 @@ debug('Valid values:'); > shouldBe('input.inputMode = "text"; input.inputMode', '"text"'); > shouldBe('input.getAttribute("inputmode")', '"text"'); > shouldBe('input.setAttribute("inputmode", "text"); input.inputMode', '"text"'); >-shouldBe('input.inputMode = "tel"; input.inputMode', '"tel"'); >-shouldBe('input.getAttribute("inputmode")', '"tel"'); >-shouldBe('input.setAttribute("inputmode", "tel"); input.inputMode', '"tel"'); >-shouldBe('input.inputMode = "url"; input.inputMode', '"url"'); >-shouldBe('input.getAttribute("inputmode")', '"url"'); >-shouldBe('input.setAttribute("inputmode", "url"); input.inputMode', '"url"'); >+shouldBe('textarea.inputMode = "tel"; textarea.inputMode', '"tel"'); >+shouldBe('textarea.getAttribute("inputmode")', '"tel"'); >+shouldBe('textarea.setAttribute("inputmode", "tel"); textarea.inputMode', '"tel"'); >+shouldBe('editor.inputMode = "url"; editor.inputMode', '"url"'); >+shouldBe('editor.getAttribute("inputmode")', '"url"'); >+shouldBe('editor.setAttribute("inputmode", "url"); editor.inputMode', '"url"'); > shouldBe('input.inputMode = "email"; input.inputMode', '"email"'); > shouldBe('input.getAttribute("inputmode")', '"email"'); > shouldBe('input.setAttribute("inputmode", "email"); input.inputMode', '"email"'); >-shouldBe('input.inputMode = "numeric"; input.inputMode', '"numeric"'); >-shouldBe('input.getAttribute("inputmode")', '"numeric"'); >-shouldBe('input.setAttribute("inputmode", "numeric"); input.inputMode', '"numeric"'); >-shouldBe('input.inputMode = "decimal"; input.inputMode', '"decimal"'); >-shouldBe('input.getAttribute("inputmode")', '"decimal"'); >-shouldBe('input.setAttribute("inputmode", "decimal"); input.inputMode', '"decimal"'); >+shouldBe('textarea.inputMode = "numeric"; textarea.inputMode', '"numeric"'); >+shouldBe('textarea.getAttribute("inputmode")', '"numeric"'); >+shouldBe('textarea.setAttribute("inputmode", "numeric"); textarea.inputMode', '"numeric"'); >+shouldBe('editor.inputMode = "decimal"; editor.inputMode', '"decimal"'); >+shouldBe('editor.getAttribute("inputmode")', '"decimal"'); >+shouldBe('editor.setAttribute("inputmode", "decimal"); editor.inputMode', '"decimal"'); > shouldBe('input.inputMode = "search"; input.inputMode', '"search"'); > shouldBe('input.getAttribute("inputmode")', '"search"'); > shouldBe('input.setAttribute("inputmode", "search"); input.inputMode', '"search"');
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188878
:
347898
|
347906
|
347909
|
347912
|
347914
|
347943