Skip to content

Commit

Permalink
SyntheticClickType should be an enum class
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258833
rdar://111711479

Reviewed by Aditya Keerthi.

* Source/WebCore/dom/DragEvent.cpp:
(WebCore::DragEvent::create):
(WebCore::DragEvent::DragEvent):
* Source/WebCore/dom/DragEvent.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::dispatchPointerEventIfNeeded):
(WebCore::Element::dispatchMouseForceWillBegin):
* Source/WebCore/dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
(WebCore::MouseEvent::initMouseEvent):
* Source/WebCore/dom/MouseEvent.h:
(WebCore::MouseEvent::syntheticClickType const):
* Source/WebCore/dom/PointerEvent.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/dom/SimulatedClick.cpp:
* Source/WebCore/dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
* Source/WebCore/dom/ios/MouseEventIOS.cpp:
(WebCore::MouseEvent::create):
* Source/WebCore/dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/dom/wpe/PointerEventWPE.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/loader/NavigationAction.h:
* Source/WebCore/page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenuAt):
* Source/WebCore/page/DragController.cpp:
(WebCore::createMouseEvent):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::fakeMouseMoveEventTimerFired):
* Source/WebCore/page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::tryToBeginDragAtPoint):
* Source/WebCore/platform/PlatformMouseEvent.h:
* Source/WebKit/Shared/WebEvent.serialization.in:
* Source/WebKit/Shared/WebMouseEvent.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
(WebKit::WebPage::contextMenuAtPointInWindow):
(WebKit::WebPage::dragEnded):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::dispatchSyntheticMouseMove):
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::didFinishContentChangeObserving):
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
(WebKit::WebPage::requestAdditionalItemsForDragSession):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::inspectorNodeSearchMovedToPosition):
(WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
* Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
* Source/WebKitLegacy/mac/WebView/WebFrame.mm:
(-[WebFrame _dragSourceEndedAt:operation:]):
* Source/WebKitLegacy/mac/WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

Canonical link: https://commits.webkit.org/265758@main
  • Loading branch information
aprotyas committed Jul 4, 2023
1 parent 0033183 commit 16742b1
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Source/WebCore/dom/DragEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Ref<DragEvent> DragEvent::createForBindings()

Ref<DragEvent> DragEvent::create(const AtomString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted)
EventTarget* relatedTarget, double force, SyntheticClickType syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted)
{
return adoptRef(*new DragEvent(type, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail,
screenLocation, windowLocation, movementX, movementY, modifiers, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated, isTrusted));
Expand All @@ -61,7 +61,7 @@ DragEvent::DragEvent(const AtomString& eventType, DragEventInit&& init)
DragEvent::DragEvent(const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed,
MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted)
EventTarget* relatedTarget, double force, SyntheticClickType syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted)
: MouseEvent(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, screenLocation, windowLocation, movementX, movementY, modifiers, button, buttons, relatedTarget, force, syntheticClickType, isSimulated, isTrusted)
, m_dataTransfer(dataTransfer)
{
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/dom/DragEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace WebCore {

class DataTransfer;

enum class SyntheticClickType : uint8_t;

struct DragEventInit : public MouseEventInit {
RefPtr<DataTransfer> dataTransfer;
};
Expand All @@ -45,7 +47,7 @@ class DragEvent : public MouseEvent {
static Ref<DragEvent> createForBindings();
static Ref<DragEvent> create(const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier>, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes);
EventTarget* relatedTarget, double force, SyntheticClickType, DataTransfer* = nullptr, IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes);


DataTransfer* dataTransfer() const { return m_dataTransfer.get(); }
Expand All @@ -54,7 +56,7 @@ class DragEvent : public MouseEvent {
DragEvent(const AtomString& eventType, DragEventInit&&);
DragEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier>, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, IsSimulated, IsTrusted);
EventTarget* relatedTarget, double force, SyntheticClickType, DataTransfer*, IsSimulated, IsTrusted);
DragEvent();

EventInterface eventInterface() const final;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static ShouldIgnoreMouseEvent dispatchPointerEventIfNeeded(Element& element, con
#else
UNUSED_PARAM(platformEvent);
#endif
if (platformEvent.syntheticClickType() != NoTap)
if (platformEvent.syntheticClickType() != SyntheticClickType::NoTap)
return ShouldIgnoreMouseEvent::No;

if (auto pointerEvent = pointerCaptureController.pointerEventForMouseEvent(mouseEvent, platformEvent.pointerId(), platformEvent.pointerType())) {
Expand Down Expand Up @@ -3681,7 +3681,7 @@ bool Element::dispatchMouseForceWillBegin()
if (!frame)
return false;

PlatformMouseEvent platformMouseEvent { frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::Type::NoType, 1, { }, WallTime::now(), ForceAtClick, NoTap };
PlatformMouseEvent platformMouseEvent { frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::Type::NoType, 1, { }, WallTime::now(), ForceAtClick, SyntheticClickType::NoTap };
auto mouseForceWillBeginEvent = MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().windowProxy(), platformMouseEvent, 0, nullptr);
mouseForceWillBeginEvent->setTarget(Ref { *this });
dispatchEvent(mouseForceWillBeginEvent);
Expand Down
14 changes: 7 additions & 7 deletions Source/WebCore/dom/MouseEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ Ref<MouseEvent> MouseEvent::create(const AtomString& eventType, RefPtr<WindowPro

Ref<MouseEvent> MouseEvent::create(const AtomString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, IsSimulated isSimulated, IsTrusted isTrusted)
EventTarget* relatedTarget, double force, SyntheticClickType syntheticClickType, IsSimulated isSimulated, IsTrusted isTrusted)
{
return adoptRef(*new MouseEvent(type, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail,
screenLocation, windowLocation, movementX, movementY, modifiers, button, buttons, relatedTarget, force, syntheticClickType, isSimulated, isTrusted));
}

Ref<MouseEvent> MouseEvent::create(const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, RefPtr<WindowProxy>&& view, int detail,
int screenX, int screenY, int clientX, int clientY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
unsigned short syntheticClickType, EventTarget* relatedTarget)
SyntheticClickType syntheticClickType, EventTarget* relatedTarget)
{
return adoptRef(*new MouseEvent(eventType, canBubble, isCancelable, isComposed, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, 0, 0, modifiers, button, buttons, syntheticClickType, relatedTarget));
}
Expand All @@ -81,11 +81,11 @@ MouseEvent::MouseEvent() = default;
MouseEvent::MouseEvent(const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed,
MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, IsSimulated isSimulated, IsTrusted isTrusted)
EventTarget* relatedTarget, double force, SyntheticClickType syntheticClickType, IsSimulated isSimulated, IsTrusted isTrusted)
: MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, screenLocation, windowLocation, movementX, movementY, modifiers, isSimulated, isTrusted)
, m_button(button == -2 ? 0 : button)
, m_buttons(buttons)
, m_syntheticClickType(button == -2 ? 0 : syntheticClickType)
, m_syntheticClickType(button == -2 ? SyntheticClickType::NoTap : syntheticClickType)
, m_buttonDown(button != -2)
, m_relatedTarget(relatedTarget)
, m_force(force)
Expand All @@ -94,11 +94,11 @@ MouseEvent::MouseEvent(const AtomString& eventType, CanBubble canBubble, IsCance

MouseEvent::MouseEvent(const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed,
RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, double movementX, double movementY,
OptionSet<Modifier> modifiers, short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
OptionSet<Modifier> modifiers, short button, unsigned short buttons, SyntheticClickType syntheticClickType, EventTarget* relatedTarget)
: MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { }, movementX, movementY, modifiers, IsSimulated::No)
, m_button(button == -2 ? 0 : button)
, m_buttons(buttons)
, m_syntheticClickType(button == -2 ? 0 : syntheticClickType)
, m_syntheticClickType(button == -2 ? SyntheticClickType::NoTap : syntheticClickType)
, m_buttonDown(button != -2)
, m_relatedTarget(relatedTarget)
{
Expand Down Expand Up @@ -128,7 +128,7 @@ void MouseEvent::initMouseEvent(const AtomString& type, bool canBubble, bool can
m_screenLocation = IntPoint(screenX, screenY);
setModifierKeys(ctrlKey, altKey, shiftKey, metaKey);
m_button = button == -2 ? 0 : button;
m_syntheticClickType = 0;
m_syntheticClickType = SyntheticClickType::NoTap;
m_buttonDown = button != -2;
m_relatedTarget = relatedTarget;

Expand Down
15 changes: 9 additions & 6 deletions Source/WebCore/dom/MouseEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "EventTarget.h"
#include "MouseEventInit.h"
#include "MouseRelatedEvent.h"
#include "PlatformMouseEvent.h"

#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
#include "PlatformTouchEventIOS.h"
Expand All @@ -41,18 +42,20 @@ namespace WebCore {
class Node;
class PlatformMouseEvent;

enum class SyntheticClickType : uint8_t;

class MouseEvent : public MouseRelatedEvent {
WTF_MAKE_ISO_ALLOCATED(MouseEvent);
public:
WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier>, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes);
EventTarget* relatedTarget, double force, SyntheticClickType, IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes);

WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomString& eventType, RefPtr<WindowProxy>&&, const PlatformMouseEvent&, int detail, Node* relatedTarget);

static Ref<MouseEvent> create(const AtomString& eventType, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail,
int screenX, int screenY, int clientX, int clientY, OptionSet<Modifier>, short button, unsigned short buttons,
unsigned short syntheticClickType, EventTarget* relatedTarget);
SyntheticClickType, EventTarget* relatedTarget);

static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); }

Expand All @@ -74,7 +77,7 @@ class MouseEvent : public MouseRelatedEvent {

short button() const { return m_button; }
unsigned short buttons() const { return m_buttons; }
unsigned short syntheticClickType() const { return m_syntheticClickType; }
SyntheticClickType syntheticClickType() const { return m_syntheticClickType; }
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }
double force() const { return m_force; }
Expand All @@ -90,11 +93,11 @@ class MouseEvent : public MouseRelatedEvent {
protected:
MouseEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail,
const IntPoint& screenLocation, const IntPoint& windowLocation, double movementX, double movementY, OptionSet<Modifier>, short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, IsSimulated, IsTrusted);
EventTarget* relatedTarget, double force, SyntheticClickType, IsSimulated, IsTrusted);

MouseEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail,
const IntPoint& screenLocation, const IntPoint& clientLocation, double movementX, double movementY, OptionSet<Modifier>, short button, unsigned short buttons,
unsigned short syntheticClickType, EventTarget* relatedTarget);
SyntheticClickType, EventTarget* relatedTarget);

MouseEvent(const AtomString& type, const MouseEventInit&);

Expand All @@ -108,7 +111,7 @@ class MouseEvent : public MouseRelatedEvent {

short m_button { 0 };
unsigned short m_buttons { 0 };
unsigned short m_syntheticClickType { 0 };
SyntheticClickType m_syntheticClickType { SyntheticClickType::NoTap };
bool m_buttonDown { false };
RefPtr<EventTarget> m_relatedTarget;
double m_force { 0 };
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/dom/PointerEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ PointerEvent::PointerEvent(const AtomString& type, short button, const MouseEven
}

PointerEvent::PointerEvent(const AtomString& type, PointerID pointerId, const String& pointerType, IsPrimary isPrimary)
: MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), nullptr, 0, { }, { }, 0, 0, { }, 0, 0, 0, nullptr)
: MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), nullptr, 0, { }, { }, 0, 0, { }, 0, 0, SyntheticClickType::NoTap, nullptr)
, m_pointerId(pointerId)
, m_pointerType(pointerType)
, m_isPrimary(isPrimary == IsPrimary::Yes)
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/SimulatedClick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "Element.h"
#include "EventNames.h"
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/NeverDestroyed.h>

Expand All @@ -48,7 +49,7 @@ class SimulatedMouseEvent final : public MouseEvent {
SimulatedMouseEvent(const AtomString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
: MouseEvent(eventType, CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes,
underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), /* detail */ 0,
{ }, { }, 0, 0, modifiersFromUnderlyingEvent(underlyingEvent), 0, 0, nullptr, 0, 0, IsSimulated::Yes,
{ }, { }, 0, 0, modifiersFromUnderlyingEvent(underlyingEvent), 0, 0, nullptr, 0, SyntheticClickType::NoTap, IsSimulated::Yes,
source == SimulatedClickSource::UserAgent ? IsTrusted::Yes : IsTrusted::No)
{
setUnderlyingEvent(underlyingEvent.get());
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/WheelEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "DataTransfer.h"
#include "EventNames.h"
#include "PlatformMouseEvent.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/MathExtras.h>

Expand Down Expand Up @@ -60,7 +61,7 @@ inline WheelEvent::WheelEvent(const AtomString& type, const Init& initializer)

inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view, IsCancelable isCancelable)
: MouseEvent(eventNames().wheelEvent, CanBubble::Yes, isCancelable, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0,
event.globalPosition(), event.position() , 0, 0, event.modifiers(), 0, 0, nullptr, 0, 0, IsSimulated::No, IsTrusted::Yes)
event.globalPosition(), event.position() , 0, 0, event.modifiers(), 0, 0, nullptr, 0, SyntheticClickType::NoTap, IsSimulated::No, IsTrusted::Yes)
, m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
, m_deltaX(-event.deltaX())
, m_deltaY(-event.deltaY())
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/ios/MouseEventIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#import "config.h"
#import "MouseEvent.h"
#import "PlatformMouseEvent.h"

#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)

Expand Down Expand Up @@ -52,7 +53,7 @@ Ref<MouseEvent> MouseEvent::create(const PlatformTouchEvent& event, unsigned ind
{
return adoptRef(*new MouseEvent(mouseEventType(event.touchPhaseAtIndex(index)), CanBubble::Yes, cancelable, IsComposed::Yes,
event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), 0, 0,
event.modifiers(), 0, 0, nullptr, 0, 0, IsSimulated::No, IsTrusted::Yes));
event.modifiers(), 0, 0, nullptr, 0, SyntheticClickType::NoTap, IsSimulated::No, IsTrusted::Yes));
}

} // namespace WebCore
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/ios/PointerEventIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#import "config.h"
#import "PointerEvent.h"
#import "PlatformMouseEvent.h"

#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)

Expand Down Expand Up @@ -75,7 +76,7 @@ Ref<PointerEvent> PointerEvent::create(const AtomString& type, const PlatformTou

PointerEvent::PointerEvent(const AtomString& type, const PlatformTouchEvent& event, IsCancelable isCancelable, unsigned index, bool isPrimary, Ref<WindowProxy>&& view, const IntPoint& touchDelta)
: MouseEvent(type, typeCanBubble(type), isCancelable, typeIsComposed(type), event.timestamp().approximateMonotonicTime(), WTFMove(view), 0,
event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), touchDelta.x(), touchDelta.y(), event.modifiers(), buttonForType(type), buttonsForType(type), nullptr, 0, 0, IsSimulated::No, IsTrusted::Yes)
event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), touchDelta.x(), touchDelta.y(), event.modifiers(), buttonForType(type), buttonsForType(type), nullptr, 0, SyntheticClickType::NoTap, IsSimulated::No, IsTrusted::Yes)
, m_pointerId(event.touchIdentifierAtIndex(index))
, m_width(2 * event.radiusXAtIndex(index))
, m_height(2 * event.radiusYAtIndex(index))
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/wpe/PointerEventWPE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "config.h"
#include "PointerEvent.h"
#include "PlatformMouseEvent.h"

#if ENABLE(TOUCH_EVENTS)

Expand Down Expand Up @@ -65,7 +66,7 @@ Ref<PointerEvent> PointerEvent::create(const AtomString& type, const PlatformTou
}

PointerEvent::PointerEvent(const AtomString& type, const PlatformTouchEvent& event, IsCancelable isCancelable, unsigned index, bool isPrimary, Ref<WindowProxy>&& view, const IntPoint& touchDelta)
: MouseEvent(type, typeCanBubble(type), isCancelable, typeIsComposed(type), event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchPoints().at(index).pos(), event.touchPoints().at(index).pos(), touchDelta.x(), touchDelta.y(), event.modifiers(), buttonForType(type), buttonsForType(type), nullptr, 0, 0, IsSimulated::No, IsTrusted::Yes)
: MouseEvent(type, typeCanBubble(type), isCancelable, typeIsComposed(type), event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchPoints().at(index).pos(), event.touchPoints().at(index).pos(), touchDelta.x(), touchDelta.y(), event.modifiers(), buttonForType(type), buttonsForType(type), nullptr, 0, SyntheticClickType::NoTap, IsSimulated::No, IsTrusted::Yes)
, m_pointerId(event.touchPoints().at(index).id())
, m_width(2 * event.touchPoints().at(index).radiusX())
, m_height(2 * event.touchPoints().at(index).radiusY())
Expand Down
4 changes: 3 additions & 1 deletion Source/WebCore/loader/NavigationAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class HistoryItem;
class MouseEvent;
class UIEventWithKeyState;

enum class SyntheticClickType : uint8_t;

// NavigationAction should never hold a strong reference to the originating document either directly
// or indirectly as doing so prevents its destruction even after navigating away from it because
// DocumentLoader keeps around the NavigationAction for the last navigation.
Expand Down Expand Up @@ -82,7 +84,7 @@ class NavigationAction {
LayoutPoint absoluteLocation;
FloatPoint locationInRootViewCoordinates;
short button;
unsigned short syntheticClickType;
SyntheticClickType syntheticClickType;
bool buttonDown;
};
const std::optional<UIEventWithKeyStateData>& keyStateEventData() const { return m_keyStateEventData; }
Expand Down

0 comments on commit 16742b1

Please sign in to comment.