Title: [244457] trunk/Source
Revision
244457
Author
[email protected]
Date
2019-04-19 11:17:15 -0700 (Fri, 19 Apr 2019)

Log Message

[iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
https://bugs.webkit.org/show_bug.cgi?id=197102
<rdar://problem/49864669>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Add a quirk to disable autocorrection and autocapitalization in hidden editable areas.

* page/Quirks.cpp:
(WebCore::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreasForHost):
(WebCore::Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas const):
* page/Quirks.h:

Source/WebKit:

If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getFocusedElementInformation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244456 => 244457)


--- trunk/Source/WebCore/ChangeLog	2019-04-19 18:03:44 UTC (rev 244456)
+++ trunk/Source/WebCore/ChangeLog	2019-04-19 18:17:15 UTC (rev 244457)
@@ -1,3 +1,18 @@
+2019-04-19  Wenson Hsieh  <[email protected]>
+
+        [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=197102
+        <rdar://problem/49864669>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a quirk to disable autocorrection and autocapitalization in hidden editable areas.
+
+        * page/Quirks.cpp:
+        (WebCore::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreasForHost):
+        (WebCore::Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas const):
+        * page/Quirks.h:
+
 2019-04-18  Fujii Hironori  <[email protected]>
 
         Implement KeyedDecoderGeneric and KeyedEncoderGeneric

Modified: trunk/Source/WebCore/page/Quirks.cpp (244456 => 244457)


--- trunk/Source/WebCore/page/Quirks.cpp	2019-04-19 18:03:44 UTC (rev 244456)
+++ trunk/Source/WebCore/page/Quirks.cpp	2019-04-19 18:17:15 UTC (rev 244457)
@@ -195,6 +195,25 @@
     return false;
 }
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/QuirksAdditions.cpp>
+#else
+
+static bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreasForHost(const StringView&)
+{
+    return false;
+}
+
+#endif
+
+bool Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const
+{
+    if (!needsQuirks())
+        return false;
+
+    return shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreasForHost(m_document->topDocument().url().host());
+}
+
 bool Quirks::shouldDispatchSimulatedMouseEvents() const
 {
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebCore/page/Quirks.h (244456 => 244457)


--- trunk/Source/WebCore/page/Quirks.h	2019-04-19 18:03:44 UTC (rev 244456)
+++ trunk/Source/WebCore/page/Quirks.h	2019-04-19 18:17:15 UTC (rev 244457)
@@ -48,6 +48,7 @@
     bool shouldDispatchSimulatedMouseEvents() const;
     bool shouldDisablePointerEventsQuirk() const;
 
+    WEBCORE_EXPORT bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const;
     WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
     WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
 

Modified: trunk/Source/WebKit/ChangeLog (244456 => 244457)


--- trunk/Source/WebKit/ChangeLog	2019-04-19 18:03:44 UTC (rev 244456)
+++ trunk/Source/WebKit/ChangeLog	2019-04-19 18:17:15 UTC (rev 244457)
@@ -1,3 +1,17 @@
+2019-04-19  Wenson Hsieh  <[email protected]>
+
+        [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=197102
+        <rdar://problem/49864669>
+
+        Reviewed by Ryosuke Niwa.
+
+        If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
+        whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getFocusedElementInformation):
+
 2019-04-19  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r244447.

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (244456 => 244457)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-04-19 18:03:44 UTC (rev 244456)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-04-19 18:17:15 UTC (rev 244457)
@@ -106,6 +106,7 @@
 #import <WebCore/Pasteboard.h>
 #import <WebCore/PlatformKeyboardEvent.h>
 #import <WebCore/PlatformMouseEvent.h>
+#import <WebCore/Quirks.h>
 #import <WebCore/RenderBlock.h>
 #import <WebCore/RenderImage.h>
 #import <WebCore/RenderThemeIOS.h>
@@ -2732,6 +2733,11 @@
         }
         information.isReadOnly = false;
     }
+
+    if (m_focusedElement->document().quirks().shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() && m_focusedElement->renderer() && enclosingLayerIsTransparentOrFullyClipped(*m_focusedElement->renderer())) {
+        information.autocapitalizeType = AutocapitalizeTypeNone;
+        information.isAutocorrect = false;
+    }
 }
 
 void WebPage::autofillLoginCredentials(const String& username, const String& password)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to