Changeset 261261 in webkit


Ignore:
Timestamp:
May 6, 2020, 5:18:02 PM (5 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261258 r261261  
     12020-05-06  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentObservation] Shutterstock search bar is not activated on the first tap
     4        https://bugs.webkit.org/show_bug.cgi?id=211529
     5        <rdar://problem/58843932>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * page/Quirks.cpp:
     10        (WebCore::Quirks::shouldIgnoreContentObservationForSyntheticClick const):
     11        * page/Quirks.h:
     12
    1132020-05-06  Jack Lee  <shihchieh_lee@apple.com>
    214
  • trunk/Source/WebCore/page/Quirks.cpp

    r261013 r261261  
    800800}
    801801
    802 }
     802bool Quirks::shouldIgnoreContentObservationForSyntheticClick(bool isFirstSyntheticClickOnPage) const
     803{
     804    if (!needsQuirks())
     805        return false;
     806
     807    auto host = m_document->url().host();
     808    return isFirstSyntheticClickOnPage && (equalLettersIgnoringASCIICase(host, "shutterstock.com") || host.endsWithIgnoringASCIICase(".shutterstock.com"));
     809}
     810
     811}
  • trunk/Source/WebCore/page/Quirks.h

    r260524 r261261  
    7676    WEBCORE_EXPORT bool shouldIgnoreAriaForFastPathContentObservationCheck() const;
    7777    WEBCORE_EXPORT bool shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints() const;
     78    WEBCORE_EXPORT bool shouldIgnoreContentObservationForSyntheticClick(bool isFirstSyntheticClickOnPage) const;
    7879
    7980    WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
  • trunk/Source/WebKit/ChangeLog

    r261259 r261261  
     12020-05-06  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentObservation] Shutterstock search bar is not activated on the first tap
     4        https://bugs.webkit.org/show_bug.cgi?id=211529
     5        <rdar://problem/58843932>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Shutterstock has a “initial click” action which converts some “actionable” elements (<a>) to some other “actionable” elements (<button>).
     10        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).
     11        Any subsequent click works as expected.
     12        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.
     13        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
     14        the Shutterstock top menu bar works fine with click events.)
     15
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::didStartPageTransition):
     18        * WebProcess/WebPage/WebPage.h:
     19        * WebProcess/WebPage/ios/WebPageIOS.mm:
     20        (WebKit::WebPage::handleSyntheticClick):
     21
    1222020-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
    223
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r261252 r261261  
    32993299#if PLATFORM(IOS_FAMILY)
    33003300    m_isShowingInputViewForFocusedElement = false;
     3301    // This is used to enable a first-tap quirk.
     3302    m_hasHandledSyntheticClick = false;
    33013303#endif
    33023304}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r261252 r261261  
    19681968
    19691969    bool m_isShowingInputViewForFocusedElement { false };
     1970    bool m_hasHandledSyntheticClick { false };
    19701971   
    19711972    enum SelectionAnchor { Start, End };
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r261246 r261261  
    711711void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers, WebCore::PointerID pointerId)
    712712{
    713     if (!nodeRespondingToClick.document().settings().contentChangeObserverEnabled()) {
     713    auto& respondingDocument = nodeRespondingToClick.document();
     714    auto isFirstSyntheticClickOnPage = !m_hasHandledSyntheticClick;
     715    m_hasHandledSyntheticClick = true;
     716
     717    if (!respondingDocument.settings().contentChangeObserverEnabled() || respondingDocument.quirks().shouldIgnoreContentObservationForSyntheticClick(isFirstSyntheticClickOnPage)) {
    714718        completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap, pointerId);
    715719        return;
    716720    }
    717721
    718     auto& respondingDocument = nodeRespondingToClick.document();
    719722    auto& contentChangeObserver = respondingDocument.contentChangeObserver();
    720723    auto targetNodeWentFromHiddenToVisible = contentChangeObserver.hiddenTouchTarget() == &nodeRespondingToClick && ContentChangeObserver::isConsideredVisible(nodeRespondingToClick);
Note: See TracChangeset for help on using the changeset viewer.