Title: [261261] trunk/Source
Revision
261261
Author
za...@apple.com
Date
2020-05-06 17:18:02 -0700 (Wed, 06 May 2020)

Log Message

[ContentObservation] Shutterstock search bar is not activated on the first tap
https://bugs.webkit.org/show_bug.cgi?id=211529
<rdar://problem/58843932>

Reviewed by Simon Fraser.

Source/WebCore:

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

Source/WebKit:

Shutterstock has a “initial click” action which converts some “actionable” elements (<a>) to some other “actionable” elements (<button>).
If this initial click also happens to be on an element that triggers content observation (input), we see those changes as actionable content and not proceed with the click event (stay at hover).
Any subsequent click works as expected.
It’s very difficult to eliminate such false positives since all we see is that some "actionable" content is going away while some "actionable" content is being created.
This quirk ensures that the first tap on the page does not trigger content observation. (It also means that any hover menu gets submitted on the first tap, but apparently
the Shutterstock top menu bar works fine with click events.)

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didStartPageTransition):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261260 => 261261)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 00:18:02 UTC (rev 261261)
@@ -1,3 +1,15 @@
+2020-05-06  Zalan Bujtas  <za...@apple.com>
+
+        [ContentObservation] Shutterstock search bar is not activated on the first tap
+        https://bugs.webkit.org/show_bug.cgi?id=211529
+        <rdar://problem/58843932>
+
+        Reviewed by Simon Fraser.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::shouldIgnoreContentObservationForSyntheticClick const):
+        * page/Quirks.h:
+
 2020-05-06  Jack Lee  <shihchieh_...@apple.com>
 
         Nullptr crash in indentOutdentCommand::formatRange with asynchronous commands: indent and insert list.

Modified: trunk/Source/WebCore/page/Quirks.cpp (261260 => 261261)


--- trunk/Source/WebCore/page/Quirks.cpp	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebCore/page/Quirks.cpp	2020-05-07 00:18:02 UTC (rev 261261)
@@ -799,4 +799,13 @@
     return m_document->url().host().endsWithIgnoringASCIICase(".wikipedia.org");
 }
 
+bool Quirks::shouldIgnoreContentObservationForSyntheticClick(bool isFirstSyntheticClickOnPage) const
+{
+    if (!needsQuirks())
+        return false;
+
+    auto host = m_document->url().host();
+    return isFirstSyntheticClickOnPage && (equalLettersIgnoringASCIICase(host, "shutterstock.com") || host.endsWithIgnoringASCIICase(".shutterstock.com"));
 }
+
+}

Modified: trunk/Source/WebCore/page/Quirks.h (261260 => 261261)


--- trunk/Source/WebCore/page/Quirks.h	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebCore/page/Quirks.h	2020-05-07 00:18:02 UTC (rev 261261)
@@ -75,6 +75,7 @@
     WEBCORE_EXPORT bool shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation() const;
     WEBCORE_EXPORT bool shouldIgnoreAriaForFastPathContentObservationCheck() const;
     WEBCORE_EXPORT bool shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints() const;
+    WEBCORE_EXPORT bool shouldIgnoreContentObservationForSyntheticClick(bool isFirstSyntheticClickOnPage) const;
 
     WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
     

Modified: trunk/Source/WebKit/ChangeLog (261260 => 261261)


--- trunk/Source/WebKit/ChangeLog	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebKit/ChangeLog	2020-05-07 00:18:02 UTC (rev 261261)
@@ -1,3 +1,24 @@
+2020-05-06  Zalan Bujtas  <za...@apple.com>
+
+        [ContentObservation] Shutterstock search bar is not activated on the first tap
+        https://bugs.webkit.org/show_bug.cgi?id=211529
+        <rdar://problem/58843932>
+
+        Reviewed by Simon Fraser.
+
+        Shutterstock has a “initial click” action which converts some “actionable” elements (<a>) to some other “actionable” elements (<button>).
+        If this initial click also happens to be on an element that triggers content observation (input), we see those changes as actionable content and not proceed with the click event (stay at hover).
+        Any subsequent click works as expected.
+        It’s very difficult to eliminate such false positives since all we see is that some "actionable" content is going away while some "actionable" content is being created.
+        This quirk ensures that the first tap on the page does not trigger content observation. (It also means that any hover menu gets submitted on the first tap, but apparently
+        the Shutterstock top menu bar works fine with click events.)
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didStartPageTransition):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleSyntheticClick):
+
 2020-05-06  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Use CocoaColor in more places instead of platform defines

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (261260 => 261261)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-05-07 00:18:02 UTC (rev 261261)
@@ -3298,6 +3298,8 @@
 
 #if PLATFORM(IOS_FAMILY)
     m_isShowingInputViewForFocusedElement = false;
+    // This is used to enable a first-tap quirk.
+    m_hasHandledSyntheticClick = false;
 #endif
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (261260 => 261261)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-05-07 00:18:02 UTC (rev 261261)
@@ -1967,6 +1967,7 @@
     WebCore::IntPoint m_lastInteractionLocation;
 
     bool m_isShowingInputViewForFocusedElement { false };
+    bool m_hasHandledSyntheticClick { false };
     
     enum SelectionAnchor { Start, End };
     SelectionAnchor m_selectionAnchor { Start };

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


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-07 00:00:33 UTC (rev 261260)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-07 00:18:02 UTC (rev 261261)
@@ -710,12 +710,15 @@
 
 void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers, WebCore::PointerID pointerId)
 {
-    if (!nodeRespondingToClick.document().settings().contentChangeObserverEnabled()) {
+    auto& respondingDocument = nodeRespondingToClick.document();
+    auto isFirstSyntheticClickOnPage = !m_hasHandledSyntheticClick;
+    m_hasHandledSyntheticClick = true;
+
+    if (!respondingDocument.settings().contentChangeObserverEnabled() || respondingDocument.quirks().shouldIgnoreContentObservationForSyntheticClick(isFirstSyntheticClickOnPage)) {
         completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap, pointerId);
         return;
     }
 
-    auto& respondingDocument = nodeRespondingToClick.document();
     auto& contentChangeObserver = respondingDocument.contentChangeObserver();
     auto targetNodeWentFromHiddenToVisible = contentChangeObserver.hiddenTouchTarget() == &nodeRespondingToClick && ContentChangeObserver::isConsideredVisible(nodeRespondingToClick);
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to