Diff
Modified: trunk/Source/WebCore/ChangeLog (183953 => 183954)
--- trunk/Source/WebCore/ChangeLog 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebCore/ChangeLog 2015-05-07 22:32:07 UTC (rev 183954)
@@ -1,3 +1,51 @@
+2015-05-07 Beth Dakin <bda...@apple.com>
+
+ New force-related DOM events should fire in WK1 views
+ https://bugs.webkit.org/show_bug.cgi?id=144663
+ -and corresponding-
+ rdar://problem/20281886
+
+ Reviewed by Sam Weinig.
+
+ All of the WK1 mouse events need to take the correspondingPressureEvent.
+ * page/EventHandler.h:
+
+ Make correspondingPressureEvent a part of CurrentEventScope. This is needed to
+ have accurate pressure information for all of the mouse events in subframes.
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::correspondingPressureEventSlot):
+ (WebCore::EventHandler::correspondingPressureEvent):
+ (WebCore::CurrentEventScope::CurrentEventScope):
+ (WebCore::CurrentEventScope::~CurrentEventScope):
+
+ These events don’t have an associated pressure, so send nil for the
+ correspondingPressureEvent.
+ (WebCore::EventHandler::wheelEvent):
+ (WebCore::EventHandler::keyEvent):
+
+ Pipe through correspondingPressureEvent.
+ (WebCore::EventHandler::mouseDown):
+ (WebCore::EventHandler::mouseDragged):
+ (WebCore::EventHandler::mouseUp):
+ (WebCore::EventHandler::mouseMoved):
+
+ New function to handle pressure change events.
+ (WebCore::EventHandler::pressureChange):
+
+ Pipe through correspondingPressureEvent.
+ (WebCore::EventHandler::passMouseMovedEventToScrollbars):
+ (WebCore::EventHandler::currentPlatformMouseEvent):
+
+ Take the correspondingPressureEvent in order to build a PlatformMouseEvent with
+ the correct pressure information.
+ * platform/mac/PlatformEventFactoryMac.h:
+ * platform/mac/PlatformEventFactoryMac.mm:
+ (WebCore::globalPointForEvent):
+ (WebCore::pointForEvent):
+ (WebCore::mouseButtonForEvent):
+ (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+ (WebCore::PlatformEventFactory::createPlatformMouseEvent):
+
2015-05-06 Roger Fong <roger_f...@apple.com>
Media Controls: Scrubber should be independent of actual video time, causes scrubber to be jumpy.
Modified: trunk/Source/WebCore/page/EventHandler.h (183953 => 183954)
--- trunk/Source/WebCore/page/EventHandler.h 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebCore/page/EventHandler.h 2015-05-07 22:32:07 UTC (rev 183954)
@@ -266,10 +266,11 @@
#if PLATFORM(COCOA) && defined(__OBJC__)
#if !PLATFORM(IOS)
- WEBCORE_EXPORT void mouseDown(NSEvent *);
- WEBCORE_EXPORT void mouseDragged(NSEvent *);
- WEBCORE_EXPORT void mouseUp(NSEvent *);
- WEBCORE_EXPORT void mouseMoved(NSEvent *);
+ WEBCORE_EXPORT void mouseDown(NSEvent *, NSEvent *correspondingPressureEvent);
+ WEBCORE_EXPORT void mouseDragged(NSEvent *, NSEvent *correspondingPressureEvent);
+ WEBCORE_EXPORT void mouseUp(NSEvent *, NSEvent *correspondingPressureEvent);
+ WEBCORE_EXPORT void mouseMoved(NSEvent *, NSEvent *correspondingPressureEvent);
+ WEBCORE_EXPORT void pressureChange(NSEvent *, NSEvent* correspondingPressureEvent);
WEBCORE_EXPORT bool keyEvent(NSEvent *);
WEBCORE_EXPORT bool wheelEvent(NSEvent *);
#else
@@ -285,7 +286,7 @@
#endif
#if !PLATFORM(IOS)
- WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *);
+ WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *, NSEvent* correspondingPressureEvent);
WEBCORE_EXPORT void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
#endif
@@ -294,6 +295,7 @@
void setActivationEventNumber(int num) { m_activationEventNumber = num; }
WEBCORE_EXPORT static NSEvent *currentNSEvent();
+ static NSEvent *correspondingPressureEvent();
#else
static WebEvent *currentEvent();
#endif // !PLATFORM(IOS)
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (183953 => 183954)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -81,10 +81,21 @@
return currentNSEventSlot().get();
}
+static RetainPtr<NSEvent>& correspondingPressureEventSlot()
+{
+ static NeverDestroyed<RetainPtr<NSEvent>> event;
+ return event;
+}
+
+NSEvent *EventHandler::correspondingPressureEvent()
+{
+ return correspondingPressureEventSlot().get();
+}
+
class CurrentEventScope {
WTF_MAKE_NONCOPYABLE(CurrentEventScope);
public:
- CurrentEventScope(NSEvent *);
+ CurrentEventScope(NSEvent *, NSEvent *correspondingPressureEvent);
~CurrentEventScope();
private:
@@ -92,21 +103,27 @@
#ifndef NDEBUG
RetainPtr<NSEvent> m_event;
#endif
+ RetainPtr<NSEvent> m_savedPressureEvent;
+ RetainPtr<NSEvent> m_correspondingPressureEvent;
};
-inline CurrentEventScope::CurrentEventScope(NSEvent *event)
+inline CurrentEventScope::CurrentEventScope(NSEvent *event, NSEvent *correspondingPressureEvent)
: m_savedCurrentEvent(currentNSEventSlot())
#ifndef NDEBUG
, m_event(event)
#endif
+ , m_savedPressureEvent(correspondingPressureEventSlot())
+ , m_correspondingPressureEvent(correspondingPressureEvent)
{
currentNSEventSlot() = event;
+ correspondingPressureEventSlot() = correspondingPressureEvent;
}
inline CurrentEventScope::~CurrentEventScope()
{
ASSERT(currentNSEventSlot() == m_event);
currentNSEventSlot() = m_savedCurrentEvent;
+ correspondingPressureEventSlot() = m_savedPressureEvent;
}
bool EventHandler::wheelEvent(NSEvent *event)
@@ -115,7 +132,7 @@
if (!page)
return false;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, nil);
return handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient()));
}
@@ -125,7 +142,7 @@
ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, nil);
return keyEvent(PlatformEventFactory::createPlatformKeyboardEvent(event));
END_BLOCK_OBJC_EXCEPTIONS;
@@ -469,7 +486,7 @@
return false;
}
-void EventHandler::mouseDown(NSEvent *event)
+void EventHandler::mouseDown(NSEvent *event, NSEvent *correspondingPressureEvent)
{
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
@@ -479,14 +496,14 @@
m_mouseDownView = nil;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, correspondingPressureEvent);
handleMousePressEvent(currentPlatformMouseEvent());
END_BLOCK_OBJC_EXCEPTIONS;
}
-void EventHandler::mouseDragged(NSEvent *event)
+void EventHandler::mouseDragged(NSEvent *event, NSEvent *correspondingPressureEvent)
{
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
@@ -494,13 +511,13 @@
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, correspondingPressureEvent);
handleMouseMoveEvent(currentPlatformMouseEvent());
END_BLOCK_OBJC_EXCEPTIONS;
}
-void EventHandler::mouseUp(NSEvent *event)
+void EventHandler::mouseUp(NSEvent *event, NSEvent *correspondingPressureEvent)
{
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
@@ -508,7 +525,7 @@
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, correspondingPressureEvent);
// Our behavior here is a little different that Qt. Qt always sends
// a mouse release event, even for a double click. To correct problems
@@ -595,7 +612,7 @@
END_BLOCK_OBJC_EXCEPTIONS;
}
-void EventHandler::mouseMoved(NSEvent *event)
+void EventHandler::mouseMoved(NSEvent *event, NSEvent* correspondingPressureEvent)
{
// Reject a mouse moved if the button is down - screws up tracking during autoscroll
// These happen because WebKit sometimes has to fake up moved events.
@@ -603,20 +620,31 @@
return;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, correspondingPressureEvent);
mouseMoved(currentPlatformMouseEvent());
END_BLOCK_OBJC_EXCEPTIONS;
}
-void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event)
+void EventHandler::pressureChange(NSEvent *event, NSEvent* correspondingPressureEvent)
{
+ if (!m_frame.view() || m_sendingEventToSubview)
+ return;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ CurrentEventScope scope(event, correspondingPressureEvent);
+ handleMouseForceEvent(currentPlatformMouseEvent());
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event, NSEvent* correspondingPressureEvent)
+{
// Reject a mouse moved if the button is down - screws up tracking during autoscroll
// These happen because WebKit sometimes has to fake up moved events.
if (!m_frame.view() || m_mousePressed || m_sendingEventToSubview)
return;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- CurrentEventScope scope(event);
+ CurrentEventScope scope(event, correspondingPressureEvent);
passMouseMovedEventToScrollbars(currentPlatformMouseEvent());
END_BLOCK_OBJC_EXCEPTIONS;
}
@@ -674,7 +702,7 @@
NSView *windowView = nil;
if (Page* page = m_frame.page())
windowView = page->chrome().platformPageClient();
- return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), windowView);
+ return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), correspondingPressureEvent(), windowView);
}
bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (183953 => 183954)
--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h 2015-05-07 22:32:07 UTC (rev 183954)
@@ -34,7 +34,7 @@
class PlatformEventFactory {
public:
- WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSView *windowView);
+ WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSEvent *correspondingPressureEvent, NSView *windowView);
static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView);
WEBCORE_EXPORT static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *);
};
Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (183953 => 183954)
--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -49,6 +49,9 @@
static IntPoint globalPointForEvent(NSEvent *event)
{
switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ case NSEventTypePressure:
+#endif
case NSLeftMouseDown:
case NSLeftMouseDragged:
case NSLeftMouseUp:
@@ -71,6 +74,9 @@
static IntPoint pointForEvent(NSEvent *event, NSView *windowView)
{
switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ case NSEventTypePressure:
+#endif
case NSLeftMouseDown:
case NSLeftMouseDragged:
case NSLeftMouseUp:
@@ -99,6 +105,9 @@
static MouseButton mouseButtonForEvent(NSEvent *event)
{
switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ case NSEventTypePressure:
+#endif
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSLeftMouseDragged:
@@ -411,29 +420,53 @@
class PlatformMouseEventBuilder : public PlatformMouseEvent {
public:
- PlatformMouseEventBuilder(NSEvent *event, NSView *windowView)
+ PlatformMouseEventBuilder(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView)
{
// PlatformEvent
- m_type = mouseEventTypeForEvent(event);
- m_modifiers = modifiersForEvent(event);
- m_timestamp = eventTimeStampSince1970(event);
+ m_type = mouseEventTypeForEvent(event);
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ BOOL eventIsPressureEvent = [event type] == NSEventTypePressure;
+ if (eventIsPressureEvent) {
+ // Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure
+ // event and correspondingPressureEvent to detect if this is MouseForceDown, MouseForceUp, or just MouseForceChanged.
+ if (correspondingPressureEvent.stage == 1 && event.stage == 2)
+ m_type = PlatformEvent::MouseForceDown;
+ else if (correspondingPressureEvent.stage == 2 && event.stage == 1)
+ m_type = PlatformEvent::MouseForceUp;
+ else
+ m_type = PlatformEvent::MouseForceChanged;
+ }
+#else
+ UNUSED_PARAM(correspondingPressureEvent);
+#endif
+
+ m_modifiers = modifiersForEvent(event);
+ m_timestamp = eventTimeStampSince1970(event);
+
// PlatformMouseEvent
- m_position = pointForEvent(event, windowView);
- m_globalPosition = globalPointForEvent(event);
- m_button = mouseButtonForEvent(event);
- m_clickCount = clickCountForEvent(event);
-
+ m_position = pointForEvent(event, windowView);
+ m_globalPosition = globalPointForEvent(event);
+ m_button = mouseButtonForEvent(event);
+ m_clickCount = clickCountForEvent(event);
+
+ m_force = 0;
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ int stage = eventIsPressureEvent ? event.stage : correspondingPressureEvent.stage;
+ double pressure = eventIsPressureEvent ? event.pressure : correspondingPressureEvent.pressure;
+ m_force = stage < 1 ? pressure : pressure + stage - 1;
+#endif
+
// Mac specific
- m_modifierFlags = [event modifierFlags];
- m_eventNumber = [event eventNumber];
- m_menuTypeForEvent = typeForEvent(event);
+ m_modifierFlags = [event modifierFlags];
+ m_eventNumber = [event eventNumber];
+ m_menuTypeForEvent = typeForEvent(event);
}
};
-PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSView *windowView)
+PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView)
{
- return PlatformMouseEventBuilder(event, windowView);
+ return PlatformMouseEventBuilder(event, correspondingPressureEvent, windowView);
}
Modified: trunk/Source/WebKit/ChangeLog (183953 => 183954)
--- trunk/Source/WebKit/ChangeLog 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/ChangeLog 2015-05-07 22:32:07 UTC (rev 183954)
@@ -1,3 +1,60 @@
+2015-05-07 Beth Dakin <bda...@apple.com>
+
+ New force-related DOM events should fire in WK1 views
+ https://bugs.webkit.org/show_bug.cgi?id=144663
+ -and corresponding-
+ rdar://problem/20281886
+
+ Reviewed by Sam Weinig.
+
+ Pass the lastPressureEvent to WebCore.
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateMouseoverWithEvent:]):
+ (-[WebHTMLView rightMouseUp:]):
+ (-[WebHTMLView menuForEvent:]):
+ (-[WebHTMLView acceptsFirstMouse:]):
+ (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+ (-[WebHTMLView mouseDown:mouseDown:]):
+ (-[WebHTMLView mouseDragged:]):
+ (-[WebHTMLView mouseUp:mouseUp:]):
+
+ New NSRespnder method for pressure changes.
+ (-[WebHTMLView pressureChangeWithEvent:]):
+
+ New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the
+ default action. Get rid of willHandleMouseDown; now that the gesture recognizer
+ sets delaysPrimaryMouseButtonEvents to NO, we don’t need this.
+ * WebView/WebImmediateActionController.h:
+ * WebView/WebImmediateActionController.mm:
+ (-[WebImmediateActionController _clearImmediateActionState]):
+
+ Set all of the immediateActionStages on EventHandler. This is critical to keep
+ link navigation happening at the right time now that
+ delaysPrimaryMouseButtonEvents is set to NO.
+ (-[WebImmediateActionController performHitTestAtPoint:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+
+ Use a dummy animation controller if the content prevents default.
+ (-[WebImmediateActionController _defaultAnimationController]):
+ (-[WebImmediateActionController _updateImmediateActionItem]):
+ (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted.
+
+ Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when
+ we expect to.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+
+ Cache the most recent pressure event so that we can send it to WebCore for all of
+ the mouse events.
+ (-[WebView _pressureEvent]):
+ (-[WebView _setPressureEvent:]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate dealloc]):
+ * WebView/WebViewInternal.h:
+
2015-04-27 Brent Fulgham <bfulg...@apple.com>
[Win] Deactivate WebGL until Windows tests work properly
Modified: trunk/Source/WebKit/mac/ChangeLog (183953 => 183954)
--- trunk/Source/WebKit/mac/ChangeLog 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-05-07 22:32:07 UTC (rev 183954)
@@ -1,3 +1,60 @@
+2015-05-07 Beth Dakin <bda...@apple.com>
+
+ New force-related DOM events should fire in WK1 views
+ https://bugs.webkit.org/show_bug.cgi?id=144663
+ -and corresponding-
+ rdar://problem/20281886
+
+ Reviewed by Sam Weinig.
+
+ Pass the lastPressureEvent to WebCore.
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateMouseoverWithEvent:]):
+ (-[WebHTMLView rightMouseUp:]):
+ (-[WebHTMLView menuForEvent:]):
+ (-[WebHTMLView acceptsFirstMouse:]):
+ (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+ (-[WebHTMLView mouseDown:mouseDown:]):
+ (-[WebHTMLView mouseDragged:]):
+ (-[WebHTMLView mouseUp:mouseUp:]):
+
+ New NSRespnder method for pressure changes.
+ (-[WebHTMLView pressureChangeWithEvent:]):
+
+ New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the
+ default action. Get rid of willHandleMouseDown; now that the gesture recognizer
+ sets delaysPrimaryMouseButtonEvents to NO, we don’t need this.
+ * WebView/WebImmediateActionController.h:
+ * WebView/WebImmediateActionController.mm:
+ (-[WebImmediateActionController _clearImmediateActionState]):
+
+ Set all of the immediateActionStages on EventHandler. This is critical to keep
+ link navigation happening at the right time now that
+ delaysPrimaryMouseButtonEvents is set to NO.
+ (-[WebImmediateActionController performHitTestAtPoint:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+
+ Use a dummy animation controller if the content prevents default.
+ (-[WebImmediateActionController _defaultAnimationController]):
+ (-[WebImmediateActionController _updateImmediateActionItem]):
+ (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted.
+
+ Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when
+ we expect to.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+
+ Cache the most recent pressure event so that we can send it to WebCore for all of
+ the mouse events.
+ (-[WebView _pressureEvent]):
+ (-[WebView _setPressureEvent:]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate dealloc]):
+ * WebView/WebViewInternal.h:
+
2015-05-05 Myles C. Maxfield <mmaxfi...@apple.com>
Revert "Introducing the Platform Abstraction Layer (PAL)"
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -1768,7 +1768,7 @@
context:[[NSApp currentEvent] context]
eventNumber:0 clickCount:0 pressure:0];
if (Frame* lastHitCoreFrame = core([lastHitView _frame]))
- lastHitCoreFrame->eventHandler().mouseMoved(event);
+ lastHitCoreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]);
}
lastHitView = view;
@@ -1787,9 +1787,9 @@
|| [[self _webView] _dashboardBehavior:WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows]
#endif
) {
- coreFrame->eventHandler().mouseMoved(event);
+ coreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]);
} else
- coreFrame->eventHandler().passMouseMovedEventToScrollbars(event);
+ coreFrame->eventHandler().passMouseMovedEventToScrollbars(event, [[self _webView] _pressureEvent]);
}
[view release];
@@ -3303,7 +3303,7 @@
[super rightMouseUp:event];
if (Frame* coreframe = core([self _frame]))
- coreframe->eventHandler().mouseUp(event);
+ coreframe->eventHandler().mouseUp(event, [[self _webView] _pressureEvent]);
}
static void setMenuItemTarget(NSMenuItem* menuItem)
@@ -3348,8 +3348,8 @@
// Match behavior of other browsers by sending a mousedown event for right clicks.
_private->handlingMouseDownEvent = YES;
page->contextMenuController().clearContextMenu();
- coreFrame->eventHandler().mouseDown(event);
- BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+ coreFrame->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]);
+ BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
_private->handlingMouseDownEvent = NO;
if (!handledEvent)
@@ -3777,7 +3777,7 @@
if ([hitHTMLView _isSelectionEvent:event]) {
#if ENABLE(DRAG_SUPPORT)
if (Page* page = coreFrame->page())
- result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+ result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
#endif
} else if ([hitHTMLView _isScrollBarEvent:event])
result = true;
@@ -3804,7 +3804,7 @@
#if ENABLE(DRAG_SUPPORT)
if (Frame* coreFrame = core([hitHTMLView _frame])) {
if (Page* page = coreFrame->page())
- result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+ result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
}
#endif
[hitHTMLView _setMouseDownEvent:nil];
@@ -3841,7 +3841,6 @@
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[[[self _webView] _actionMenuController] webView:[self _webView] willHandleMouseDown:event];
- [[[self _webView] _immediateActionController] webView:[self _webView] willHandleMouseDown:event];
#endif
#if PLATFORM(IOS)
@@ -3872,7 +3871,7 @@
// Let WebCore get a chance to deal with the event. This will call back to us
// to start the autoscroll timer if appropriate.
if (Frame* coreframe = core([self _frame]))
- coreframe->eventHandler().mouseDown(event);
+ coreframe->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]);
}
}
#pragma clang diagnostic pop
@@ -3925,7 +3924,7 @@
if (!_private->ignoringMouseDraggedEvents) {
if (Frame* frame = core([self _frame])) {
if (Page* page = frame->page())
- page->mainFrame().eventHandler().mouseDragged(event);
+ page->mainFrame().eventHandler().mouseDragged(event, [[self _webView] _pressureEvent]);
}
}
@@ -4064,8 +4063,13 @@
[self _stopAutoscrollTimer];
if (Frame* frame = core([self _frame])) {
- if (Page* page = frame->page())
+ if (Page* page = frame->page()) {
+#if PLATFORM(IOS)
page->mainFrame().eventHandler().mouseUp(event);
+#else
+ page->mainFrame().eventHandler().mouseUp(event, [[self _webView] _pressureEvent]);
+#endif
+ }
}
#if !PLATFORM(IOS)
[self _updateMouseoverWithFakeEvent];
@@ -4081,6 +4085,22 @@
}
#endif
+- (void)pressureChangeWithEvent:(NSEvent *)event
+{
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ NSEvent *lastPressureEvent = [[self _webView] _pressureEvent];
+ if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded)
+ return;
+
+ RefPtr<Frame> coreFrame = core([self _frame]);
+ if (!coreFrame)
+ return;
+
+ coreFrame->eventHandler().pressureChange(event, lastPressureEvent);
+ [[self _webView] _setPressureEvent:event];
+#endif
+}
+
#if !PLATFORM(IOS)
// returning YES from this method is the way we tell AppKit that it is ok for this view
// to be in the key loop even when "tab to all controls" is not on.
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h 2015-05-07 22:32:07 UTC (rev 183954)
@@ -45,12 +45,12 @@
RetainPtr<DDActionContext> _currentActionContext;
BOOL _isShowingTextIndicator;
BOOL _hasActivatedActionContext;
+ BOOL _contentPreventsDefault;
}
- (instancetype)initWithWebView:(WebView *)webView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
- (void)webViewClosed;
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event;
- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event;
- (NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -64,6 +64,13 @@
@interface WebImmediateActionController () <QLPreviewMenuItemDelegate>
@end
+@interface WebAnimationController : NSObject <NSImmediateActionAnimationController> {
+}
+@end
+
+@implementation WebAnimationController
+@end
+
using namespace WebCore;
@implementation WebImmediateActionController
@@ -94,12 +101,6 @@
_currentActionContext = nil;
}
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event
-{
- [self _clearImmediateActionState];
- [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
-}
-
- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event
{
[_currentQLPreviewMenuItem close];
@@ -136,6 +137,7 @@
_type = WebImmediateActionNone;
_currentActionContext = nil;
_currentQLPreviewMenuItem = nil;
+ _contentPreventsDefault = NO;
}
- (void)performHitTestAtPoint:(NSPoint)viewPoint
@@ -144,6 +146,10 @@
if (!coreFrame)
return;
_hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(viewPoint));
+ coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
+
+ if (Element* element = _hitTestResult.innerElement())
+ _contentPreventsDefault = element->dispatchMouseForceWillBegin();
}
#pragma mark NSImmediateActionGestureRecognizerDelegate
@@ -188,6 +194,13 @@
if (immediateActionRecognizer != _immediateActionRecognizer)
return;
+ Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+ if (!coreFrame)
+ return;
+ coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);
+ if (_contentPreventsDefault)
+ return;
+
[_webView _setTextIndicatorAnimationProgress:[immediateActionRecognizer animationProgress]];
}
@@ -196,6 +209,10 @@
if (immediateActionRecognizer != _immediateActionRecognizer)
return;
+ Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+ if (coreFrame)
+ coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled);
+
[_webView _setTextIndicatorAnimationProgress:0];
[self _clearImmediateActionState];
[_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::None];
@@ -207,6 +224,11 @@
if (immediateActionRecognizer != _immediateActionRecognizer)
return;
+ Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+ if (!coreFrame)
+ return;
+ coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted);
+
[_webView _setTextIndicatorAnimationProgress:1];
[_webView _setMaintainsInactiveSelection:NO];
}
@@ -215,6 +237,11 @@
- (id <NSImmediateActionAnimationController>)_defaultAnimationController
{
+ if (_contentPreventsDefault) {
+ RetainPtr<WebAnimationController> dummyController = [[WebAnimationController alloc] init];
+ return dummyController.get();
+ }
+
NSURL *url = ""
NSString *absoluteURLString = [url absoluteString];
if (url && _hitTestResult.URLElement()) {
@@ -265,6 +292,11 @@
id <NSImmediateActionAnimationController> defaultAnimationController = [self _defaultAnimationController];
+ if (_contentPreventsDefault) {
+ [_immediateActionRecognizer setAnimationController:defaultAnimationController];
+ return;
+ }
+
// Allow clients the opportunity to override the default immediate action.
id customClientAnimationController = nil;
if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:immediateActionAnimationControllerForHitTestResult:withType:)]) {
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -910,6 +910,7 @@
RetainPtr<NSImmediateActionGestureRecognizer> recognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] initWithTarget:nil action:NULL]);
_private->immediateActionController = [[WebImmediateActionController alloc] initWithWebView:self recognizer:recognizer.get()];
[recognizer setDelegate:_private->immediateActionController];
+ [recognizer setDelaysPrimaryMouseButtonEvents:NO];
}
#endif
@@ -8601,6 +8602,16 @@
}
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+- (NSEvent *)_pressureEvent
+{
+ return _private->pressureEvent.get();
+}
+
+- (void)_setPressureEvent:(NSEvent *)event
+{
+ _private->pressureEvent = event;
+}
+
- (void)_setTextIndicator:(TextIndicator&)textIndicator
{
[self _setTextIndicator:textIndicator withLifetime:TextIndicatorLifetime::Permanent];
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebViewData.h 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h 2015-05-07 22:32:07 UTC (rev 183954)
@@ -175,6 +175,7 @@
std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
BOOL hasInitializedLookupObserver;
RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver;
+ RetainPtr<NSEvent> pressureEvent;
#endif // PLATFORM(MAC)
BOOL shouldMaintainInactiveSelection;
Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (183953 => 183954)
--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2015-05-07 22:32:07 UTC (rev 183954)
@@ -269,6 +269,8 @@
- (WebActionMenuController *)_actionMenuController;
- (WebImmediateActionController *)_immediateActionController;
#endif
+- (NSEvent *)_pressureEvent;
+- (void)_setPressureEvent:(NSEvent *)event;
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) && defined(__cplusplus)
Modified: trunk/Tools/ChangeLog (183953 => 183954)
--- trunk/Tools/ChangeLog 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Tools/ChangeLog 2015-05-07 22:32:07 UTC (rev 183954)
@@ -1,3 +1,17 @@
+2015-05-07 Beth Dakin <bda...@apple.com>
+
+ New force-related DOM events should fire in WK1 views
+ https://bugs.webkit.org/show_bug.cgi?id=144663
+ -and corresponding-
+ rdar://problem/20281886
+
+ Reviewed by Sam Weinig.
+
+ PlatformEventFactory::createPlatformMouseEvent() takes the last pressure event
+ now. Just send nil.
+ * TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:
+ (TestWebKitAPI::buildAndPerformTest):
+
2015-05-07 Michael Catanzaro <mcatanz...@igalia.com>
[GTK] Checks for DEVELOPMENT_BUILD are all wrong
Modified: trunk/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm (183953 => 183954)
--- trunk/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm 2015-05-07 22:25:36 UTC (rev 183953)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm 2015-05-07 22:32:07 UTC (rev 183954)
@@ -52,7 +52,7 @@
clickCount:0
pressure:0];
- auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, webView.get());
+ auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, nil, webView.get());
EXPECT_EQ(expectedButton, pme.button());
EXPECT_TRUE(!modifierFlags || pme.modifierFlags() & modifierFlags);