Can’t sort videos on a YouTube channel page on iPad
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Aug 2019 10:38:00 +0000 (10:38 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Aug 2019 10:38:00 +0000 (10:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200573
<rdar://problem/53415195>

Reviewed by Darin Adler.

Add a quirk to make touch events non-cancelable (preventDefault() does nothing).

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248499 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/Quirks.cpp
Source/WebCore/page/Quirks.h

index 91a19ae..5571d75 100644 (file)
@@ -1,3 +1,17 @@
+2019-08-10  Antti Koivisto  <antti@apple.com>
+
+        Can’t sort videos on a YouTube channel page on iPad
+        https://bugs.webkit.org/show_bug.cgi?id=200573
+        <rdar://problem/53415195>
+
+        Reviewed by Darin Adler.
+
+        Add a quirk to make touch events non-cancelable (preventDefault() does nothing).
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::shouldMakeTouchEventNonCancelableForTarget const):
+        * page/Quirks.h:
+
 2019-08-10  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
index 628e633..3107725 100644 (file)
@@ -347,6 +347,26 @@ Optional<Event::IsCancelable> Quirks::simulatedMouseEventTypeForTarget(EventTarg
 
     return Event::IsCancelable::Yes;
 }
+
+bool Quirks::shouldMakeTouchEventNonCancelableForTarget(EventTarget* target) const
+{
+    if (!needsQuirks())
+        return false;
+
+    auto host = m_document->topDocument().url().host();
+
+    if (equalLettersIgnoringASCIICase(host, "www.youtube.com")) {
+        if (is<Element>(target)) {
+            unsigned depth = 3;
+            for (auto* element = downcast<Element>(target); element && depth; element = element->parentElement(), --depth) {
+                if (element->localName() == "paper-item" && element->classList().contains("yt-dropdown-menu"))
+                    return true;
+            }
+        }
+    }
+
+    return false;
+}
 #endif
 
 bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
index 0abcb2a..f29783f 100644 (file)
@@ -54,6 +54,7 @@ public:
     bool shouldDispatchSimulatedMouseEvents() const;
     bool shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget*) const;
     Optional<Event::IsCancelable> simulatedMouseEventTypeForTarget(EventTarget*) const;
+    bool shouldMakeTouchEventNonCancelableForTarget(EventTarget*) const;
 #endif
     bool shouldDisablePointerEventsQuirk() const;
     bool shouldIgnoreContentChange(const Element&) const;