| Differences between
and this patch
- a/Source/WebCore/ChangeLog +31 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2018-08-20  Aditya Keerthi  <akeerthi@apple.com>
2
3
        [iOS] Add support for the inputmode attribute
4
        https://bugs.webkit.org/show_bug.cgi?id=183621
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added the inputmode attribute to the HTMLInputElement and HTMLTextAreaElement IDL
9
        files. The possible values for the attribute are specified in InputModeNames.
10
11
        Test: fast/forms/inputmode-attribute.html
12
13
        * Sources.txt:
14
        * WebCore.xcodeproj/project.pbxproj:
15
        * html/HTMLAttributeNames.in:
16
        * html/HTMLInputElement.idl:
17
        * html/HTMLTextAreaElement.idl:
18
        * html/HTMLTextFormControlElement.cpp:
19
        (WebCore::HTMLTextFormControlElement::inputMode const):
20
        (WebCore::HTMLTextFormControlElement::setInputMode):
21
        * html/HTMLTextFormControlElement.h:
22
        * html/InputModeNames.cpp: Added.
23
        (WebCore::InputModeNames::text):
24
        (WebCore::InputModeNames::tel):
25
        (WebCore::InputModeNames::url):
26
        (WebCore::InputModeNames::email):
27
        (WebCore::InputModeNames::numeric):
28
        (WebCore::InputModeNames::decimal):
29
        (WebCore::InputModeNames::search):
30
        * html/InputModeNames.h: Added.
31
1
2018-08-20  Rob Buis  <rbuis@igalia.com>
32
2018-08-20  Rob Buis  <rbuis@igalia.com>
2
33
3
        Throw an exception if window.open() gets passed a URL that cannot be parsed
34
        Throw an exception if window.open() gets passed a URL that cannot be parsed
- a/Source/WebKit/ChangeLog +33 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2018-08-20  Aditya Keerthi  <akeerthi@apple.com>
2
3
        [iOS] Add support for the inputmode attribute
4
        https://bugs.webkit.org/show_bug.cgi?id=183621
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        The inputmode attribute specifies which input mechanism would be most helpful for
9
        users entering content in textfield inputs and textareas. This patch adds support
10
        for seven values: text, tel, url, email, numeric, decimal and search.
11
12
        On iOS, we can specify UIKeyboardTypes that best match the supplied inputmode.
13
        - text: UIKeyboardTypeDefault
14
        - tel: UIKeyboardTypePhonePad
15
        - url: UIKeyboardTypeURL
16
        - email: UIKeyboardTypeEmailAddress
17
        - numeric: UIKeyboardTypeNumberPad
18
        - decimal: UIKeyboardTypeDecimalPad
19
        - search: UIKeyboardTypeWebSearch
20
21
        In the case that the inputmode attribute is not specified, we fall back to using
22
        our existing heuristic to determine what kind of keyboard to show for textfields.
23
24
        * Shared/AssistedNodeInformation.cpp:
25
        (WebKit::AssistedNodeInformation::encode const):
26
        (WebKit::AssistedNodeInformation::decode):
27
        * Shared/AssistedNodeInformation.h: Added inputMode field.
28
        * UIProcess/ios/WKContentViewInteraction.mm:
29
        (-[WKContentView textInputTraits]):
30
        * WebProcess/WebPage/ios/WebPageIOS.mm:
31
        (WebKit::inputModeForElement):
32
        (WebKit::WebPage::getAssistedNodeInformation):
33
1
2018-08-20  Carlos Garcia Campos  <cgarcia@igalia.com>
34
2018-08-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2
35
3
        Unreviewed. Fix GTK/WPE cookie API tests after r234396.
36
        Unreviewed. Fix GTK/WPE cookie API tests after r234396.
- a/Source/WebCore/Sources.txt +1 lines
Lines 1056-1061 html/ImageBitmap.cpp a/Source/WebCore/Sources.txt_sec1
1056
html/ImageData.cpp
1056
html/ImageData.cpp
1057
html/ImageDocument.cpp
1057
html/ImageDocument.cpp
1058
html/ImageInputType.cpp
1058
html/ImageInputType.cpp
1059
html/InputModeNames.cpp
1059
html/InputType.cpp
1060
html/InputType.cpp
1060
html/InputTypeNames.cpp
1061
html/InputTypeNames.cpp
1061
html/LabelableElement.cpp
1062
html/LabelableElement.cpp
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +6 lines
Lines 4790-4795 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
4790
		E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E517670220B88C1400D41167 /* DataListSuggestionInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
4790
		E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E517670220B88C1400D41167 /* DataListSuggestionInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
4791
		E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
4791
		E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
4792
		E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */; settings = {ATTRIBUTES = (Private, ); }; };
4792
		E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */; settings = {ATTRIBUTES = (Private, ); }; };
4793
		E52EFDF42112875A00AD282A /* InputModeNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E52EFDF22112875A00AD282A /* InputModeNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
4793
		E58B45BA20AD07DD00991025 /* DataListButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E58B45B820AD07DD00991025 /* DataListButtonElement.h */; };
4794
		E58B45BA20AD07DD00991025 /* DataListButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E58B45B820AD07DD00991025 /* DataListButtonElement.h */; };
4794
		E58B45BB20AD07DD00991025 /* DataListButtonElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */; };
4795
		E58B45BB20AD07DD00991025 /* DataListButtonElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */; };
4795
		E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = E59DD4B721098285003C8B47 /* ListButtonArrow.png */; };
4796
		E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = E59DD4B721098285003C8B47 /* ListButtonArrow.png */; };
Lines 14524-14529 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
14524
		E526AF3E1727F8F200E41781 /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; };
14525
		E526AF3E1727F8F200E41781 /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; };
14525
		E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionsClient.h; sourceTree = "<group>"; };
14526
		E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionsClient.h; sourceTree = "<group>"; };
14526
		E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionPicker.h; sourceTree = "<group>"; };
14527
		E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionPicker.h; sourceTree = "<group>"; };
14528
		E52EFDF22112875A00AD282A /* InputModeNames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InputModeNames.h; sourceTree = "<group>"; };
14529
		E52EFDF32112875A00AD282A /* InputModeNames.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InputModeNames.cpp; sourceTree = "<group>"; };
14527
		E55F4979151B888000BB67DB /* LengthFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthFunctions.cpp; sourceTree = "<group>"; };
14530
		E55F4979151B888000BB67DB /* LengthFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthFunctions.cpp; sourceTree = "<group>"; };
14528
		E58B45B820AD07DD00991025 /* DataListButtonElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListButtonElement.h; sourceTree = "<group>"; };
14531
		E58B45B820AD07DD00991025 /* DataListButtonElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListButtonElement.h; sourceTree = "<group>"; };
14529
		E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DataListButtonElement.cpp; sourceTree = "<group>"; };
14532
		E58B45B920AD07DD00991025 /* DataListButtonElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DataListButtonElement.cpp; sourceTree = "<group>"; };
Lines 20806-20811 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
20806
				97205AB21239291000B17380 /* ImageDocument.h */,
20809
				97205AB21239291000B17380 /* ImageDocument.h */,
20807
				F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */,
20810
				F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */,
20808
				F55B3D8E1251F12D003EF269 /* ImageInputType.h */,
20811
				F55B3D8E1251F12D003EF269 /* ImageInputType.h */,
20812
				E52EFDF32112875A00AD282A /* InputModeNames.cpp */,
20813
				E52EFDF22112875A00AD282A /* InputModeNames.h */,
20809
				37E3524A12450C5200BAF5D9 /* InputType.cpp */,
20814
				37E3524A12450C5200BAF5D9 /* InputType.cpp */,
20810
				37E3524C12450C6600BAF5D9 /* InputType.h */,
20815
				37E3524C12450C6600BAF5D9 /* InputType.h */,
20811
				C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */,
20816
				C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */,
Lines 28437-28442 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
28437
				1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */,
28442
				1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */,
28438
				510A58E51BAA40B100C19282 /* InProcessIDBServer.h in Headers */,
28443
				510A58E51BAA40B100C19282 /* InProcessIDBServer.h in Headers */,
28439
				2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */,
28444
				2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */,
28445
				E52EFDF42112875A00AD282A /* InputModeNames.h in Headers */,
28440
				37E3524D12450C6600BAF5D9 /* InputType.h in Headers */,
28446
				37E3524D12450C6600BAF5D9 /* InputType.h in Headers */,
28441
				C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */,
28447
				C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */,
28442
				93309DEA099E64920056E581 /* InsertIntoTextNodeCommand.h in Headers */,
28448
				93309DEA099E64920056E581 /* InsertIntoTextNodeCommand.h in Headers */,
- a/Source/WebCore/html/HTMLAttributeNames.in +1 lines
Lines 144-149 http_equiv a/Source/WebCore/html/HTMLAttributeNames.in_sec1
144
id
144
id
145
incremental
145
incremental
146
indeterminate
146
indeterminate
147
inputmode
147
integrity
148
integrity
148
is
149
is
149
ismap
150
ismap
- a/Source/WebCore/html/HTMLInputElement.idl +1 lines
Lines 42-47 a/Source/WebCore/html/HTMLInputElement.idl_sec1
42
    [Reflect] attribute DOMString formTarget;
42
    [Reflect] attribute DOMString formTarget;
43
    attribute unsigned long height;
43
    attribute unsigned long height;
44
    attribute boolean indeterminate;
44
    attribute boolean indeterminate;
45
    attribute DOMString inputMode;
45
    [Conditional=DATALIST_ELEMENT] readonly attribute HTMLElement list;
46
    [Conditional=DATALIST_ELEMENT] readonly attribute HTMLElement list;
46
    [Reflect] attribute DOMString max;
47
    [Reflect] attribute DOMString max;
47
    attribute long minLength;
48
    attribute long minLength;
- a/Source/WebCore/html/HTMLTextAreaElement.idl +1 lines
Lines 59-62 interface HTMLTextAreaElement : HTMLElement { a/Source/WebCore/html/HTMLTextAreaElement.idl_sec1
59
    void setSelectionRange(optional long start = 0, optional long end = 0, optional DOMString direction);
59
    void setSelectionRange(optional long start = 0, optional long end = 0, optional DOMString direction);
60
60
61
    attribute DOMString autocomplete;
61
    attribute DOMString autocomplete;
62
    attribute DOMString inputMode;
62
};
63
};
- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +27 lines
Lines 39-44 a/Source/WebCore/html/HTMLTextFormControlElement.cpp_sec1
39
#include "HTMLInputElement.h"
39
#include "HTMLInputElement.h"
40
#include "HTMLNames.h"
40
#include "HTMLNames.h"
41
#include "HTMLParserIdioms.h"
41
#include "HTMLParserIdioms.h"
42
#include "InputModeNames.h"
42
#include "LayoutDisallowedScope.h"
43
#include "LayoutDisallowedScope.h"
43
#include "Logging.h"
44
#include "Logging.h"
44
#include "NodeTraversal.h"
45
#include "NodeTraversal.h"
Lines 674-679 void HTMLTextFormControlElement::showPlaceholderIfNecessary() a/Source/WebCore/html/HTMLTextFormControlElement.cpp_sec2
674
}
675
}
675
#endif
676
#endif
676
677
678
String HTMLTextFormControlElement::inputMode() const
679
{
680
    const AtomicString& inputMode = attributeWithoutSynchronization(inputmodeAttr);
681
    if (equalIgnoringASCIICase(inputMode, InputModeNames::text()))
682
        return InputModeNames::text();
683
    if (equalIgnoringASCIICase(inputMode, InputModeNames::tel()))
684
        return InputModeNames::tel();
685
    if (equalIgnoringASCIICase(inputMode, InputModeNames::url()))
686
        return InputModeNames::url();
687
    if (equalIgnoringASCIICase(inputMode, InputModeNames::email()))
688
        return InputModeNames::email();
689
    if (equalIgnoringASCIICase(inputMode, InputModeNames::numeric()))
690
        return InputModeNames::numeric();
691
    if (equalIgnoringASCIICase(inputMode, InputModeNames::decimal()))
692
        return InputModeNames::decimal();
693
    if (equalIgnoringASCIICase(inputMode, InputModeNames::search()))
694
        return InputModeNames::search();
695
696
    return emptyString();
697
}
698
699
void HTMLTextFormControlElement::setInputMode(const String& value)
700
{
701
    setAttributeWithoutSynchronization(inputmodeAttr, value);
702
}
703
677
static void getNextSoftBreak(RootInlineBox*& line, Node*& breakNode, unsigned& breakOffset)
704
static void getNextSoftBreak(RootInlineBox*& line, Node*& breakNode, unsigned& breakOffset)
678
{
705
{
679
    RootInlineBox* next;
706
    RootInlineBox* next;
- a/Source/WebCore/html/HTMLTextFormControlElement.h +3 lines
Lines 98-103 public: a/Source/WebCore/html/HTMLTextFormControlElement.h_sec1
98
    WEBCORE_EXPORT void showPlaceholderIfNecessary();
98
    WEBCORE_EXPORT void showPlaceholderIfNecessary();
99
#endif
99
#endif
100
100
101
    WEBCORE_EXPORT String inputMode() const;
102
    void setInputMode(const String&);
103
101
protected:
104
protected:
102
    HTMLTextFormControlElement(const QualifiedName&, Document&, HTMLFormElement*);
105
    HTMLTextFormControlElement(const QualifiedName&, Document&, HTMLFormElement*);
103
    bool isPlaceholderEmpty() const;
106
    bool isPlaceholderEmpty() const;
- a/Source/WebCore/html/InputModeNames.cpp +79 lines
Line 0 a/Source/WebCore/html/InputModeNames.cpp_sec1
1
/*
2
 * Copyright (C) 2018 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "InputModeNames.h"
28
29
#include <wtf/NeverDestroyed.h>
30
31
namespace WebCore {
32
33
namespace InputModeNames {
34
35
const AtomicString& text()
36
{
37
    static NeverDestroyed<AtomicString> mode("text", AtomicString::ConstructFromLiteral);
38
    return mode;
39
}
40
41
const AtomicString& tel()
42
{
43
    static NeverDestroyed<AtomicString> mode("tel", AtomicString::ConstructFromLiteral);
44
    return mode;
45
}
46
47
const AtomicString& url()
48
{
49
    static NeverDestroyed<AtomicString> mode("url", AtomicString::ConstructFromLiteral);
50
    return mode;
51
}
52
53
const AtomicString& email()
54
{
55
    static NeverDestroyed<AtomicString> mode("email", AtomicString::ConstructFromLiteral);
56
    return mode;
57
}
58
59
const AtomicString& numeric()
60
{
61
    static NeverDestroyed<AtomicString> mode("numeric", AtomicString::ConstructFromLiteral);
62
    return mode;
63
}
64
65
const AtomicString& decimal()
66
{
67
    static NeverDestroyed<AtomicString> mode("decimal", AtomicString::ConstructFromLiteral);
68
    return mode;
69
}
70
71
const AtomicString& search()
72
{
73
    static NeverDestroyed<AtomicString> mode("search", AtomicString::ConstructFromLiteral);
74
    return mode;
75
}
76
77
} // namespace InputModeNames
78
79
} // namespace WebCore
- a/Source/WebCore/html/InputModeNames.h +44 lines
Line 0 a/Source/WebCore/html/InputModeNames.h_sec1
1
/*
2
 * Copyright (C) 2018 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#pragma once
27
28
#include <wtf/text/AtomicString.h>
29
30
namespace WebCore {
31
32
namespace InputModeNames {
33
34
WEBCORE_EXPORT const AtomicString& text();
35
WEBCORE_EXPORT const AtomicString& tel();
36
WEBCORE_EXPORT const AtomicString& url();
37
WEBCORE_EXPORT const AtomicString& email();
38
WEBCORE_EXPORT const AtomicString& numeric();
39
WEBCORE_EXPORT const AtomicString& decimal();
40
WEBCORE_EXPORT const AtomicString& search();
41
42
} // namespace InputModeNames
43
44
} // namespace WebCore
- a/Source/WebKit/Shared/AssistedNodeInformation.cpp +4 lines
Lines 77-82 void AssistedNodeInformation::encode(IPC::Encoder& encoder) const a/Source/WebKit/Shared/AssistedNodeInformation.cpp_sec1
77
    encoder << isRTL;
77
    encoder << isRTL;
78
    encoder.encodeEnum(autocapitalizeType);
78
    encoder.encodeEnum(autocapitalizeType);
79
    encoder.encodeEnum(elementType);
79
    encoder.encodeEnum(elementType);
80
    encoder.encodeEnum(inputMode);
80
    encoder << formAction;
81
    encoder << formAction;
81
    encoder << selectOptions;
82
    encoder << selectOptions;
82
    encoder << selectedIndex;
83
    encoder << selectedIndex;
Lines 145-150 bool AssistedNodeInformation::decode(IPC::Decoder& decoder, AssistedNodeInformat a/Source/WebKit/Shared/AssistedNodeInformation.cpp_sec2
145
    if (!decoder.decodeEnum(result.elementType))
146
    if (!decoder.decodeEnum(result.elementType))
146
        return false;
147
        return false;
147
148
149
    if (!decoder.decodeEnum(result.inputMode))
150
        return false;
151
148
    if (!decoder.decode(result.formAction))
152
    if (!decoder.decode(result.formAction))
149
        return false;
153
        return false;
150
154
- a/Source/WebKit/Shared/AssistedNodeInformation.h +12 lines
Lines 59-64 enum class InputType { a/Source/WebKit/Shared/AssistedNodeInformation.h_sec1
59
#endif
59
#endif
60
};
60
};
61
61
62
enum class InputMode : uint8_t {
63
    Auto,
64
    Text,
65
    Telephone,
66
    Url,
67
    Email,
68
    Numeric,
69
    Decimal,
70
    Search
71
};
72
62
#if PLATFORM(IOS)
73
#if PLATFORM(IOS)
63
struct OptionItem {
74
struct OptionItem {
64
    OptionItem() { }
75
    OptionItem() { }
Lines 110-115 struct AssistedNodeInformation { a/Source/WebKit/Shared/AssistedNodeInformation.h_sec2
110
    bool insideFixedPosition { false };
121
    bool insideFixedPosition { false };
111
    AutocapitalizeType autocapitalizeType { AutocapitalizeTypeDefault };
122
    AutocapitalizeType autocapitalizeType { AutocapitalizeTypeDefault };
112
    InputType elementType { InputType::None };
123
    InputType elementType { InputType::None };
124
    InputMode inputMode { InputMode::Auto };
113
    String formAction;
125
    String formAction;
114
    Vector<OptionItem> selectOptions;
126
    Vector<OptionItem> selectOptions;
115
    int selectedIndex { -1 };
127
    int selectedIndex { -1 };
- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm -10 / +50 lines
Lines 3547-3570 static NSString *contentTypeFromFieldName(WebCore::AutofillFieldName fieldName) a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm_sec1
3547
        [_traits setAutocorrectionType:_assistedNodeInformation.isAutocorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo];
3547
        [_traits setAutocorrectionType:_assistedNodeInformation.isAutocorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo];
3548
    }
3548
    }
3549
3549
3550
    switch (_assistedNodeInformation.elementType) {
3550
    switch (_assistedNodeInformation.inputMode) {
3551
    case InputType::Phone:
3551
    case InputMode::Auto:
3552
        switch (_assistedNodeInformation.elementType) {
3553
        case InputType::Phone:
3554
            [_traits setKeyboardType:UIKeyboardTypePhonePad];
3555
            break;
3556
        case InputType::URL:
3557
            [_traits setKeyboardType:UIKeyboardTypeURL];
3558
            break;
3559
        case InputType::Email:
3560
            [_traits setKeyboardType:UIKeyboardTypeEmailAddress];
3561
            break;
3562
        case InputType::Number:
3563
            [_traits setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
3564
            break;
3565
        case InputType::NumberPad:
3566
            [_traits setKeyboardType:UIKeyboardTypeNumberPad];
3567
            break;
3568
        case InputType::None:
3569
        case InputType::ContentEditable:
3570
        case InputType::Text:
3571
        case InputType::Password:
3572
        case InputType::TextArea:
3573
        case InputType::Search:
3574
        case InputType::Date:
3575
        case InputType::DateTime:
3576
        case InputType::DateTimeLocal:
3577
        case InputType::Month:
3578
        case InputType::Week:
3579
        case InputType::Time:
3580
        case InputType::Select:
3581
#if ENABLE(INPUT_TYPE_COLOR)
3582
        case InputType::Color:
3583
#endif
3584
            [_traits setKeyboardType:UIKeyboardTypeDefault];
3585
        }
3586
        break;
3587
    case InputMode::Text:
3588
        [_traits setKeyboardType:UIKeyboardTypeDefault];
3589
        break;
3590
    case InputMode::Telephone:
3552
        [_traits setKeyboardType:UIKeyboardTypePhonePad];
3591
        [_traits setKeyboardType:UIKeyboardTypePhonePad];
3553
        break;
3592
        break;
3554
    case InputType::URL:
3593
    case InputMode::Url:
3555
        [_traits setKeyboardType:UIKeyboardTypeURL];
3594
        [_traits setKeyboardType:UIKeyboardTypeURL];
3556
        break;
3595
        break;
3557
    case InputType::Email:
3596
    case InputMode::Email:
3558
        [_traits setKeyboardType:UIKeyboardTypeEmailAddress];
3597
        [_traits setKeyboardType:UIKeyboardTypeEmailAddress];
3559
        break;
3598
        break;
3560
    case InputType::Number:
3599
    case InputMode::Numeric:
3561
        [_traits setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
3562
        break;
3563
    case InputType::NumberPad:
3564
        [_traits setKeyboardType:UIKeyboardTypeNumberPad];
3600
        [_traits setKeyboardType:UIKeyboardTypeNumberPad];
3565
        break;
3601
        break;
3566
    default:
3602
    case InputMode::Decimal:
3567
        [_traits setKeyboardType:UIKeyboardTypeDefault];
3603
        [_traits setKeyboardType:UIKeyboardTypeDecimalPad];
3604
        break;
3605
    case InputMode::Search:
3606
        [_traits setKeyboardType:UIKeyboardTypeWebSearch];
3607
        break;
3568
    }
3608
    }
3569
3609
3570
    [_traits setTextContentType:contentTypeFromFieldName(_assistedNodeInformation.autofillFieldName)];
3610
    [_traits setTextContentType:contentTypeFromFieldName(_assistedNodeInformation.autofillFieldName)];
- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm +25 lines
Lines 84-91 a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm_sec1
84
#import <WebCore/HTMLParserIdioms.h>
84
#import <WebCore/HTMLParserIdioms.h>
85
#import <WebCore/HTMLSelectElement.h>
85
#import <WebCore/HTMLSelectElement.h>
86
#import <WebCore/HTMLTextAreaElement.h>
86
#import <WebCore/HTMLTextAreaElement.h>
87
#import <WebCore/HTMLTextFormControlElement.h>
87
#import <WebCore/HistoryItem.h>
88
#import <WebCore/HistoryItem.h>
88
#import <WebCore/HitTestResult.h>
89
#import <WebCore/HitTestResult.h>
90
#import <WebCore/InputModeNames.h>
89
#import <WebCore/KeyboardEvent.h>
91
#import <WebCore/KeyboardEvent.h>
90
#import <WebCore/LibWebRTCProvider.h>
92
#import <WebCore/LibWebRTCProvider.h>
91
#import <WebCore/MediaSessionManagerIOS.h>
93
#import <WebCore/MediaSessionManagerIOS.h>
Lines 2297-2302 static IntRect elementRectInRootViewCoordinates(const Node& node, const Frame& f a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm_sec2
2297
    return view->contentsToRootView(renderer->absoluteBoundingBoxRect());
2299
    return view->contentsToRootView(renderer->absoluteBoundingBoxRect());
2298
}
2300
}
2299
2301
2302
static InputMode inputModeForAssistedNode(const Node& node)
2303
{
2304
    const AtomicString& inputMode = downcast<HTMLTextFormControlElement>(node).inputMode();
2305
    if (inputMode == InputModeNames::text())
2306
        return InputMode::Text;
2307
    if (inputMode == InputModeNames::tel())
2308
        return InputMode::Telephone;
2309
    if (inputMode == InputModeNames::url())
2310
        return InputMode::Url;
2311
    if (inputMode == InputModeNames::email())
2312
        return InputMode::Email;
2313
    if (inputMode == InputModeNames::numeric())
2314
        return InputMode::Numeric;
2315
    if (inputMode == InputModeNames::decimal())
2316
        return InputMode::Decimal;
2317
    if (inputMode == InputModeNames::search())
2318
        return InputMode::Search;
2319
2320
    return InputMode::Auto;
2321
}
2322
2300
void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
2323
void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
2301
{
2324
{
2302
    layoutIfNeeded();
2325
    layoutIfNeeded();
Lines 2402-2407 void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm_sec3
2402
        information.value = element.value();
2425
        information.value = element.value();
2403
        information.autofillFieldName = WebCore::toAutofillFieldName(element.autofillData().fieldName);
2426
        information.autofillFieldName = WebCore::toAutofillFieldName(element.autofillData().fieldName);
2404
        information.placeholder = element.attributeWithoutSynchronization(HTMLNames::placeholderAttr);
2427
        information.placeholder = element.attributeWithoutSynchronization(HTMLNames::placeholderAttr);
2428
        information.inputMode = inputModeForAssistedNode(element);
2405
    } else if (is<HTMLInputElement>(*m_assistedNode)) {
2429
    } else if (is<HTMLInputElement>(*m_assistedNode)) {
2406
        HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode);
2430
        HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode);
2407
        HTMLFormElement* form = element.form();
2431
        HTMLFormElement* form = element.form();
Lines 2459-2464 void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm_sec4
2459
        }
2483
        }
2460
#endif
2484
#endif
2461
2485
2486
        information.inputMode = inputModeForAssistedNode(element);
2462
        information.isReadOnly = element.isReadOnly();
2487
        information.isReadOnly = element.isReadOnly();
2463
        information.value = element.value();
2488
        information.value = element.value();
2464
        information.valueAsNumber = element.valueAsNumber();
2489
        information.valueAsNumber = element.valueAsNumber();
- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2018-08-20  Aditya Keerthi  <akeerthi@apple.com>
2
3
        [iOS] Add support for the inputmode attribute
4
        https://bugs.webkit.org/show_bug.cgi?id=183621
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added test to verify behavior when getting and setting the inputmode attribute.
9
10
        * fast/forms/inputmode-attribute-expected.txt: Added.
11
        * fast/forms/inputmode-attribute.html: Added.
12
1
2018-08-20  Rob Buis  <rbuis@igalia.com>
13
2018-08-20  Rob Buis  <rbuis@igalia.com>
2
14
3
        Throw an exception if window.open() gets passed a URL that cannot be parsed
15
        Throw an exception if window.open() gets passed a URL that cannot be parsed
- a/LayoutTests/fast/forms/inputmode-attribute-expected.txt +44 lines
Line 0 a/LayoutTests/fast/forms/inputmode-attribute-expected.txt_sec1
1
Test inputmode attribute
2
3
4
Missing value default:
5
PASS input.inputMode is ""
6
PASS input.getAttribute("inputmode") is null
7
8
Invalid value default:
9
PASS input.inputMode = "foobar"; input.inputMode is ""
10
PASS input.getAttribute("inputmode") is "foobar"
11
PASS input.setAttribute("inputmode", "baz"); input.inputMode is ""
12
13
Valid values:
14
PASS input.inputMode = "text"; input.inputMode is "text"
15
PASS input.getAttribute("inputmode") is "text"
16
PASS input.setAttribute("inputmode", "text"); input.inputMode is "text"
17
PASS input.inputMode = "tel"; input.inputMode is "tel"
18
PASS input.getAttribute("inputmode") is "tel"
19
PASS input.setAttribute("inputmode", "tel"); input.inputMode is "tel"
20
PASS input.inputMode = "url"; input.inputMode is "url"
21
PASS input.getAttribute("inputmode") is "url"
22
PASS input.setAttribute("inputmode", "url"); input.inputMode is "url"
23
PASS input.inputMode = "email"; input.inputMode is "email"
24
PASS input.getAttribute("inputmode") is "email"
25
PASS input.setAttribute("inputmode", "email"); input.inputMode is "email"
26
PASS input.inputMode = "numeric"; input.inputMode is "numeric"
27
PASS input.getAttribute("inputmode") is "numeric"
28
PASS input.setAttribute("inputmode", "numeric"); input.inputMode is "numeric"
29
PASS input.inputMode = "decimal"; input.inputMode is "decimal"
30
PASS input.getAttribute("inputmode") is "decimal"
31
PASS input.setAttribute("inputmode", "decimal"); input.inputMode is "decimal"
32
PASS input.inputMode = "search"; input.inputMode is "search"
33
PASS input.getAttribute("inputmode") is "search"
34
PASS input.setAttribute("inputmode", "search"); input.inputMode is "search"
35
36
Valid case-insensitive values:
37
PASS input.inputMode = "tExt"; input.inputMode is "text"
38
PASS input.getAttribute("inputmode") is "tExt"
39
PASS input.setAttribute("inputmode", "tExt"); input.inputMode is "text"
40
41
PASS successfullyParsed is true
42
43
TEST COMPLETE
44
- a/LayoutTests/fast/forms/inputmode-attribute.html +53 lines
Line 0 a/LayoutTests/fast/forms/inputmode-attribute.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<body>
4
<script src="../../resources/js-test-pre.js"></script>
5
<p>Test inputmode attribute</p>
6
<input id="input">
7
<div id=console></div>
8
<script>
9
debug('Missing value default:');
10
shouldBe('input.inputMode', '""');
11
shouldBeNull('input.getAttribute("inputmode")');
12
13
debug('');
14
debug('Invalid value default:');
15
shouldBe('input.inputMode = "foobar"; input.inputMode', '""');
16
shouldBe('input.getAttribute("inputmode")', '"foobar"');
17
shouldBe('input.setAttribute("inputmode", "baz"); input.inputMode', '""');
18
19
debug('');
20
debug('Valid values:');
21
shouldBe('input.inputMode = "text"; input.inputMode', '"text"');
22
shouldBe('input.getAttribute("inputmode")', '"text"');
23
shouldBe('input.setAttribute("inputmode", "text"); input.inputMode', '"text"');
24
shouldBe('input.inputMode = "tel"; input.inputMode', '"tel"');
25
shouldBe('input.getAttribute("inputmode")', '"tel"');
26
shouldBe('input.setAttribute("inputmode", "tel"); input.inputMode', '"tel"');
27
shouldBe('input.inputMode = "url"; input.inputMode', '"url"');
28
shouldBe('input.getAttribute("inputmode")', '"url"');
29
shouldBe('input.setAttribute("inputmode", "url"); input.inputMode', '"url"');
30
shouldBe('input.inputMode = "email"; input.inputMode', '"email"');
31
shouldBe('input.getAttribute("inputmode")', '"email"');
32
shouldBe('input.setAttribute("inputmode", "email"); input.inputMode', '"email"');
33
shouldBe('input.inputMode = "numeric"; input.inputMode', '"numeric"');
34
shouldBe('input.getAttribute("inputmode")', '"numeric"');
35
shouldBe('input.setAttribute("inputmode", "numeric"); input.inputMode', '"numeric"');
36
shouldBe('input.inputMode = "decimal"; input.inputMode', '"decimal"');
37
shouldBe('input.getAttribute("inputmode")', '"decimal"');
38
shouldBe('input.setAttribute("inputmode", "decimal"); input.inputMode', '"decimal"');
39
shouldBe('input.inputMode = "search"; input.inputMode', '"search"');
40
shouldBe('input.getAttribute("inputmode")', '"search"');
41
shouldBe('input.setAttribute("inputmode", "search"); input.inputMode', '"search"');
42
43
debug('');
44
debug('Valid case-insensitive values:');
45
shouldBe('input.inputMode = "tExt"; input.inputMode', '"text"');
46
shouldBe('input.getAttribute("inputmode")', '"tExt"');
47
shouldBe('input.setAttribute("inputmode", "tExt"); input.inputMode', '"text"');
48
49
debug('');
50
</script>
51
<script src="../../resources/js-test-post.js"></script>
52
</body>
53
</html>

Return to Bug 183621