Title: [265485] trunk/Source/WebCore
- Revision
- 265485
- Author
- [email protected]
- Date
- 2020-08-10 18:48:09 -0700 (Mon, 10 Aug 2020)
Log Message
Add quirk to force touch events on mail.yahoo.com
https://bugs.webkit.org/show_bug.cgi?id=215329
<rdar://problem/59824469>
Reviewed by Darin Adler and Tim Horton.
<https://mail.yahoo.com/> serves a mobile site even in desktop browsing "mode", meaning
that certain actions, such as selecting an aufotill contact, expect mobile behaviors,
such as mouse events being dispatched after touch events rather than instantly (in the
case of a connected trackpad with an iPad). This quirk ensures always mobile behavior for
those actions, matching the expectations of <https://mail.yahoo.com/>.
* page/Quirks.h:
* page/Quirks.cpp:
(WebCore::isYahooMail): Added.
(WebCore::Quirks::shouldSynthesizeTouchEvents const): Added.
(WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const):
* loader/DocumentLoader.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::mouseEventPolicy const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (265484 => 265485)
--- trunk/Source/WebCore/ChangeLog 2020-08-11 01:27:04 UTC (rev 265484)
+++ trunk/Source/WebCore/ChangeLog 2020-08-11 01:48:09 UTC (rev 265485)
@@ -1,3 +1,27 @@
+2020-08-10 Devin Rousso <[email protected]>
+
+ Add quirk to force touch events on mail.yahoo.com
+ https://bugs.webkit.org/show_bug.cgi?id=215329
+ <rdar://problem/59824469>
+
+ Reviewed by Darin Adler and Tim Horton.
+
+ <https://mail.yahoo.com/> serves a mobile site even in desktop browsing "mode", meaning
+ that certain actions, such as selecting an aufotill contact, expect mobile behaviors,
+ such as mouse events being dispatched after touch events rather than instantly (in the
+ case of a connected trackpad with an iPad). This quirk ensures always mobile behavior for
+ those actions, matching the expectations of <https://mail.yahoo.com/>.
+
+ * page/Quirks.h:
+ * page/Quirks.cpp:
+ (WebCore::isYahooMail): Added.
+ (WebCore::Quirks::shouldSynthesizeTouchEvents const): Added.
+ (WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const):
+
+ * loader/DocumentLoader.h:
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::mouseEventPolicy const):
+
2020-08-10 Chris Dumez <[email protected]>
AuxiliaryProcess::didReceiveInvalidMessage() for WebPage::PerformDragControllerAction IPC
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (265484 => 265485)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-08-11 01:27:04 UTC (rev 265484)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-08-11 01:48:09 UTC (rev 265485)
@@ -72,6 +72,7 @@
#include "PlatformStrategies.h"
#include "PolicyChecker.h"
#include "ProgressTracker.h"
+#include "Quirks.h"
#include "ResourceHandle.h"
#include "ResourceLoadObserver.h"
#include "RuntimeEnabledFeatures.h"
@@ -1254,6 +1255,19 @@
#endif
}
+MouseEventPolicy DocumentLoader::mouseEventPolicy() const
+{
+#if ENABLE(IOS_TOUCH_EVENTS)
+ if (m_mouseEventPolicy == MouseEventPolicy::Default) {
+ if (auto* document = this->document()) {
+ if (document->quirks().shouldSynthesizeTouchEvents())
+ return MouseEventPolicy::SynthesizeTouchEvents;
+ }
+ }
+#endif
+ return m_mouseEventPolicy;
+}
+
void DocumentLoader::attachToFrame(Frame& frame)
{
if (m_frame == &frame)
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (265484 => 265485)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2020-08-11 01:27:04 UTC (rev 265484)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2020-08-11 01:48:09 UTC (rev 265485)
@@ -331,7 +331,7 @@
LegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy() const { return m_legacyOverflowScrollingTouchPolicy; }
void setLegacyOverflowScrollingTouchPolicy(LegacyOverflowScrollingTouchPolicy policy) { m_legacyOverflowScrollingTouchPolicy = policy; }
- MouseEventPolicy mouseEventPolicy() const { return m_mouseEventPolicy; }
+ WEBCORE_EXPORT MouseEventPolicy mouseEventPolicy() const;
void setMouseEventPolicy(MouseEventPolicy policy) { m_mouseEventPolicy = policy; }
void addSubresourceLoader(ResourceLoader*);
Modified: trunk/Source/WebCore/page/Quirks.cpp (265484 => 265485)
--- trunk/Source/WebCore/page/Quirks.cpp 2020-08-11 01:27:04 UTC (rev 265484)
+++ trunk/Source/WebCore/page/Quirks.cpp 2020-08-11 01:48:09 UTC (rev 265485)
@@ -66,6 +66,14 @@
return loader->allowedAutoplayQuirks();
}
+#if ENABLE(PUBLIC_SUFFIX_LIST)
+static inline bool isYahooMail(Document& document)
+{
+ auto host = document.topDocument().url().host();
+ return startsWithLettersIgnoringASCIICase(host, "mail.") && topPrivatelyControlledDomain(host.toString()).startsWith("yahoo.");
+}
+#endif
+
Quirks::Quirks(Document& document)
: m_document(makeWeakPtr(document))
{
@@ -488,6 +496,18 @@
#endif
+#if ENABLE(IOS_TOUCH_EVENTS)
+bool Quirks::shouldSynthesizeTouchEvents() const
+{
+ if (!needsQuirks())
+ return false;
+
+ if (!m_shouldSynthesizeTouchEventsQuirk)
+ m_shouldSynthesizeTouchEventsQuirk = isYahooMail(*m_document);
+ return m_shouldSynthesizeTouchEventsQuirk.value();
+}
+#endif
+
bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
{
if (!needsQuirks())
@@ -842,10 +862,8 @@
return false;
#if PLATFORM(IOS_FAMILY)
- if (!m_shouldAvoidPastingImagesAsWebContent) {
- auto host = m_document->topDocument().url().host().toString();
- m_shouldAvoidPastingImagesAsWebContent = host.startsWithIgnoringASCIICase("mail.") && topPrivatelyControlledDomain(host).startsWith("yahoo.");
- }
+ if (!m_shouldAvoidPastingImagesAsWebContent)
+ m_shouldAvoidPastingImagesAsWebContent = isYahooMail(*m_document);
return *m_shouldAvoidPastingImagesAsWebContent;
#else
return false;
Modified: trunk/Source/WebCore/page/Quirks.h (265484 => 265485)
--- trunk/Source/WebCore/page/Quirks.h 2020-08-11 01:27:04 UTC (rev 265484)
+++ trunk/Source/WebCore/page/Quirks.h 2020-08-11 01:48:09 UTC (rev 265485)
@@ -60,6 +60,9 @@
bool shouldPreventPointerMediaQueryFromEvaluatingToCoarse() const;
bool shouldPreventDispatchOfTouchEvent(const AtomString&, EventTarget*) const;
#endif
+#if ENABLE(IOS_TOUCH_EVENTS)
+ WEBCORE_EXPORT bool shouldSynthesizeTouchEvents() const;
+#endif
bool shouldDisablePointerEventsQuirk() const;
bool needsInputModeNoneImplicitly(const HTMLElement&) const;
bool needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand() const;
@@ -136,6 +139,9 @@
#if ENABLE(TOUCH_EVENTS)
mutable Optional<bool> m_shouldDispatchSimulatedMouseEventsQuirk;
#endif
+#if ENABLE(IOS_TOUCH_EVENTS)
+ mutable Optional<bool> m_shouldSynthesizeTouchEventsQuirk;
+#endif
mutable Optional<bool> m_needsCanPlayAfterSeekedQuirk;
mutable Optional<bool> m_shouldBypassAsyncScriptDeferring;
mutable Optional<bool> m_needsVP9FullRangeFlagQuirk;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes