Title: [255592] trunk/Source/WebCore
Revision
255592
Author
jer.no...@apple.com
Date
2020-02-03 14:15:20 -0800 (Mon, 03 Feb 2020)

Log Message

[iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
https://bugs.webkit.org/show_bug.cgi?id=207058

Reviewed by Darin Adler.

The video controls on nhl.com listen for mousedown/mousemove/mouseup events, not
touchstart/touchmove/touchend events. Until nhl.com can update their site to support touch
events, add them to the quirks list for simplated mouse events.

Drive-by fix: There's no need to re-parse the entire URL and walk through all the cases
every time shouldDispatchSimulatedMouseEvents() is called. Save the results of the initial
pass so that subsequent checks are just a simple bool check.

* page/Quirks.cpp:
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (255591 => 255592)


--- trunk/Source/WebCore/ChangeLog	2020-02-03 22:13:57 UTC (rev 255591)
+++ trunk/Source/WebCore/ChangeLog	2020-02-03 22:15:20 UTC (rev 255592)
@@ -1,5 +1,23 @@
 2020-02-03  Jer Noble  <jer.no...@apple.com>
 
+        [iPad] Videos on nhl.com can't be scrubbed when loaded with desktop UA.
+        https://bugs.webkit.org/show_bug.cgi?id=207058
+
+        Reviewed by Darin Adler.
+
+        The video controls on nhl.com listen for mousedown/mousemove/mouseup events, not
+        touchstart/touchmove/touchend events. Until nhl.com can update their site to support touch
+        events, add them to the quirks list for simplated mouse events.
+
+        Drive-by fix: There's no need to re-parse the entire URL and walk through all the cases
+        every time shouldDispatchSimulatedMouseEvents() is called. Save the results of the initial
+        pass so that subsequent checks are just a simple bool check.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
+
+2020-02-03  Jer Noble  <jer.no...@apple.com>
+
         Replace the custom allocator in AudioArray::allocate() with fastAlignedMalloc().
         https://bugs.webkit.org/show_bug.cgi?id=206504
 

Modified: trunk/Source/WebCore/page/Quirks.cpp (255591 => 255592)


--- trunk/Source/WebCore/page/Quirks.cpp	2020-02-03 22:13:57 UTC (rev 255591)
+++ trunk/Source/WebCore/page/Quirks.cpp	2020-02-03 22:15:20 UTC (rev 255592)
@@ -291,56 +291,64 @@
     if (!needsQuirks())
         return false;
 
-    auto* loader = m_document->loader();
-    if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
-        return false;
+    auto doShouldDispatchChecks = [this] () bool {
+        auto* loader = m_document->loader();
+        if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
+            return false;
 
-    if (isAmazon())
-        return true;
-    if (isGoogleMaps())
-        return true;
+        if (isAmazon())
+            return true;
+        if (isGoogleMaps())
+            return true;
 
-    auto& url = ""
-    auto host = url.host();
+        auto& url = ""
+        auto host = url.host().convertToASCIILowercase();
 
-    if (equalLettersIgnoringASCIICase(host, "wix.com") || host.endsWithIgnoringASCIICase(".wix.com")) {
-        // Disable simulated mouse dispatching for template selection.
-        return !url.path().startsWithIgnoringASCIICase("/website/templates/");
-    }
-    if ((equalLettersIgnoringASCIICase(host, "desmos.com") || host.endsWithIgnoringASCIICase(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
+        if (host == "wix.com" || host.endsWith(".wix.com")) {
+            // Disable simulated mouse dispatching for template selection.
+            return !url.path().startsWithIgnoringASCIICase("/website/templates/");
+        }
+
+        if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
+            return true;
+        if (host == "figma.com" || host.endsWith(".figma.com"))
+            return true;
+        if (host == "trello.com" || host.endsWith(".trello.com"))
+            return true;
+        if (host == "airtable.com" || host.endsWith(".airtable.com"))
+            return true;
+        if (host == "msn.com" || host.endsWith(".msn.com"))
+            return true;
+        if (host == "flipkart.com" || host.endsWith(".flipkart.com"))
+            return true;
+        if (host == "iqiyi.com" || host.endsWith(".iqiyi.com"))
+            return true;
+        if (host == "trailers.apple.com")
+            return true;
+        if (host == "soundcloud.com")
+            return true;
+        if (host == "naver.com")
+            return true;
+        if (host == "nhl.com" || host.endsWith(".nhl.com"))
+            return true;
+        if (host.endsWith(".naver.com")) {
+            // Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
+            if (host == "tv.naver.com")
+                return false;
+            // Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
+            if (host == "mail.naver.com")
+                return false;
+            // Disable the quirk on the mobile site.
+            // FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
+            if (host == "m.naver.com")
+                return false;
+        }
         return true;
-    if (equalLettersIgnoringASCIICase(host, "figma.com") || host.endsWithIgnoringASCIICase(".figma.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "trello.com") || host.endsWithIgnoringASCIICase(".trello.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "airtable.com") || host.endsWithIgnoringASCIICase(".airtable.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "msn.com") || host.endsWithIgnoringASCIICase(".msn.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "flipkart.com") || host.endsWithIgnoringASCIICase(".flipkart.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "iqiyi.com") || host.endsWithIgnoringASCIICase(".iqiyi.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "trailers.apple.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "soundcloud.com"))
-        return true;
-    if (equalLettersIgnoringASCIICase(host, "naver.com"))
-        return true;
-    if (host.endsWithIgnoringASCIICase(".naver.com")) {
-        // Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
-        if (equalLettersIgnoringASCIICase(host, "tv.naver.com"))
-            return false;
-        // Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
-        if (equalLettersIgnoringASCIICase(host, "mail.naver.com"))
-            return false;
-        // Disable the quirk on the mobile site.
-        // FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
-        if (equalLettersIgnoringASCIICase(host, "m.naver.com"))
-            return false;
-        return true;
-    }
-    return false;
+    };
+
+    if (!m_shouldDispatchSimulatedMouseEventsQuirk)
+        m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
+    return *m_shouldDispatchSimulatedMouseEventsQuirk;
 }
 
 bool Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget* target) const

Modified: trunk/Source/WebCore/page/Quirks.h (255591 => 255592)


--- trunk/Source/WebCore/page/Quirks.h	2020-02-03 22:13:57 UTC (rev 255591)
+++ trunk/Source/WebCore/page/Quirks.h	2020-02-03 22:15:20 UTC (rev 255592)
@@ -110,6 +110,9 @@
     mutable Optional<bool> m_needsPreloadAutoQuirk;
 #endif
     mutable Optional<bool> m_shouldDisableElementFullscreenQuirk;
+#if ENABLE(TOUCH_EVENTS)
+    mutable Optional<bool> m_shouldDispatchSimulatedMouseEventsQuirk;
+#endif
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to