Title: [247633] branches/safari-608-branch/Source/WebCore
- Revision
- 247633
- Author
- alanc...@apple.com
- Date
- 2019-07-18 18:40:03 -0700 (Thu, 18 Jul 2019)
Log Message
Cherry-pick r247568. rdar://problem/53279098
REGRESSION: Panning on an Amazon product image scrolls the page on iPadOS
https://bugs.webkit.org/show_bug.cgi?id=199905
<rdar://problem/49124529>
Reviewed by Dean Jackson.
Amazon product pages include images that the user can touch and pan to show zoomed details in a side image. This
currently works on iPadOS thanks to the dispatch of simulated "mousemove" events on the product image, but the site
doesn't call preventDefault() when handling those events as it wasn't necessary for macOS.
We add a new quirk that will indicate that a given element is such a product image.
* page/Quirks.cpp:
(WebCore::Quirks::isAmazon const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
* page/Quirks.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (247632 => 247633)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-07-19 01:40:00 UTC (rev 247632)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-07-19 01:40:03 UTC (rev 247633)
@@ -1,5 +1,51 @@
2019-07-18 Alan Coon <alanc...@apple.com>
+ Cherry-pick r247568. rdar://problem/53279098
+
+ REGRESSION: Panning on an Amazon product image scrolls the page on iPadOS
+ https://bugs.webkit.org/show_bug.cgi?id=199905
+ <rdar://problem/49124529>
+
+ Reviewed by Dean Jackson.
+
+ Amazon product pages include images that the user can touch and pan to show zoomed details in a side image. This
+ currently works on iPadOS thanks to the dispatch of simulated "mousemove" events on the product image, but the site
+ doesn't call preventDefault() when handling those events as it wasn't necessary for macOS.
+
+ We add a new quirk that will indicate that a given element is such a product image.
+
+ * page/Quirks.cpp:
+ (WebCore::Quirks::isAmazon const):
+ (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
+ (WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
+ (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
+ * page/Quirks.h:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-07-18 Antoine Quint <grao...@apple.com>
+
+ REGRESSION: Panning on an Amazon product image scrolls the page on iPadOS
+ https://bugs.webkit.org/show_bug.cgi?id=199905
+ <rdar://problem/49124529>
+
+ Reviewed by Dean Jackson.
+
+ Amazon product pages include images that the user can touch and pan to show zoomed details in a side image. This
+ currently works on iPadOS thanks to the dispatch of simulated "mousemove" events on the product image, but the site
+ doesn't call preventDefault() when handling those events as it wasn't necessary for macOS.
+
+ We add a new quirk that will indicate that a given element is such a product image.
+
+ * page/Quirks.cpp:
+ (WebCore::Quirks::isAmazon const):
+ (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
+ (WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
+ (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
+ * page/Quirks.h:
+
+2019-07-18 Alan Coon <alanc...@apple.com>
+
Cherry-pick r247566. rdar://problem/53279081
Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.cpp (247632 => 247633)
--- branches/safari-608-branch/Source/WebCore/page/Quirks.cpp 2019-07-19 01:40:00 UTC (rev 247632)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.cpp 2019-07-19 01:40:03 UTC (rev 247633)
@@ -227,6 +227,13 @@
}
#if ENABLE(TOUCH_EVENTS)
+bool Quirks::isAmazon() const
+{
+ auto& url = ""
+ auto host = url.host();
+ return equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com");
+}
+
bool Quirks::shouldDispatchSimulatedMouseEvents() const
{
if (!needsQuirks())
@@ -236,11 +243,12 @@
if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
return false;
+ if (isAmazon())
+ return true;
+
auto& url = ""
auto host = url.host();
- if (equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com"))
- return true;
if (equalLettersIgnoringASCIICase(host, "wix.com") || host.endsWithIgnoringASCIICase(".wix.com"))
return true;
if ((equalLettersIgnoringASCIICase(host, "desmos.com") || host.endsWithIgnoringASCIICase(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
@@ -267,6 +275,24 @@
return false;
}
+bool Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget* target) const
+{
+ if (!needsQuirks() || !shouldDispatchSimulatedMouseEvents())
+ return false;
+
+ if (isAmazon() && is<Element>(target)) {
+ // When panning on an Amazon product image, we're either touching on the #magnifierLens element
+ // or its previous sibling.
+ auto* element = downcast<Element>(target);
+ if (element->getIdAttribute() == "magnifierLens")
+ return true;
+ if (auto* sibling = element->nextElementSibling())
+ return sibling->getIdAttribute() == "magnifierLens";
+ }
+
+ return false;
+}
+
Optional<Event::IsCancelable> Quirks::simulatedMouseEventTypeForTarget(EventTarget* target) const
{
if (!needsQuirks() || !shouldDispatchSimulatedMouseEvents())
@@ -285,7 +311,7 @@
return Event::IsCancelable::No;
return Event::IsCancelable::Yes;
-}
+}
#endif
bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.h (247632 => 247633)
--- branches/safari-608-branch/Source/WebCore/page/Quirks.h 2019-07-19 01:40:00 UTC (rev 247632)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.h 2019-07-19 01:40:03 UTC (rev 247633)
@@ -50,6 +50,7 @@
bool hasBrokenEncryptedMediaAPISupportQuirk() const;
#if ENABLE(TOUCH_EVENTS)
bool shouldDispatchSimulatedMouseEvents() const;
+ bool shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget*) const;
Optional<Event::IsCancelable> simulatedMouseEventTypeForTarget(EventTarget*) const;
#endif
bool shouldDisablePointerEventsQuirk() const;
@@ -70,6 +71,10 @@
private:
bool needsQuirks() const;
+#if ENABLE(TOUCH_EVENTS)
+ bool isAmazon() const;
+#endif
+
WeakPtr<Document> m_document;
mutable Optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes