WebKit Bugzilla
Attachment 361682 Details for
Bug 194501
: Support simulated mouse events on iOS based on a PlatformTouchEvent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194501-20190211175356.patch (text/plain), 25.21 KB, created by
Antoine Quint
on 2019-02-11 08:53:58 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2019-02-11 08:53:58 PST
Size:
25.21 KB
patch
obsolete
>Subversion Revision: 241195 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 62ee2e861694c0b62453009c08cf968052c35423..9edeb443c1d79810d4a664e28c8d3519cbfa5702 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,53 @@ >+2019-02-11 Antoine Quint <graouts@apple.com> >+ >+ Support simulated mouse events on iOS based on a PlatformTouchEvent >+ https://bugs.webkit.org/show_bug.cgi?id=194501 >+ <rdar://problem/46910790> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether >+ simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate that, we allow >+ for a MouseEvent to be created, much like a PointerEvent, based on a PlatformTouchEvent. Then, we set a flag on Event within EventTarget::innerInvokeEventListeners() >+ to see whether any page code has been evaluated as a result of a mousemove event being dispatched. Finally, we also track mouse events when invalidating >+ touch regions provided the required internal runtime flag is on. >+ >+ * SourcesCocoa.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * dom/Event.cpp: >+ * dom/Event.h: >+ (WebCore::Event::hasEncounteredListener const): >+ (WebCore::Event::setHasEncounteredListener): >+ * dom/EventNames.h: >+ (WebCore::EventNames::isTouchRelatedEventType const): >+ (WebCore::EventNames::touchRelatedEventNames const): >+ (WebCore::EventNames::extendedTouchRelatedEventNames const): >+ (WebCore::EventNames::isTouchEventType const): Deleted. >+ (WebCore::EventNames::touchAndPointerEventNames const): Deleted. >+ * dom/EventTarget.cpp: >+ (WebCore::EventTarget::innerInvokeEventListeners): >+ * dom/MouseEvent.h: >+ * dom/Node.cpp: >+ (WebCore::Node::moveNodeToNewDocument): >+ (WebCore::tryAddEventListener): >+ (WebCore::tryRemoveEventListener): >+ (WebCore::Node::defaultEventHandler): >+ * dom/ios/MouseEventIOS.cpp: Added. >+ (WebCore::mouseEventType): >+ (WebCore::MouseEvent::create): >+ * dom/ios/PointerEventIOS.cpp: >+ (WebCore::pointerEventType): >+ (WebCore::PointerEvent::create): >+ (WebCore::eventType): Deleted. >+ * page/DOMWindow.cpp: >+ (WebCore::DOMWindow::addEventListener): >+ (WebCore::DOMWindow::removeEventListener): >+ * page/RuntimeEnabledFeatures.h: >+ (WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const): >+ (WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled): >+ (WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const): >+ (WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled): >+ > 2019-02-08 Zalan Bujtas <zalan@apple.com> > > [LFC] The used containing block width value is optional >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ee5f983b7de2577011c3d82307cdfc021cc91e0b..a6a206726bf2cb13da7bf6909a37cb031e33e34c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-02-11 Antoine Quint <graouts@apple.com> >+ >+ Support simulated mouse events on iOS based on a PlatformTouchEvent >+ https://bugs.webkit.org/show_bug.cgi?id=194501 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether >+ simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. >+ >+ * Shared/WebPreferences.yaml: >+ > 2019-02-08 Keith Rollin <krollin@apple.com> > > Unreviewed build fix. >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 9a312d38e7e5cd03781fce6d1878a3b563bbf5df..e3468f41522ad2a7be02c1b243f4938509ab0a50 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -70,6 +70,7 @@ crypto/mac/SerializedCryptoKeyWrapMac.mm > > dom/DataTransferMac.mm > >+dom/ios/MouseEventIOS.cpp > dom/ios/PointerEventIOS.cpp > dom/ios/TouchEvents.cpp > >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 1e8b88343aaecfe2682d199c893d1735cedb8595..fc80b3410aebee36c83c7a57257233e1991a4d87 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -9431,6 +9431,7 @@ > 71C5BB1B1FB611EA0007A2AE /* Animatable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Animatable.idl; sourceTree = "<group>"; }; > 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInterfaceLayoutDirection.h; sourceTree = "<group>"; }; > 71CC7A1F152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedEnumeration.cpp; sourceTree = "<group>"; }; >+ 71CE2C512209DC7F00C494BD /* MouseEventIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventIOS.cpp; sourceTree = "<group>"; }; > 71D02D901DB55C4E00DD5CF5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; }; > 71D02D921DB55C4E00DD5CF5 /* media-controller.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "media-controller.js"; sourceTree = "<group>"; }; > 71D2554F1DB900020004D76B /* skip-back-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "skip-back-support.js"; sourceTree = "<group>"; }; >@@ -26057,6 +26058,7 @@ > CE2616A4187E65C1007955F3 /* ios */ = { > isa = PBXGroup; > children = ( >+ 71CE2C512209DC7F00C494BD /* MouseEventIOS.cpp */, > 315574CC218F66D000D88F66 /* PointerEventIOS.cpp */, > A1DE712B18612AC100734192 /* TouchEvents.cpp */, > ); >diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp >index 90baa9718c0f132c0fbed0c888e93127b40cb617..c0db291864d96149eff50a43ebd2f87f6054d0e7 100644 >--- a/Source/WebCore/dom/Event.cpp >+++ b/Source/WebCore/dom/Event.cpp >@@ -46,6 +46,7 @@ ALWAYS_INLINE Event::Event(MonotonicTime createTime, const AtomicString& type, I > , m_isDefaultEventHandlerIgnored { false } > , m_isTrusted { isTrusted == IsTrusted::Yes } > , m_isExecutingPassiveEventListener { false } >+ , m_hasEncounteredListener { false } > , m_eventPhase { NONE } > , m_type { type } > , m_createTime { createTime } >diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h >index 11360858bf5d4670707b301f79b613cd988dd492..a6c9382c1308d60f71b2683b90ce45f48088bcd1 100644 >--- a/Source/WebCore/dom/Event.h >+++ b/Source/WebCore/dom/Event.h >@@ -128,6 +128,9 @@ public: > > void setInPassiveListener(bool value) { m_isExecutingPassiveEventListener = value; } > >+ bool hasEncounteredListener() const { return m_hasEncounteredListener; } >+ void setHasEncounteredListener() { m_hasEncounteredListener = true; } >+ > bool cancelBubble() const { return propagationStopped(); } > void setCancelBubble(bool); > >@@ -166,6 +169,7 @@ private: > unsigned m_isDefaultEventHandlerIgnored : 1; > unsigned m_isTrusted : 1; > unsigned m_isExecutingPassiveEventListener : 1; >+ unsigned m_hasEncounteredListener : 1; > > unsigned m_eventPhase : 2; > >diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h >index 463ed4364c6887635f3c373fbbdfa55de0f36841..068014d0221dce245f26872970c27a139a6481d9 100644 >--- a/Source/WebCore/dom/EventNames.h >+++ b/Source/WebCore/dom/EventNames.h >@@ -26,6 +26,10 @@ > #include <functional> > #include <wtf/text/AtomicString.h> > >+#if ENABLE(TOUCH_EVENTS) >+#include "RuntimeEnabledFeatures.h" >+#endif >+ > namespace WebCore { > > #if !defined(ADDITIONAL_DOM_EVENT_NAMES_FOR_EACH) >@@ -355,13 +359,14 @@ public: > // We should choose one term and stick to it. > bool isWheelEventType(const AtomicString& eventType) const; > bool isGestureEventType(const AtomicString& eventType) const; >- bool isTouchEventType(const AtomicString& eventType) const; >+ bool isTouchRelatedEventType(const AtomicString& eventType) const; > bool isTouchScrollBlockingEventType(const AtomicString& eventType) const; > #if ENABLE(GAMEPAD) > bool isGamepadEventType(const AtomicString& eventType) const; > #endif > >- std::array<std::reference_wrapper<const AtomicString>, 9> touchAndPointerEventNames() const; >+ std::array<std::reference_wrapper<const AtomicString>, 9> touchRelatedEventNames() const; >+ std::array<std::reference_wrapper<const AtomicString>, 12> extendedTouchRelatedEventNames() const; > std::array<std::reference_wrapper<const AtomicString>, 3> gestureEventNames() const; > > private: >@@ -389,8 +394,14 @@ inline bool EventNames::isTouchScrollBlockingEventType(const AtomicString& event > || eventType == touchmoveEvent; > } > >-inline bool EventNames::isTouchEventType(const AtomicString& eventType) const >+inline bool EventNames::isTouchRelatedEventType(const AtomicString& eventType) const > { >+#if ENABLE(TOUCH_EVENTS) >+ if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) { >+ if (eventType == mousedownEvent || eventType == mousemoveEvent || eventType == mouseupEvent) >+ return true; >+ } >+#endif > return eventType == touchstartEvent > || eventType == touchmoveEvent > || eventType == touchendEvent >@@ -408,11 +419,16 @@ inline bool EventNames::isWheelEventType(const AtomicString& eventType) const > || eventType == mousewheelEvent; > } > >-inline std::array<std::reference_wrapper<const AtomicString>, 9> EventNames::touchAndPointerEventNames() const >+inline std::array<std::reference_wrapper<const AtomicString>, 9> EventNames::touchRelatedEventNames() const > { > return { { touchstartEvent, touchmoveEvent, touchendEvent, touchcancelEvent, touchforcechangeEvent, pointerdownEvent, pointermoveEvent, pointerupEvent, pointercancelEvent } }; > } > >+inline std::array<std::reference_wrapper<const AtomicString>, 12> EventNames::extendedTouchRelatedEventNames() const >+{ >+ return { { touchstartEvent, touchmoveEvent, touchendEvent, touchcancelEvent, touchforcechangeEvent, pointerdownEvent, pointermoveEvent, pointerupEvent, pointercancelEvent, mousedownEvent, mousemoveEvent, mouseupEvent } }; >+} >+ > inline std::array<std::reference_wrapper<const AtomicString>, 3> EventNames::gestureEventNames() const > { > return { { gesturestartEvent, gesturechangeEvent, gestureendEvent } }; >diff --git a/Source/WebCore/dom/EventTarget.cpp b/Source/WebCore/dom/EventTarget.cpp >index 7ae53449fd00ee679e77427d7f66350c872e7f92..2db2efdf5af1c105c69888c6eb686fbadf613cd3 100644 >--- a/Source/WebCore/dom/EventTarget.cpp >+++ b/Source/WebCore/dom/EventTarget.cpp >@@ -35,8 +35,10 @@ > #include "DOMWrapperWorld.h" > #include "EventNames.h" > #include "HTMLBodyElement.h" >+#include "HTMLHtmlElement.h" > #include "InspectorInstrumentation.h" > #include "JSEventListener.h" >+#include "RuntimeEnabledFeatures.h" > #include "ScriptController.h" > #include "ScriptDisallowedScope.h" > #include "Settings.h" >@@ -299,6 +301,16 @@ void EventTarget::innerInvokeEventListeners(Event& event, EventListenerVector li > registeredListener->callback().handleEvent(context, event); > InspectorInstrumentation::didHandleEvent(context); > >+#if ENABLE(TOUCH_EVENTS) >+ if (RuntimeEnabledFeatures::sharedFeatures().mousemoveEventHandlingPreventsDefaultEnabled() && event.type() == eventNames().mousemoveEvent) { >+ if (is<Element>(event.currentTarget())) { >+ auto* element = downcast<Element>(event.currentTarget()); >+ if (!is<HTMLBodyElement>(element) && !is<HTMLHtmlElement>(element)) >+ event.setHasEncounteredListener(); >+ } >+ } >+#endif >+ > if (registeredListener->isPassive()) > event.setInPassiveListener(false); > } >diff --git a/Source/WebCore/dom/MouseEvent.h b/Source/WebCore/dom/MouseEvent.h >index d7b3f129131da663461a449df575ad63d9a50517..09b7b74068f5fbe84b97b93ce93bada983c53cd0 100644 >--- a/Source/WebCore/dom/MouseEvent.h >+++ b/Source/WebCore/dom/MouseEvent.h >@@ -26,6 +26,10 @@ > #include "MouseEventInit.h" > #include "MouseRelatedEvent.h" > >+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY) >+#include "PlatformTouchEventIOS.h" >+#endif >+ > namespace WebCore { > > class DataTransfer; >@@ -48,6 +52,10 @@ public: > > static Ref<MouseEvent> create(const AtomicString& eventType, const MouseEventInit&); > >+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY) >+ static Ref<MouseEvent> create(const PlatformTouchEvent&, unsigned touchIndex, Ref<WindowProxy>&&); >+#endif >+ > virtual ~MouseEvent(); > > WEBCORE_EXPORT void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index 019caff3e0fa68ea32a8a45d0e1ee0db0ce7c903..078bce0b22c702272e2e33e61799052550041444 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -2079,8 +2079,17 @@ void Node::moveNodeToNewDocument(Document& oldDocument, Document& newDocument) > } > > unsigned numTouchEventListeners = 0; >- for (auto& name : eventNames().touchAndPointerEventNames()) >- numTouchEventListeners += eventListeners(name).size(); >+#if ENABLE(TOUCH_EVENTS) >+ if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) { >+ for (auto& name : eventNames().extendedTouchRelatedEventNames()) >+ numTouchEventListeners += eventListeners(name).size(); >+ } else { >+#endif >+ for (auto& name : eventNames().touchRelatedEventNames()) >+ numTouchEventListeners += eventListeners(name).size(); >+#if ENABLE(TOUCH_EVENTS) >+ } >+#endif > > for (unsigned i = 0; i < numTouchEventListeners; ++i) { > oldDocument.didRemoveTouchEventHandler(*this); >@@ -2125,7 +2134,7 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve > targetNode->document().addListenerTypeIfNeeded(eventType); > if (eventNames().isWheelEventType(eventType)) > targetNode->document().didAddWheelEventHandler(*targetNode); >- else if (eventNames().isTouchEventType(eventType)) >+ else if (eventNames().isTouchRelatedEventType(eventType)) > targetNode->document().didAddTouchEventHandler(*targetNode); > > #if PLATFORM(IOS_FAMILY) >@@ -2140,7 +2149,7 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve > targetNode->document().domWindow()->addEventListener(eventType, WTFMove(listener), options); > > #if ENABLE(TOUCH_EVENTS) >- if (eventNames().isTouchEventType(eventType)) >+ if (eventNames().isTouchRelatedEventType(eventType)) > targetNode->document().addTouchEventListener(*targetNode); > #endif > #endif // PLATFORM(IOS_FAMILY) >@@ -2167,7 +2176,7 @@ static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& > // listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861 > if (eventNames().isWheelEventType(eventType)) > targetNode->document().didRemoveWheelEventHandler(*targetNode); >- else if (eventNames().isTouchEventType(eventType)) >+ else if (eventNames().isTouchRelatedEventType(eventType)) > targetNode->document().didRemoveTouchEventHandler(*targetNode); > > #if PLATFORM(IOS_FAMILY) >@@ -2181,7 +2190,7 @@ static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& > targetNode->document().domWindow()->removeEventListener(eventType, listener, options); > > #if ENABLE(TOUCH_EVENTS) >- if (eventNames().isTouchEventType(eventType)) >+ if (eventNames().isTouchRelatedEventType(eventType)) > targetNode->document().removeTouchEventListener(*targetNode); > #endif > #endif // PLATFORM(IOS_FAMILY) >@@ -2477,7 +2486,7 @@ void Node::defaultEventHandler(Event& event) > if (Frame* frame = document().frame()) > frame->eventHandler().defaultWheelEventHandler(startNode, downcast<WheelEvent>(event)); > #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY) >- } else if (is<TouchEvent>(event) && eventNames().isTouchEventType(eventType)) { >+ } else if (is<TouchEvent>(event) && eventNames().isTouchRelatedEventType(eventType)) { > RenderObject* renderer = this->renderer(); > while (renderer && (!is<RenderBox>(*renderer) || !downcast<RenderBox>(*renderer).canBeScrolledAndHasScrollableArea())) > renderer = renderer->parent(); >diff --git a/Source/WebCore/dom/ios/MouseEventIOS.cpp b/Source/WebCore/dom/ios/MouseEventIOS.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..266487de90cd3abb77251a72cdd18253d5863332 >--- /dev/null >+++ b/Source/WebCore/dom/ios/MouseEventIOS.cpp >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import "MouseEvent.h" >+ >+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY) >+ >+#import "EventNames.h" >+ >+namespace WebCore { >+ >+static AtomicString mouseEventType(PlatformTouchPoint::TouchPhaseType phase) >+{ >+ if (phase == PlatformTouchPoint::TouchPhaseBegan) >+ return eventNames().mousedownEvent; >+ if (phase == PlatformTouchPoint::TouchPhaseMoved || phase == PlatformTouchPoint::TouchPhaseStationary) >+ return eventNames().mousemoveEvent; >+ if (phase == PlatformTouchPoint::TouchPhaseEnded) >+ return eventNames().mouseupEvent; >+ return nullAtom(); >+} >+ >+Ref<MouseEvent> MouseEvent::create(const PlatformTouchEvent& event, unsigned index, Ref<WindowProxy>&& view) >+{ >+ return adoptRef(*new MouseEvent(mouseEventType(event.touchPhaseAtIndex(index)), CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), { }, event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes)); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY) >diff --git a/Source/WebCore/dom/ios/PointerEventIOS.cpp b/Source/WebCore/dom/ios/PointerEventIOS.cpp >index 4502400f8ad496e876c14b4fd2a98afe0bfea008..b191d19988def516844e9385e25d441dc858ba5f 100644 >--- a/Source/WebCore/dom/ios/PointerEventIOS.cpp >+++ b/Source/WebCore/dom/ios/PointerEventIOS.cpp >@@ -32,7 +32,7 @@ > > namespace WebCore { > >-static AtomicString eventType(PlatformTouchPoint::TouchPhaseType phase) >+static AtomicString pointerEventType(PlatformTouchPoint::TouchPhaseType phase) > { > switch (phase) { > case PlatformTouchPoint::TouchPhaseBegan: >@@ -60,7 +60,7 @@ static PointerEvent::IsCancelable phaseIsCancelable(PlatformTouchPoint::TouchPha > Ref<PointerEvent> PointerEvent::create(const PlatformTouchEvent& event, unsigned index, bool isPrimary, Ref<WindowProxy>&& view) > { > auto phase = event.touchPhaseAtIndex(index); >- return adoptRef(*new PointerEvent(eventType(phase), event, phaseIsCancelable(phase), index, isPrimary, WTFMove(view))); >+ return adoptRef(*new PointerEvent(pointerEventType(phase), event, phaseIsCancelable(phase), index, isPrimary, WTFMove(view))); > } > > PointerEvent::PointerEvent(const AtomicString& type, const PlatformTouchEvent& event, IsCancelable isCancelable, unsigned index, bool isPrimary, Ref<WindowProxy>&& view) >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index 0979336d0a58e08adac1f8b83230104c0f7454ae..a7db07bbb5c2ada2c8ea8daecb942880e616b3a2 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -1811,7 +1811,7 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, Ref<EventListene > document->addListenerTypeIfNeeded(eventType); > if (eventNames().isWheelEventType(eventType)) > document->didAddWheelEventHandler(*document); >- else if (eventNames().isTouchEventType(eventType)) >+ else if (eventNames().isTouchRelatedEventType(eventType)) > document->didAddTouchEventHandler(*document); > else if (eventType == eventNames().storageEvent) > didAddStorageEventListener(*this); >@@ -1826,7 +1826,7 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, Ref<EventListene > incrementScrollEventListenersCount(); > #endif > #if ENABLE(IOS_TOUCH_EVENTS) >- else if (eventNames().isTouchEventType(eventType)) >+ else if (eventNames().isTouchRelatedEventType(eventType)) > ++m_touchAndGestureEventListenerCount; > #endif > #if ENABLE(IOS_GESTURE_EVENTS) >@@ -1920,7 +1920,7 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener > if (Document* document = this->document()) { > if (eventNames().isWheelEventType(eventType)) > document->didRemoveWheelEventHandler(*document); >- else if (eventNames().isTouchEventType(eventType)) >+ else if (eventNames().isTouchRelatedEventType(eventType)) > document->didRemoveTouchEventHandler(*document); > } > >@@ -1949,7 +1949,7 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener > decrementScrollEventListenersCount(); > #endif > #if ENABLE(IOS_TOUCH_EVENTS) >- else if (eventNames().isTouchEventType(eventType)) { >+ else if (eventNames().isTouchRelatedEventType(eventType)) { > ASSERT(m_touchAndGestureEventListenerCount > 0); > --m_touchAndGestureEventListenerCount; > } >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index 0f7e7a500450a6506df3e28d3ca934fc0cc0763a..7176d2ff6be776b98f9c254ecac861fb0c02637c 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -344,6 +344,14 @@ public: > bool adClickAttributionEnabled() const { return m_adClickAttributionEnabled; } > void setAdClickAttributionEnabled(bool isEnabled) { m_adClickAttributionEnabled = isEnabled; } > >+#if ENABLE(TOUCH_EVENTS) >+ bool mouseEventsSimulationEnabled() const { return m_mouseEventsSimulationEnabled; } >+ void setMouseEventsSimulationEnabled(bool isEnabled) { m_mouseEventsSimulationEnabled = isEnabled; } >+ >+ bool mousemoveEventHandlingPreventsDefaultEnabled() const { return m_mousemoveEventHandlingPreventsDefaultEnabled; } >+ void setMousemoveEventHandlingPreventsDefaultEnabled(bool isEnabled) { m_mousemoveEventHandlingPreventsDefaultEnabled = isEnabled; } >+#endif >+ > WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures(); > > private: >@@ -521,6 +529,11 @@ private: > > bool m_adClickAttributionEnabled { false }; > >+#if ENABLE(TOUCH_EVENTS) >+ bool m_mouseEventsSimulationEnabled { false }; >+ bool m_mousemoveEventHandlingPreventsDefaultEnabled { false }; >+#endif >+ > friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>; > }; > >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index cce4ace8356325e7a0a00e523f9e4c992f9152ff..177e34b39cf27e4a35d9508d6afb574591f2a6f6 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1534,6 +1534,24 @@ AdClickAttributionEnabled: > webcoreBinding: RuntimeEnabledFeatures > category: internal > >+MouseEventsSimulationEnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "Mouse events simulation" >+ humanReadableDescription: "Enable mouse events dispatch along with touch events on iOS" >+ webcoreBinding: RuntimeEnabledFeatures >+ category: internal >+ condition: ENABLE(TOUCH_EVENTS) >+ >+MousemoveEventHandlingPreventsDefaultEnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "Prevent default for mousemove events" >+ humanReadableDescription: "Allows handling of mousemove events to implicitly call preventDefault() on iOS" >+ webcoreBinding: RuntimeEnabledFeatures >+ category: internal >+ condition: ENABLE(TOUCH_EVENTS) >+ > # Deprecated > > ICECandidateFilteringEnabled:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dino
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194501
:
361681
| 361682