+2017-10-12 Chris Dumez <cdumez@apple.com>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline test now that more checks are passing.
+
+ * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:
+
2017-10-11 Chris Dumez <cdumez@apple.com>
XMLHttpRequest: do not sniff text/html, and do not sniff XML when responseType is set to "text"
PASS FocusEvent constructor (empty argument)
PASS FocusEvent constructor (argument with default values)
PASS FocusEvent constructor (argument with non-default values)
-FAIL MouseEvent constructor (no argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (undefined argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (null argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (empty argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with non-default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (no argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (undefined argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (null argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (empty argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
+PASS MouseEvent constructor (no argument)
+PASS MouseEvent constructor (undefined argument)
+PASS MouseEvent constructor (null argument)
+PASS MouseEvent constructor (empty argument)
+PASS MouseEvent constructor (argument with default values)
+PASS MouseEvent constructor (argument with non-default values)
+PASS WheelEvent constructor (no argument)
+PASS WheelEvent constructor (undefined argument)
+PASS WheelEvent constructor (null argument)
+PASS WheelEvent constructor (empty argument)
+PASS WheelEvent constructor (argument with default values)
+PASS WheelEvent constructor (argument with non-default values)
PASS KeyboardEvent constructor (no argument)
PASS KeyboardEvent constructor (undefined argument)
PASS KeyboardEvent constructor (null argument)
PASS FocusEvent constructor (empty argument)
PASS FocusEvent constructor (argument with default values)
PASS FocusEvent constructor (argument with non-default values)
-FAIL MouseEvent constructor (no argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (undefined argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (null argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (empty argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with non-default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (no argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (undefined argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (null argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (empty argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
+PASS MouseEvent constructor (no argument)
+PASS MouseEvent constructor (undefined argument)
+PASS MouseEvent constructor (null argument)
+PASS MouseEvent constructor (empty argument)
+PASS MouseEvent constructor (argument with default values)
+PASS MouseEvent constructor (argument with non-default values)
+PASS WheelEvent constructor (no argument)
+PASS WheelEvent constructor (undefined argument)
+PASS WheelEvent constructor (null argument)
+PASS WheelEvent constructor (empty argument)
+PASS WheelEvent constructor (argument with default values)
+PASS WheelEvent constructor (argument with non-default values)
PASS KeyboardEvent constructor (no argument)
PASS KeyboardEvent constructor (undefined argument)
PASS KeyboardEvent constructor (null argument)
+2017-10-12 Chris Dumez <cdumez@apple.com>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for MouseEvent.buttons on Mac as per:
+ - https://www.w3.org/TR/uievents/#ref-for-dom-mouseevent-buttons-1
+
+ This is supported by Firefox and Chrome already.
+
+ No new tests, rebaselined existing test.
+
+ * dom/Element.cpp:
+ (WebCore::Element::dispatchMouseEvent):
+ * dom/MouseEvent.cpp:
+ (WebCore::MouseEvent::create):
+ (WebCore::MouseEvent::MouseEvent):
+ * dom/MouseEvent.h:
+ (WebCore::MouseEvent::buttons const):
+ * dom/MouseEvent.idl:
+ * dom/MouseEventInit.h:
+ * dom/MouseEventInit.idl:
+ * dom/SimulatedClick.cpp:
+ * dom/WheelEvent.cpp:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::dispatchDragEvent):
+ * platform/PlatformMouseEvent.h:
+ (WebCore::PlatformMouseEvent::buttons const):
+ * platform/mac/PlatformEventFactoryMac.mm:
+ (WebCore::currentlyPressedMouseButtons):
+ (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+
2017-10-12 David Kilzer <ddkilzer@apple.com>
[iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler
mouseEvent->bubbles(), mouseEvent->cancelable(), mouseEvent->view(), mouseEvent->detail(),
mouseEvent->screenX(), mouseEvent->screenY(), mouseEvent->clientX(), mouseEvent->clientY(),
mouseEvent->ctrlKey(), mouseEvent->altKey(), mouseEvent->shiftKey(), mouseEvent->metaKey(),
- mouseEvent->button(), mouseEvent->syntheticClickType(), relatedTarget);
+ mouseEvent->button(), mouseEvent->buttons(), mouseEvent->syntheticClickType(), relatedTarget);
if (mouseEvent->defaultHandled())
doubleClickEvent->setDefaultHandled();
#if ENABLE(POINTER_LOCK)
event.movementDelta().x(), event.movementDelta().y(),
#endif
- event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), event.buttons(),
relatedTarget, event.force(), event.syntheticClickType());
}
#if ENABLE(POINTER_LOCK)
int movementX, int movementY,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
{
return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view,
detail, { screenX, screenY }, { pageX, pageY },
#if ENABLE(POINTER_LOCK)
{ movementX, movementY },
#endif
- ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
+ ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
}
-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
{
- return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, syntheticClickType, relatedTarget));
+ return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget));
}
MouseEvent::MouseEvent()
#if ENABLE(POINTER_LOCK)
const IntPoint& movementDelta,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
: MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, view, detail, screenLocation, windowLocation,
#if ENABLE(POINTER_LOCK)
movementDelta,
#endif
ctrlKey, altKey, shiftKey, metaKey, isSimulated)
, m_button(button == (unsigned short)-1 ? 0 : button)
+ , m_buttons(buttons)
, m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
, m_buttonDown(button != (unsigned short)-1)
, m_relatedTarget(relatedTarget)
{
}
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget)
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
: MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), view, detail, screenLocation, { },
#if ENABLE(POINTER_LOCK)
{ },
#endif
ctrlKey, altKey, shiftKey, metaKey, false)
, m_button(button == (unsigned short)-1 ? 0 : button)
+ , m_buttons(buttons)
, m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
, m_buttonDown(button != (unsigned short)-1)
, m_relatedTarget(relatedTarget)
MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& initializer, IsTrusted isTrusted)
: MouseRelatedEvent(eventType, initializer, isTrusted)
, m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button)
+ , m_buttons(initializer.buttons)
, m_buttonDown(initializer.button != (unsigned short)-1)
, m_relatedTarget(initializer.relatedTarget)
{
#if ENABLE(POINTER_LOCK)
int movementX, int movementY,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false);
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false);
WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, DOMWindow*, const PlatformMouseEvent&, int detail, Node* relatedTarget);
- static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget);
+ static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); }
// WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
// but we will match the standard DOM.
unsigned short button() const { return m_button; }
+ unsigned short buttons() const { return m_buttons; }
unsigned short syntheticClickType() const { return m_syntheticClickType; }
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }
#if ENABLE(POINTER_LOCK)
const IntPoint& movementDelta,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, bool isSimulated);
MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*,
int detail, const IntPoint& screenLocation, const IntPoint& clientLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget);
+ unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
MouseEvent(const AtomicString& type, const MouseEventInit&, IsTrusted);
void setRelatedTarget(EventTarget& relatedTarget) final { m_relatedTarget = &relatedTarget; }
unsigned short m_button { 0 };
+ unsigned short m_buttons { 0 };
unsigned short m_syntheticClickType { 0 };
bool m_buttonDown { false };
RefPtr<EventTarget> m_relatedTarget;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
+ readonly attribute unsigned short buttons;
readonly attribute EventTarget? relatedTarget;
[Conditional=POINTER_LOCK] readonly attribute long movementX;
[Conditional=POINTER_LOCK] readonly attribute long movementY;
int clientX { 0 };
int clientY { 0 };
unsigned short button { 0 };
+ unsigned short buttons { 0 };
RefPtr<EventTarget> relatedTarget;
};
long clientX = 0;
long clientY = 0;
unsigned short button = 0;
+ unsigned short buttons = 0;
// FIXME: We need to support the following member.
// unsigned short buttons = 0;
#if ENABLE(POINTER_LOCK)
{ },
#endif
- false, false, false, false, 0, 0, 0, 0, 0, true)
+ false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true)
{
if (source == SimulatedClickSource::Bindings)
setUntrusted();
#if ENABLE(POINTER_LOCK)
, { }
#endif
- , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, 0, 0, 0, false)
+ , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, nullptr, 0, 0, nullptr, false)
, m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
, m_deltaX(-event.deltaX())
, m_deltaY(-event.deltaY())
event.movementDelta().x(), event.movementDelta().y(),
#endif
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
- 0, 0, event.force(), NoTap, &dataTransfer);
+ 0, 0, nullptr, event.force(), NoTap, &dataTransfer);
dragTarget.dispatchEvent(me);
return me->defaultPrevented();
#endif
MouseButton button() const { return m_button; }
+ unsigned short buttons() const { return m_buttons; }
int clickCount() const { return m_clickCount; }
unsigned modifierFlags() const { return m_modifierFlags; }
double force() const { return m_force; }
IntPoint m_movementDelta;
#endif
MouseButton m_button;
+ unsigned short m_buttons { 0 };
int m_clickCount;
unsigned m_modifierFlags;
double m_force { 0 };
}
}
+static unsigned short currentlyPressedMouseButtons()
+{
+ return static_cast<unsigned short>([NSEvent pressedMouseButtons]);
+}
+
static PlatformEvent::Type mouseEventTypeForEvent(NSEvent* event)
{
switch ([event type]) {
m_position = pointForEvent(event, windowView);
m_globalPosition = IntPoint(globalPointForEvent(event));
m_button = mouseButtonForEvent(event);
+ m_buttons = currentlyPressedMouseButtons();
m_clickCount = clickCountForEvent(event);
#if ENABLE(POINTER_LOCK)
m_movementDelta = IntPoint(event.deltaX, event.deltaY);
+2017-10-12 Chris Dumez <cdumez@apple.com>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ * Shared/WebEvent.h:
+ (WebKit::WebMouseEvent::buttons const):
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
+ * Shared/WebMouseEvent.cpp:
+ (WebKit::WebMouseEvent::WebMouseEvent):
+ (WebKit::WebMouseEvent::encode const):
+ (WebKit::WebMouseEvent::decode):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::currentlyPressedMouseButtons):
+ (WebKit::WebEventFactory::createWebMouseEvent):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::showContextMenuAtPoint):
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::createWebEvent const):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
+ (WebKit::WebPage::simulateMouseDown):
+ (WebKit::WebPage::simulateMouseUp):
+ (WebKit::WebPage::simulateMouseMotion):
+
2017-10-12 Youenn Fablet <youenn@apple.com>
Add API to clean CacheStorage data
WebMouseEvent();
#if PLATFORM(MAC)
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
+ WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
#else
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
+ WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
#endif
Button button() const { return static_cast<Button>(m_button); }
+ unsigned short buttons() const { return m_buttons; }
const WebCore::IntPoint& position() const { return m_position; }
const WebCore::IntPoint& globalPosition() const { return m_globalPosition; }
float deltaX() const { return m_deltaX; }
static bool isMouseEventType(Type);
uint32_t m_button;
+ unsigned short m_buttons { 0 };
WebCore::IntPoint m_position;
WebCore::IntPoint m_globalPosition;
float m_deltaX;
ASSERT_NOT_REACHED();
}
+ m_buttons = webEvent.buttons();
+
m_position = webEvent.position();
#if ENABLE(POINTER_LOCK)
m_movementDelta = WebCore::IntPoint(webEvent.deltaX(), webEvent.deltaY());
}
#if PLATFORM(MAC)
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
#else
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
#endif
: WebEvent(type, modifiers, timestamp)
, m_button(button)
+ , m_buttons(buttons)
, m_position(position)
, m_globalPosition(globalPosition)
, m_deltaX(deltaX)
WebEvent::encode(encoder);
encoder << m_button;
+ encoder << m_buttons;
encoder << m_position;
encoder << m_globalPosition;
encoder << m_deltaX;
if (!decoder.decode(result.m_button))
return false;
+ if (!decoder.decode(result.m_buttons))
+ return false;
if (!decoder.decode(result.m_position))
return false;
if (!decoder.decode(result.m_globalPosition))
return WebMouseEvent(type,
buttonForEvent(event),
+ 0,
IntPoint(x, y),
IntPoint(xRoot, yRoot),
0 /* deltaX */,
}
}
+static unsigned short currentlyPressedMouseButtons()
+{
+ return static_cast<unsigned short>([NSEvent pressedMouseButtons]);
+}
+
static WebEvent::Type mouseEventTypeForEvent(NSEvent* event)
{
switch ([event type]) {
#endif
WebMouseEvent::Button button = mouseButtonForEvent(event);
+ unsigned short buttons = currentlyPressedMouseButtons();
float deltaX = [event deltaX];
float deltaY = [event deltaY];
float deltaZ = [event deltaZ];
force = pressure + stage;
#endif
- return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
+ return WebMouseEvent(type, button, buttons, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
}
WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windowView)
// FIXME: Proper button support. Modifiers. deltaX/Y/Z. Click count.
WebCore::IntPoint position(event->x, event->y);
position.scale(1 / deviceScaleFactor);
- return WebMouseEvent(type, button, position, position,
+ return WebMouseEvent(type, button, 0, position, position,
0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), wallTimeForEventTime(event->time));
}
{
FrameView* frameView = webFrame()->coreFrame()->view();
IntPoint contentsPoint = frameView->contentsToRootView(point);
- WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), WallTime::now(), WebCore::ForceAtClick);
+ WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, 0, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), WallTime::now(), WebCore::ForceAtClick);
return handleContextMenuEvent(event);
}
if (event.metaKey())
modifiers |= WebEvent::MetaKey;
- return std::make_unique<WebMouseEvent>(type, button, m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), WallTime { }, 0);
+ return std::make_unique<WebMouseEvent>(type, button, event.buttons(), m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), WallTime { }, 0);
}
void PluginView::handleEvent(Event& event)
#if ENABLE(POINTER_LOCK)
0, 0,
#endif
- false, false, false, false, 0, nullptr, 0, WebCore::NoTap, nullptr);
+ false, false, false, false, 0, 0, nullptr, 0, WebCore::NoTap, nullptr);
mainFrame->loader().urlSelected(mainFrameDocument->completeURL(url), emptyString(), mouseEvent.get(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
}
void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), 0, position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), 0, position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
void WebPage::simulateMouseMotion(WebCore::IntPoint position, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, 0, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
}
void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
#if ENABLE(POINTER_LOCK)
0, 0,
#endif
- false, false, false, false, 0, 0, 0, 0, 0, true);
+ false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true);
// Call to the frame loader because this is where our security checks are made.
Frame* frame = core([_dataSource webFrame]);
+2017-10-12 Chris Dumez <cdumez@apple.com>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ * WebView/WebPDFView.mm:
+ (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
+
2017-10-11 Sam Weinig <sam@webkit.org>
Remove out-parameter variants of copyToVector
[nsEvent modifierFlags] & NSEventModifierFlagOption,
[nsEvent modifierFlags] & NSEventModifierFlagShift,
[nsEvent modifierFlags] & NSEventModifierFlagCommand,
- button, 0, WebCore::ForceAtClick, 0, 0, true);
+ button, [NSEvent pressedMouseButtons], nullptr, WebCore::ForceAtClick, 0, nullptr, true);
}
// Call to the frame loader because this is where our security checks are made.