Title: [247621] trunk/Source/WebCore
Revision
247621
Author
grao...@webkit.org
Date
2019-07-18 14:56:36 -0700 (Thu, 18 Jul 2019)

Log Message

Ensure Quirks::shouldDispatchSimulatedMouseEvents() works for all Google Maps and Amazon domains
https://bugs.webkit.org/show_bug.cgi?id=199904
<rdar://problem/53250104>

Reviewed by Dean Jackson.

Use topPrivatelyControlledDomain() to determine whether the URL is a Google or Amazon domain so as to apply
Google Maps and Amazon quirks to all the various domain names used.

* page/Quirks.cpp:
(WebCore::Quirks::isAmazon const):
(WebCore::Quirks::isGoogleMaps const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
* page/Quirks.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247620 => 247621)


--- trunk/Source/WebCore/ChangeLog	2019-07-18 21:42:13 UTC (rev 247620)
+++ trunk/Source/WebCore/ChangeLog	2019-07-18 21:56:36 UTC (rev 247621)
@@ -1,3 +1,21 @@
+2019-07-18  Antoine Quint  <grao...@apple.com>
+
+        Ensure Quirks::shouldDispatchSimulatedMouseEvents() works for all Google Maps and Amazon domains
+        https://bugs.webkit.org/show_bug.cgi?id=199904
+        <rdar://problem/53250104>
+
+        Reviewed by Dean Jackson.
+
+        Use topPrivatelyControlledDomain() to determine whether the URL is a Google or Amazon domain so as to apply
+        Google Maps and Amazon quirks to all the various domain names used.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::isAmazon const):
+        (WebCore::Quirks::isGoogleMaps const):
+        (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
+        (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
+        * page/Quirks.h:
+
 2019-07-18  Per Arne Vollan  <pvol...@apple.com>
 
         Crash under WebPage::boundaryEventOccurred

Modified: trunk/Source/WebCore/page/Quirks.cpp (247620 => 247621)


--- trunk/Source/WebCore/page/Quirks.cpp	2019-07-18 21:42:13 UTC (rev 247620)
+++ trunk/Source/WebCore/page/Quirks.cpp	2019-07-18 21:56:36 UTC (rev 247621)
@@ -230,9 +230,13 @@
 #if ENABLE(TOUCH_EVENTS)
 bool Quirks::isAmazon() const
 {
+    return topPrivatelyControlledDomain(m_document->topDocument().url().host().toString()).startsWith("amazon.");
+}
+
+bool Quirks::isGoogleMaps() const
+{
     auto& url = ""
-    auto host = url.host();
-    return equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com");
+    return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
 }
 
 bool Quirks::shouldDispatchSimulatedMouseEvents() const
@@ -249,6 +253,8 @@
 
     if (isAmazon())
         return true;
+    if (isGoogleMaps())
+        return true;
 
     auto& url = ""
     auto host = url.host();
@@ -267,8 +273,6 @@
         return true;
     if (equalLettersIgnoringASCIICase(host, "flipkart.com") || host.endsWithIgnoringASCIICase(".flipkart.com"))
         return true;
-    if (equalLettersIgnoringASCIICase(host, "www.google.com") && url.path().startsWithIgnoringASCIICase("/maps/"))
-        return true;
     if (equalLettersIgnoringASCIICase(host, "trailers.apple.com"))
         return true;
     if (equalLettersIgnoringASCIICase(host, "naver.com"))
@@ -303,14 +307,13 @@
         return { };
 
     // On Google Maps, we want to limit simulated mouse events to dragging the little man that allows entering into Street View.
-    auto& url = ""
-    auto host = url.host();
-    if (equalLettersIgnoringASCIICase(host, "www.google.com") && url.path().startsWithIgnoringASCIICase("/maps/")) {
+    if (isGoogleMaps()) {
         if (is<Element>(target) && downcast<Element>(target)->getAttribute("class") == "widget-expand-button-pegman-icon")
             return Event::IsCancelable::Yes;
         return { };
     }
 
+    auto host = m_document->topDocument().url().host();
     if (equalLettersIgnoringASCIICase(host, "desmos.com") || host.endsWithIgnoringASCIICase(".desmos.com"))
         return Event::IsCancelable::No;
 

Modified: trunk/Source/WebCore/page/Quirks.h (247620 => 247621)


--- trunk/Source/WebCore/page/Quirks.h	2019-07-18 21:42:13 UTC (rev 247620)
+++ trunk/Source/WebCore/page/Quirks.h	2019-07-18 21:56:36 UTC (rev 247621)
@@ -73,6 +73,7 @@
 
 #if ENABLE(TOUCH_EVENTS)
     bool isAmazon() const;
+    bool isGoogleMaps() const;
 #endif
 
     WeakPtr<Document> m_document;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to