⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271414 in webkit


Ignore:
Timestamp:
Jan 12, 2021, 1:59:42 PM (6 years ago)
Author:
Wenson Hsieh
Message:

REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com
https://bugs.webkit.org/show_bug.cgi?id=220556
<rdar://problem/71602937>

Reviewed by Darin Adler.

Source/WebCore:

Add an internal testing hook to ask an input element whether it has disabled spellchecking (except for text
replacement).

  • testing/Internals.cpp:

(WebCore::Internals::isSpellcheckDisabledExceptTextReplacement const):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit:

Restores the implementation of WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled, which was removed in
r265044, with the reasoning that the code was unused. However, Safari still uses this SPI on macOS to prevent
automatic spelling correction from triggering when editing form fields that are AutoFillable.

Test: WebKit.DisableSpellcheck

  • WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:

(WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled):

Tools:

Add an API test that uses WebKit C API (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled) to disable or
enable spellchecking on input elements.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheck.mm: Added.
  • TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheckPlugIn.mm: Added.

(-[DisableSpellcheckPlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didClearWindowObjectForFrame:inScriptWorld:]):
(-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didFinishLoadForFrame:]):

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r271405 r271414  
     12021-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com
     4        https://bugs.webkit.org/show_bug.cgi?id=220556
     5        <rdar://problem/71602937>
     6
     7        Reviewed by Darin Adler.
     8
     9        Add an internal testing hook to ask an input element whether it has disabled spellchecking (except for text
     10        replacement).
     11
     12        * testing/Internals.cpp:
     13        (WebCore::Internals::isSpellcheckDisabledExceptTextReplacement const):
     14        * testing/Internals.h:
     15        * testing/Internals.idl:
     16
    1172021-01-12  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebCore/testing/Internals.cpp

    r271401 r271414  
    24902490}
    24912491
     2492bool Internals::isSpellcheckDisabledExceptTextReplacement(const HTMLInputElement& element) const
     2493{
     2494    return element.isSpellcheckDisabledExceptTextReplacement();
     2495}
     2496
    24922497void Internals::handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length)
    24932498{
  • trunk/Source/WebCore/testing/Internals.h

    r270919 r271414  
    369369    void setAutomaticSpellingCorrectionEnabled(bool);
    370370
     371    bool isSpellcheckDisabledExceptTextReplacement(const HTMLInputElement&) const;
     372
    371373    void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length);
    372374    void changeSelectionListType();
  • trunk/Source/WebCore/testing/Internals.idl

    r270919 r271414  
    380380
    381381    [MayThrowException] DOMString autofillFieldName(Element formControlElement);
     382    boolean isSpellcheckDisabledExceptTextReplacement(HTMLInputElement inputElement);
    382383
    383384    [MayThrowException] undefined invalidateControlTints();
  • trunk/Source/WebKit/ChangeLog

    r271408 r271414  
     12021-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com
     4        https://bugs.webkit.org/show_bug.cgi?id=220556
     5        <rdar://problem/71602937>
     6
     7        Reviewed by Darin Adler.
     8
     9        Restores the implementation of `WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`, which was removed in
     10        r265044, with the reasoning that the code was unused. However, Safari still uses this SPI on macOS to prevent
     11        automatic spelling correction from triggering when editing form fields that are AutoFillable.
     12
     13        Test: WebKit.DisableSpellcheck
     14
     15        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
     16        (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled):
     17
    1182021-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
    219
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp

    r265044 r271414  
    116116}
    117117
    118 void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef, bool)
    119 {
    120     // FIXME: Would put ASSERT_NOT_REACHED() here but some compilers are warning the function is "noreturn".
     118void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled)
     119{
     120    WebKit::toImpl(htmlInputElementHandleRef)->setHTMLInputElementSpellcheckEnabled(enabled);
    121121}
    122122
  • trunk/Tools/ChangeLog

    r271406 r271414  
     12021-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com
     4        https://bugs.webkit.org/show_bug.cgi?id=220556
     5        <rdar://problem/71602937>
     6
     7        Reviewed by Darin Adler.
     8
     9        Add an API test that uses WebKit C API (`WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`) to disable or
     10        enable spellchecking on input elements.
     11
     12        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     13        * TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheck.mm: Added.
     14        * TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheckPlugIn.mm: Added.
     15        (-[DisableSpellcheckPlugIn webProcessPlugIn:didCreateBrowserContextController:]):
     16        (-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didClearWindowObjectForFrame:inScriptWorld:]):
     17        (-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didFinishLoadForFrame:]):
     18
    1192021-01-12  Aakash Jain  <aakash_jain@apple.com>
    220
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r271245 r271414  
    11831183                F4A9202F1FEE34E900F59590 /* apple-data-url.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4A9202E1FEE34C800F59590 /* apple-data-url.html */; };
    11841184                F4AB578A1F65165400DB0DA1 /* custom-draggable-div.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4AB57891F65164B00DB0DA1 /* custom-draggable-div.html */; };
     1185                F4B0168325AE060F00E445C4 /* DisableSpellcheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4B0168225AE060F00E445C4 /* DisableSpellcheck.mm */; };
     1186                F4B0168425AE08F800E445C4 /* DisableSpellcheckPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4B0167F25AE02D600E445C4 /* DisableSpellcheckPlugIn.mm */; };
    11851187                F4B825D81EF4DBFB006E417F /* compressed-files.zip in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B825D61EF4DBD4006E417F /* compressed-files.zip */; };
    11861188                F4B86D4F20BCD5B20099A7E6 /* paint-significant-area-milestone.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */; };
     
    29482950                F4A9202E1FEE34C800F59590 /* apple-data-url.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "apple-data-url.html"; sourceTree = "<group>"; };
    29492951                F4AB57891F65164B00DB0DA1 /* custom-draggable-div.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "custom-draggable-div.html"; sourceTree = "<group>"; };
     2952                F4B0167F25AE02D600E445C4 /* DisableSpellcheckPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DisableSpellcheckPlugIn.mm; sourceTree = "<group>"; };
     2953                F4B0168225AE060F00E445C4 /* DisableSpellcheck.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DisableSpellcheck.mm; sourceTree = "<group>"; };
    29502954                F4B825D61EF4DBD4006E417F /* compressed-files.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "compressed-files.zip"; sourceTree = "<group>"; };
    29512955                F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "paint-significant-area-milestone.html"; sourceTree = "<group>"; };
     
    32773281                                46918EFB2237283500468DFE /* DeviceOrientation.mm */,
    32783282                                CEA7F57B20895F5B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm */,
     3283                                F4B0168225AE060F00E445C4 /* DisableSpellcheck.mm */,
     3284                                F4B0167F25AE02D600E445C4 /* DisableSpellcheckPlugIn.mm */,
    32793285                                73BD731723A846500020F450 /* DisplayName.mm */,
    32803286                                518EE51A20A78CFB00E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm */,
     
    55155521                                7CCE7ED01A411A7E00447C4C /* StringByEvaluatingJavaScriptFromString.mm in Sources */,
    55165522                                7CCE7ED11A411A7E00447C4C /* StringTruncator.mm in Sources */,
     5523                                F4B0168325AE060F00E445C4 /* DisableSpellcheck.mm in Sources */,
    55175524                                ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */,
    55185525                                CE4D5DE71F6743BA0072CFC6 /* StringWithDirection.cpp in Sources */,
     
    56985705                                374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */,
    56995706                                7A89BB682331643A0042CB1E /* BundleFormDelegatePlugIn.mm in Sources */,
     5707                                F4B0168425AE08F800E445C4 /* DisableSpellcheckPlugIn.mm in Sources */,
    57005708                                A13EBBB01B87436F00097110 /* BundleParametersPlugIn.mm in Sources */,
    57015709                                37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.