Skip to content

Commit a8fbaa4

Browse files
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
https://bugs.webkit.org/show_bug.cgi?id=164538 <rdar://problem/8418711> Reviewed by Ryosuke Niwa. Source/WebCore: Adds autocorrect and autocapitalize getters and setters to HTMLElements. These check the `autocorrect` and `autocapitalize` attributes and return whether or not the element supports autocorrect, and the autocapitalization type, respectively. By default, autocorrection is enabled and autocapitalization is enabled on the sentence level for elements. Also refactors/renames WebAutocapitalizeType so that in WebCore, we deal solely with AutocapitalizeTypes and WebKit1 converts from AutocapitalizeType to WebAutocapitalizeType as needed for UIKit. Tests: fast/events/ios/contenteditable-autocapitalize.html fast/events/ios/contenteditable-autocorrect.html * WebCore.xcodeproj/project.pbxproj: * html/Autocapitalize.cpp: (WebCore::autocapitalizeTypeForAttributeValue): (WebCore::stringForAutocapitalizeType): * html/Autocapitalize.h: * html/AutocapitalizeTypes.h: Renamed from Source/WebCore/html/WebAutocapitalize.h. Move WebAutocapitalizeType into AutocapitalizeTypes.h as simply AutocapitalizeType. * html/HTMLElement.cpp: (WebCore::HTMLElement::autocapitalize): (WebCore::HTMLElement::autocapitalizeType): (WebCore::HTMLElement::setAutocapitalize): (WebCore::HTMLElement::shouldAutocorrect): (WebCore::HTMLElement::setAutocorrect): * html/HTMLElement.h: (WebCore::HTMLElement::autocorrect): * html/HTMLElement.idl: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::shouldAutocorrect): (WebCore::HTMLFormControlElement::autocapitalizeType): (WebCore::HTMLFormControlElement::autocorrect): Deleted. (WebCore::HTMLFormControlElement::setAutocorrect): Deleted. (WebCore::HTMLFormControlElement::autocapitalize): Deleted. (WebCore::HTMLFormControlElement::setAutocapitalize): Deleted. Fold autocorrect/autocapitalize member functions into HTMLElement and remove element-specific code in HTML(FormControl|Form)Element.cpp. * html/HTMLFormControlElement.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::shouldAutocorrect): (WebCore::HTMLFormElement::autocorrect): Deleted. (WebCore::HTMLFormElement::setAutocorrect): Deleted. (WebCore::HTMLFormElement::autocapitalizeType): Deleted. (WebCore::HTMLFormElement::autocapitalize): Deleted. (WebCore::HTMLFormElement::setAutocapitalize): Deleted. * html/HTMLFormElement.h: * html/HTMLFormElement.idl: * html/HTMLInputElement.idl: * html/HTMLTextAreaElement.idl: Source/WebKit: Introduce WebAutocapitalizeTypes.h to WebKit. * WebKit.xcodeproj/project.pbxproj: Source/WebKit/mac: Account for renaming HTMLElement::autocorrect to HTMLElement::shouldAutocorrect, as well as moving WebAutocapitalizeType to WebKit from WebCore. Additionally, moves the -autocorrect and -autocapitalize SPIs out of HTML(Input|Form|TextArea)ElementPrivate.h and into HTMLElementPrivate.h. This also means removing redundant code for interfacing with the unwrapped HTMLElement's autocorrect and autocapitalize attributes. * DOM/DOMHTML.mm: (webAutocapitalizeType): (-[DOMHTMLInputElement _autocapitalizeType]): (-[DOMHTMLTextAreaElement _autocapitalizeType]): * DOM/DOMHTMLElement.mm: (-[DOMHTMLElement autocorrect]): (-[DOMHTMLElement setAutocorrect:]): (-[DOMHTMLElement autocapitalize]): (-[DOMHTMLElement setAutocapitalize:]): * DOM/DOMHTMLElementPrivate.h: Copied from Source/WebCore/html/Autocapitalize.h. * DOM/DOMHTMLFormElement.mm: (-[DOMHTMLFormElement autocorrect]): Deleted. (-[DOMHTMLFormElement setAutocorrect:]): Deleted. (-[DOMHTMLFormElement autocapitalize]): Deleted. (-[DOMHTMLFormElement setAutocapitalize:]): Deleted. * DOM/DOMHTMLInputElement.mm: (-[DOMHTMLInputElement autocorrect]): Deleted. (-[DOMHTMLInputElement setAutocorrect:]): Deleted. (-[DOMHTMLInputElement autocapitalize]): Deleted. (-[DOMHTMLInputElement setAutocapitalize:]): Deleted. * DOM/DOMHTMLInputElementPrivate.h: * DOM/DOMHTMLTextAreaElement.mm: (-[DOMHTMLTextAreaElement autocorrect]): Deleted. (-[DOMHTMLTextAreaElement setAutocorrect:]): Deleted. (-[DOMHTMLTextAreaElement autocapitalize]): Deleted. (-[DOMHTMLTextAreaElement setAutocapitalize:]): Deleted. * DOM/DOMHTMLTextAreaElementPrivate.h: We need to import DOMHTMLElementPrivate.h here to avoid breaking UIKit. We should follow this up with a UIKit change to import DOMHTMLElementPrivate.h directly. * DOM/DOMPrivate.h: * DOM/WebAutocapitalizeTypes.h: Copied from Tools/WebKitTestRunner/ios/UIKitSPI.h. * MigrateHeaders.make: Source/WebKit2: Consult HTMLElement::autocorrect() and HTMLElement::autocapitalizeType() when assembling the assisted node information for the currently assisted node. * Shared/AssistedNodeInformation.h: * UIProcess/ios/WKContentViewInteraction.mm: (toUITextAutocapitalize): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getAssistedNodeInformation): Tools: Adds support for being able to test autocorrect and autocapitalize attributes in contenteditable areas. To do this, we add removeAllDynamicDictionaries to UIScriptController in order to ensure that autocorrect suggestions are reset to their defaults prior to running contenteditable-autocorrect-off.html. * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::removeAllDynamicDictionaries): * Scripts/webkitpy/port/ios.py: (IOSSimulatorPort._createSimulatorApp): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::removeAllDynamicDictionaries): * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: (-[TestRunnerWKWebView _keyboardDidShow:]): (-[TestRunnerWKWebView _keyboardDidHide:]): Work around an issue where consecutive UIKeyboardDidShowNotification would cause keyboard appearance callbacks to be fired multiple times. This was causing a single key press to cause two characters to be typed. While this does not affect the correctness of existing tests, the new autocorrection test requires this workaround. * WebKitTestRunner/ios/UIKitSPI.h: * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex): (WTR::UIScriptController::removeAllDynamicDictionaries): LayoutTests: Adds new layout tests verifying that `autocorrect` and `autocapitalize` attributes can be used to opt out of autocapitalization and autocorrection in a contenteditable area in WK2. Additionally, tests that autocorrection and autocapitalization attributes may be changed by setting `element.autocorrect` and `element.autocapitalize`, respectively. * fast/events/ios/contenteditable-autocapitalize-none-expected.txt: Added. * fast/events/ios/contenteditable-autocapitalize-none.html: Added. * fast/events/ios/contenteditable-autocorrect-off-expected.txt: Added. * fast/events/ios/contenteditable-autocorrect-off.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@208624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3b189c3 commit a8fbaa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+618
-206
lines changed

LayoutTests/ChangeLog

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2016-11-11 Wenson Hsieh <[email protected]>
2+
3+
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
4+
https://bugs.webkit.org/show_bug.cgi?id=164538
5+
<rdar://problem/8418711>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
Adds new layout tests verifying that `autocorrect` and `autocapitalize` attributes can be used to opt out of
10+
autocapitalization and autocorrection in a contenteditable area in WK2. Additionally, tests that autocorrection
11+
and autocapitalization attributes may be changed by setting `element.autocorrect` and `element.autocapitalize`,
12+
respectively.
13+
14+
* fast/events/ios/contenteditable-autocapitalize-none-expected.txt: Added.
15+
* fast/events/ios/contenteditable-autocapitalize-none.html: Added.
16+
* fast/events/ios/contenteditable-autocorrect-off-expected.txt: Added.
17+
* fast/events/ios/contenteditable-autocorrect-off.html: Added.
18+
119
2016-11-11 Antti Koivisto <[email protected]>
220

321
Updating class name doesn't update the slotted content's style
@@ -67,7 +85,7 @@
6785

6886
* platform/ios-simulator/compositing/tiling/visiblerect-accumulated-offset-expected.txt: Added.
6987

70-
2016-11-11 Wenson Hsieh <[email protected]>
88+
2016-11-10 Wenson Hsieh <[email protected]>
7189

7290
Composition state should be cleared when changing focus to a non-editable element
7391
https://bugs.webkit.org/show_bug.cgi?id=164595
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To manually test, type 't' into the contenteditable. The 't' should not be autocapitalized.
2+
3+
With autocapitalize: none, the output is: "to"
4+
With autocapitalize: sentences, the output is: "To"
5+
With autocapitalize: characters, the output is: "TO"
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2+
3+
<html>
4+
5+
<head>
6+
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
7+
<script>
8+
let write = message => output.innerHTML += message + "<br>";
9+
if (window.testRunner) {
10+
testRunner.dumpAsText();
11+
testRunner.waitUntilDone();
12+
}
13+
14+
let remainingInputEventCount = 0;
15+
let resolveExpectedInputEvents = null;
16+
function handleInput() {
17+
remainingInputEventCount--;
18+
if (resolveExpectedInputEvents && !remainingInputEventCount)
19+
resolveExpectedInputEvents();
20+
}
21+
22+
function runUIScriptAndExpectInputEvents(inputEventCount, nextAutocapitalizeType)
23+
{
24+
remainingInputEventCount = inputEventCount;
25+
resolveExpectedInputEvents = () => {
26+
write(`With autocapitalize: ${editable.autocapitalize}, the output is: "${editable.textContent}"`);
27+
editable.autocapitalize = nextAutocapitalizeType;
28+
editable.textContent = "";
29+
editable.blur();
30+
};
31+
32+
return new Promise(function(resolve) {
33+
let rect = editable.getBoundingClientRect();
34+
testRunner.runUIScript(`(function() {
35+
uiController.didShowKeyboardCallback = function() {
36+
uiController.typeCharacterUsingHardwareKeyboard("t", function() {
37+
uiController.typeCharacterUsingHardwareKeyboard("o", function() {});
38+
});
39+
}
40+
uiController.didHideKeyboardCallback = function() {
41+
uiController.uiScriptComplete();
42+
}
43+
uiController.singleTapAtPoint(${rect.left + rect.width / 2}, ${rect.top + rect.height / 2}, function() {});
44+
})();`, resolve);
45+
});
46+
}
47+
48+
function runTest()
49+
{
50+
if (!window.testRunner || !testRunner.runUIScript)
51+
return;
52+
53+
runUIScriptAndExpectInputEvents(2, "sentences")
54+
.then(() => runUIScriptAndExpectInputEvents(2, "characters"))
55+
.then(() => runUIScriptAndExpectInputEvents(2, null))
56+
.then(() => testRunner.notifyDone());
57+
}
58+
</script>
59+
<style>
60+
#editable {
61+
width: 200px;
62+
height: 100px;
63+
top: 0;
64+
left: 0;
65+
position: absolute;
66+
}
67+
</style>
68+
</head>
69+
70+
<body onload=runTest()>
71+
<div contenteditable autocapitalize="none" id="editable" oninput=handleInput()></div>
72+
<p>To manually test, type 't' into the contenteditable. The 't' should not be autocapitalized.</p>
73+
<div id="output"></div>
74+
</body>
75+
76+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To manually test, type 'Ti' into the contenteditable and a space. The 'Ti' should not be autocorrected.
2+
3+
With autocorrect off, the result is: "Ti"
4+
With autocorrect on, the result is: "To"
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2+
3+
<html>
4+
5+
<head>
6+
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
7+
<script>
8+
let write = message => output.innerHTML += message + "<br>";
9+
if (window.testRunner) {
10+
testRunner.dumpAsText();
11+
testRunner.waitUntilDone();
12+
}
13+
14+
let remainingInputEventCount = 0;
15+
let resolveExpectedInputEvents = null;
16+
function handleInput() {
17+
remainingInputEventCount--;
18+
if (resolveExpectedInputEvents && !remainingInputEventCount)
19+
resolveExpectedInputEvents();
20+
}
21+
22+
function runUIScriptAndExpectInputEvents(inputEventCount, nextAutocorrectValue)
23+
{
24+
remainingInputEventCount = inputEventCount;
25+
resolveExpectedInputEvents = () => {
26+
write(`With autocorrect ${editable.autocorrect ? "on" : "off"}, the result is: "${editable.textContent.trim()}"`);
27+
editable.textContent = "";
28+
editable.autocorrect = nextAutocorrectValue;
29+
editable.blur();
30+
};
31+
32+
return new Promise(function(resolve) {
33+
let rect = editable.getBoundingClientRect();
34+
testRunner.runUIScript(`(function() {
35+
uiController.removeAllDynamicDictionaries();
36+
uiController.didShowKeyboardCallback = function() {
37+
uiController.typeCharacterUsingHardwareKeyboard("t", function() {
38+
uiController.typeCharacterUsingHardwareKeyboard("i", function() {
39+
uiController.typeCharacterUsingHardwareKeyboard(" ", function() { });
40+
});
41+
});
42+
}
43+
uiController.didHideKeyboardCallback = function() {
44+
uiController.uiScriptComplete();
45+
}
46+
uiController.singleTapAtPoint(${rect.left + rect.width / 2}, ${rect.top + rect.height / 2}, function() {});
47+
})();`, resolve);
48+
});
49+
}
50+
51+
function runTest()
52+
{
53+
if (!window.testRunner || !testRunner.runUIScript)
54+
return;
55+
56+
runUIScriptAndExpectInputEvents(3, "on")
57+
.then(() => runUIScriptAndExpectInputEvents(4, null))
58+
.then(() => testRunner.notifyDone());
59+
}
60+
</script>
61+
<style>
62+
#editable {
63+
width: 200px;
64+
height: 100px;
65+
top: 0;
66+
left: 0;
67+
position: absolute;
68+
}
69+
</style>
70+
</head>
71+
72+
<body onload=runTest()>
73+
<div style="font-size: 24px;" contenteditable autocorrect="off" id="editable" oninput=handleInput()></div>
74+
<p>To manually test, type 'Ti' into the contenteditable and a space. The 'Ti' should not be autocorrected.</p>
75+
<code><div id="output"></div></code>
76+
</body>
77+
78+
</html>

Source/WebCore/ChangeLog

+61-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,63 @@
1+
2016-11-11 Wenson Hsieh <[email protected]>
2+
3+
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
4+
https://bugs.webkit.org/show_bug.cgi?id=164538
5+
<rdar://problem/8418711>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
Adds autocorrect and autocapitalize getters and setters to HTMLElements. These check the `autocorrect` and
10+
`autocapitalize` attributes and return whether or not the element supports autocorrect, and the
11+
autocapitalization type, respectively. By default, autocorrection is enabled and autocapitalization is enabled
12+
on the sentence level for elements. Also refactors/renames WebAutocapitalizeType so that in WebCore, we deal
13+
solely with AutocapitalizeTypes and WebKit1 converts from AutocapitalizeType to WebAutocapitalizeType as needed
14+
for UIKit.
15+
16+
Tests: fast/events/ios/contenteditable-autocapitalize.html
17+
fast/events/ios/contenteditable-autocorrect.html
18+
19+
* WebCore.xcodeproj/project.pbxproj:
20+
* html/Autocapitalize.cpp:
21+
(WebCore::autocapitalizeTypeForAttributeValue):
22+
(WebCore::stringForAutocapitalizeType):
23+
* html/Autocapitalize.h:
24+
* html/AutocapitalizeTypes.h: Renamed from Source/WebCore/html/WebAutocapitalize.h.
25+
26+
Move WebAutocapitalizeType into AutocapitalizeTypes.h as simply AutocapitalizeType.
27+
28+
* html/HTMLElement.cpp:
29+
(WebCore::HTMLElement::autocapitalize):
30+
(WebCore::HTMLElement::autocapitalizeType):
31+
(WebCore::HTMLElement::setAutocapitalize):
32+
(WebCore::HTMLElement::shouldAutocorrect):
33+
(WebCore::HTMLElement::setAutocorrect):
34+
* html/HTMLElement.h:
35+
(WebCore::HTMLElement::autocorrect):
36+
* html/HTMLElement.idl:
37+
* html/HTMLFormControlElement.cpp:
38+
(WebCore::HTMLFormControlElement::shouldAutocorrect):
39+
(WebCore::HTMLFormControlElement::autocapitalizeType):
40+
(WebCore::HTMLFormControlElement::autocorrect): Deleted.
41+
(WebCore::HTMLFormControlElement::setAutocorrect): Deleted.
42+
(WebCore::HTMLFormControlElement::autocapitalize): Deleted.
43+
(WebCore::HTMLFormControlElement::setAutocapitalize): Deleted.
44+
45+
Fold autocorrect/autocapitalize member functions into HTMLElement and remove element-specific code in
46+
HTML(FormControl|Form)Element.cpp.
47+
48+
* html/HTMLFormControlElement.h:
49+
* html/HTMLFormElement.cpp:
50+
(WebCore::HTMLFormElement::shouldAutocorrect):
51+
(WebCore::HTMLFormElement::autocorrect): Deleted.
52+
(WebCore::HTMLFormElement::setAutocorrect): Deleted.
53+
(WebCore::HTMLFormElement::autocapitalizeType): Deleted.
54+
(WebCore::HTMLFormElement::autocapitalize): Deleted.
55+
(WebCore::HTMLFormElement::setAutocapitalize): Deleted.
56+
* html/HTMLFormElement.h:
57+
* html/HTMLFormElement.idl:
58+
* html/HTMLInputElement.idl:
59+
* html/HTMLTextAreaElement.idl:
60+
161
2016-11-11 Dave Hyatt <[email protected]>
262

363
[CSS Parser] Add support for paths as basic shapes.
@@ -912,7 +972,7 @@
912972
* css/parser/CSSPropertyParser.cpp:
913973
(WebCore::CSSPropertyParser::parseShorthand):
914974

915-
2016-11-11 Wenson Hsieh <[email protected]>
975+
2016-11-10 Wenson Hsieh <[email protected]>
916976

917977
Composition state should be cleared when changing focus to a non-editable element
918978
https://bugs.webkit.org/show_bug.cgi?id=164595

Source/WebCore/WebCore.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@
39863986
A593CF8B1840535200BFCE27 /* InspectorWebAgentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF8A1840535200BFCE27 /* InspectorWebAgentBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
39873987
A5A2AF0B1829734300DE1729 /* PageDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5A2AF091829734300DE1729 /* PageDebuggable.cpp */; };
39883988
A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A2AF0A1829734300DE1729 /* PageDebuggable.h */; };
3989-
A5A7AA43132F0ECC00D3A3C2 /* WebAutocapitalize.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A7AA42132F0ECC00D3A3C2 /* WebAutocapitalize.h */; settings = {ATTRIBUTES = (Private, ); }; };
3989+
A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A7AA42132F0ECC00D3A3C2 /* AutocapitalizeTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
39903990
A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AFB34D115151A700B045CB /* StepRange.cpp */; };
39913991
A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
39923992
A5DEBDA316FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */; };
@@ -11592,7 +11592,7 @@
1159211592
A593CF8A1840535200BFCE27 /* InspectorWebAgentBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebAgentBase.h; sourceTree = "<group>"; };
1159311593
A5A2AF091829734300DE1729 /* PageDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageDebuggable.cpp; sourceTree = "<group>"; };
1159411594
A5A2AF0A1829734300DE1729 /* PageDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageDebuggable.h; sourceTree = "<group>"; };
11595-
A5A7AA42132F0ECC00D3A3C2 /* WebAutocapitalize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAutocapitalize.h; sourceTree = "<group>"; };
11595+
A5A7AA42132F0ECC00D3A3C2 /* AutocapitalizeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutocapitalizeTypes.h; sourceTree = "<group>"; };
1159611596
A5AFB34D115151A700B045CB /* StepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepRange.cpp; sourceTree = "<group>"; };
1159711597
A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = "<group>"; };
1159811598
A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyEventCocoa.h; sourceTree = "<group>"; };
@@ -18505,6 +18505,7 @@
1850518505
B1AD4E7713A12A7200846B27 /* track */,
1850618506
A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */,
1850718507
A501920C132EBF2E008BFE55 /* Autocapitalize.h */,
18508+
A5A7AA42132F0ECC00D3A3C2 /* AutocapitalizeTypes.h */,
1850818509
7C1843FB1C8B7283002EB973 /* Autofill.cpp */,
1850918510
7C1843FC1C8B7283002EB973 /* Autofill.h */,
1851018511
379E61C5126CA5C300B63E8D /* BaseButtonInputType.cpp */,
@@ -18919,7 +18920,6 @@
1891918920
15C77089100D3C6A005BA267 /* ValidityState.idl */,
1892018921
E44613B40CD6344E00FADA75 /* VoidCallback.h */,
1892118922
E44613A00CD6331000FADA75 /* VoidCallback.idl */,
18922-
A5A7AA42132F0ECC00D3A3C2 /* WebAutocapitalize.h */,
1892318923
2D1932171DA64E1900A54A08 /* WebKitMediaKeyError.h */,
1892418924
2D1932181DA64E1900A54A08 /* WebKitMediaKeyError.idl */,
1892518925
F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */,
@@ -27991,7 +27991,7 @@
2799127991
AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */,
2799227992
2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */,
2799327993
07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */,
27994-
A5A7AA43132F0ECC00D3A3C2 /* WebAutocapitalize.h in Headers */,
27994+
A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */,
2799527995
A56C5B9B189F34570082D13C /* WebConsoleAgent.h in Headers */,
2799627996
419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */,
2799727997
2D3EF44A1917915C00034184 /* WebCoreCALayerExtras.h in Headers */,

Source/WebCore/html/Autocapitalize.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,43 @@
3030

3131
namespace WebCore {
3232

33-
WebAutocapitalizeType autocapitalizeTypeForAttributeValue(const AtomicString& attributeValue)
33+
AutocapitalizeType autocapitalizeTypeForAttributeValue(const AtomicString& attributeValue)
3434
{
3535
// Omitted / missing values are the Default state.
3636
if (attributeValue.isEmpty())
37-
return WebAutocapitalizeTypeDefault;
37+
return AutocapitalizeTypeDefault;
3838

3939
if (equalLettersIgnoringASCIICase(attributeValue, "on") || equalLettersIgnoringASCIICase(attributeValue, "sentences"))
40-
return WebAutocapitalizeTypeSentences;
40+
return AutocapitalizeTypeSentences;
4141
if (equalLettersIgnoringASCIICase(attributeValue, "off") || equalLettersIgnoringASCIICase(attributeValue, "none"))
42-
return WebAutocapitalizeTypeNone;
42+
return AutocapitalizeTypeNone;
4343
if (equalLettersIgnoringASCIICase(attributeValue, "words"))
44-
return WebAutocapitalizeTypeWords;
44+
return AutocapitalizeTypeWords;
4545
if (equalLettersIgnoringASCIICase(attributeValue, "characters"))
46-
return WebAutocapitalizeTypeAllCharacters;
46+
return AutocapitalizeTypeAllCharacters;
4747

4848
// Unrecognized values fall back to "on".
49-
return WebAutocapitalizeTypeSentences;
49+
return AutocapitalizeTypeSentences;
5050
}
5151

52-
const AtomicString& stringForAutocapitalizeType(WebAutocapitalizeType type)
52+
const AtomicString& stringForAutocapitalizeType(AutocapitalizeType type)
5353
{
5454
switch (type) {
55-
case WebAutocapitalizeTypeDefault:
55+
case AutocapitalizeTypeDefault:
5656
return nullAtom;
57-
case WebAutocapitalizeTypeNone: {
57+
case AutocapitalizeTypeNone: {
5858
static NeverDestroyed<const AtomicString> valueNone("none", AtomicString::ConstructFromLiteral);
5959
return valueNone;
6060
}
61-
case WebAutocapitalizeTypeSentences: {
61+
case AutocapitalizeTypeSentences: {
6262
static NeverDestroyed<const AtomicString> valueSentences("sentences", AtomicString::ConstructFromLiteral);
6363
return valueSentences;
6464
}
65-
case WebAutocapitalizeTypeWords: {
65+
case AutocapitalizeTypeWords: {
6666
static NeverDestroyed<const AtomicString> valueWords("words", AtomicString::ConstructFromLiteral);
6767
return valueWords;
6868
}
69-
case WebAutocapitalizeTypeAllCharacters: {
69+
case AutocapitalizeTypeAllCharacters: {
7070
static NeverDestroyed<const AtomicString> valueAllCharacters("characters", AtomicString::ConstructFromLiteral);
7171
return valueAllCharacters;
7272
}

Source/WebCore/html/Autocapitalize.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626
#pragma once
2727

28-
#include "WebAutocapitalize.h"
28+
#include "AutocapitalizeTypes.h"
2929
#include <wtf/text/AtomicString.h>
3030

3131
namespace WebCore {
3232

33-
WebAutocapitalizeType autocapitalizeTypeForAttributeValue(const AtomicString&);
34-
const AtomicString& stringForAutocapitalizeType(WebAutocapitalizeType);
33+
AutocapitalizeType autocapitalizeTypeForAttributeValue(const AtomicString&);
34+
const AtomicString& stringForAutocapitalizeType(AutocapitalizeType);
3535

3636
} // namespace WebCore

0 commit comments

Comments
 (0)