Changeset 183954 in webkit
- Timestamp:
- May 7, 2015 3:32:07 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r183953 r183954 1 2015-05-07 Beth Dakin <bdakin@apple.com> 2 3 New force-related DOM events should fire in WK1 views 4 https://bugs.webkit.org/show_bug.cgi?id=144663 5 -and corresponding- 6 rdar://problem/20281886 7 8 Reviewed by Sam Weinig. 9 10 All of the WK1 mouse events need to take the correspondingPressureEvent. 11 * page/EventHandler.h: 12 13 Make correspondingPressureEvent a part of CurrentEventScope. This is needed to 14 have accurate pressure information for all of the mouse events in subframes. 15 * page/mac/EventHandlerMac.mm: 16 (WebCore::correspondingPressureEventSlot): 17 (WebCore::EventHandler::correspondingPressureEvent): 18 (WebCore::CurrentEventScope::CurrentEventScope): 19 (WebCore::CurrentEventScope::~CurrentEventScope): 20 21 These events don’t have an associated pressure, so send nil for the 22 correspondingPressureEvent. 23 (WebCore::EventHandler::wheelEvent): 24 (WebCore::EventHandler::keyEvent): 25 26 Pipe through correspondingPressureEvent. 27 (WebCore::EventHandler::mouseDown): 28 (WebCore::EventHandler::mouseDragged): 29 (WebCore::EventHandler::mouseUp): 30 (WebCore::EventHandler::mouseMoved): 31 32 New function to handle pressure change events. 33 (WebCore::EventHandler::pressureChange): 34 35 Pipe through correspondingPressureEvent. 36 (WebCore::EventHandler::passMouseMovedEventToScrollbars): 37 (WebCore::EventHandler::currentPlatformMouseEvent): 38 39 Take the correspondingPressureEvent in order to build a PlatformMouseEvent with 40 the correct pressure information. 41 * platform/mac/PlatformEventFactoryMac.h: 42 * platform/mac/PlatformEventFactoryMac.mm: 43 (WebCore::globalPointForEvent): 44 (WebCore::pointForEvent): 45 (WebCore::mouseButtonForEvent): 46 (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): 47 (WebCore::PlatformEventFactory::createPlatformMouseEvent): 48 1 49 2015-05-06 Roger Fong <roger_fong@apple.com> 2 50 -
trunk/Source/WebCore/page/EventHandler.h
r183138 r183954 267 267 #if PLATFORM(COCOA) && defined(__OBJC__) 268 268 #if !PLATFORM(IOS) 269 WEBCORE_EXPORT void mouseDown(NSEvent *); 270 WEBCORE_EXPORT void mouseDragged(NSEvent *); 271 WEBCORE_EXPORT void mouseUp(NSEvent *); 272 WEBCORE_EXPORT void mouseMoved(NSEvent *); 269 WEBCORE_EXPORT void mouseDown(NSEvent *, NSEvent *correspondingPressureEvent); 270 WEBCORE_EXPORT void mouseDragged(NSEvent *, NSEvent *correspondingPressureEvent); 271 WEBCORE_EXPORT void mouseUp(NSEvent *, NSEvent *correspondingPressureEvent); 272 WEBCORE_EXPORT void mouseMoved(NSEvent *, NSEvent *correspondingPressureEvent); 273 WEBCORE_EXPORT void pressureChange(NSEvent *, NSEvent* correspondingPressureEvent); 273 274 WEBCORE_EXPORT bool keyEvent(NSEvent *); 274 275 WEBCORE_EXPORT bool wheelEvent(NSEvent *); … … 286 287 287 288 #if !PLATFORM(IOS) 288 WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent * );289 WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *, NSEvent* correspondingPressureEvent); 289 290 290 291 WEBCORE_EXPORT void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent); … … 295 296 296 297 WEBCORE_EXPORT static NSEvent *currentNSEvent(); 298 static NSEvent *correspondingPressureEvent(); 297 299 #else 298 300 static WebEvent *currentEvent(); -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r183595 r183954 82 82 } 83 83 84 static RetainPtr<NSEvent>& correspondingPressureEventSlot() 85 { 86 static NeverDestroyed<RetainPtr<NSEvent>> event; 87 return event; 88 } 89 90 NSEvent *EventHandler::correspondingPressureEvent() 91 { 92 return correspondingPressureEventSlot().get(); 93 } 94 84 95 class CurrentEventScope { 85 96 WTF_MAKE_NONCOPYABLE(CurrentEventScope); 86 97 public: 87 CurrentEventScope(NSEvent * );98 CurrentEventScope(NSEvent *, NSEvent *correspondingPressureEvent); 88 99 ~CurrentEventScope(); 89 100 … … 93 104 RetainPtr<NSEvent> m_event; 94 105 #endif 106 RetainPtr<NSEvent> m_savedPressureEvent; 107 RetainPtr<NSEvent> m_correspondingPressureEvent; 95 108 }; 96 109 97 inline CurrentEventScope::CurrentEventScope(NSEvent *event )110 inline CurrentEventScope::CurrentEventScope(NSEvent *event, NSEvent *correspondingPressureEvent) 98 111 : m_savedCurrentEvent(currentNSEventSlot()) 99 112 #ifndef NDEBUG 100 113 , m_event(event) 101 114 #endif 115 , m_savedPressureEvent(correspondingPressureEventSlot()) 116 , m_correspondingPressureEvent(correspondingPressureEvent) 102 117 { 103 118 currentNSEventSlot() = event; 119 correspondingPressureEventSlot() = correspondingPressureEvent; 104 120 } 105 121 … … 108 124 ASSERT(currentNSEventSlot() == m_event); 109 125 currentNSEventSlot() = m_savedCurrentEvent; 126 correspondingPressureEventSlot() = m_savedPressureEvent; 110 127 } 111 128 … … 116 133 return false; 117 134 118 CurrentEventScope scope(event );135 CurrentEventScope scope(event, nil); 119 136 return handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient())); 120 137 } … … 126 143 ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp); 127 144 128 CurrentEventScope scope(event );145 CurrentEventScope scope(event, nil); 129 146 return keyEvent(PlatformEventFactory::createPlatformKeyboardEvent(event)); 130 147 … … 470 487 } 471 488 472 void EventHandler::mouseDown(NSEvent *event )489 void EventHandler::mouseDown(NSEvent *event, NSEvent *correspondingPressureEvent) 473 490 { 474 491 FrameView* v = m_frame.view(); … … 480 497 m_mouseDownView = nil; 481 498 482 CurrentEventScope scope(event );499 CurrentEventScope scope(event, correspondingPressureEvent); 483 500 484 501 handleMousePressEvent(currentPlatformMouseEvent()); … … 487 504 } 488 505 489 void EventHandler::mouseDragged(NSEvent *event )506 void EventHandler::mouseDragged(NSEvent *event, NSEvent *correspondingPressureEvent) 490 507 { 491 508 FrameView* v = m_frame.view(); … … 495 512 BEGIN_BLOCK_OBJC_EXCEPTIONS; 496 513 497 CurrentEventScope scope(event );514 CurrentEventScope scope(event, correspondingPressureEvent); 498 515 handleMouseMoveEvent(currentPlatformMouseEvent()); 499 516 … … 501 518 } 502 519 503 void EventHandler::mouseUp(NSEvent *event )520 void EventHandler::mouseUp(NSEvent *event, NSEvent *correspondingPressureEvent) 504 521 { 505 522 FrameView* v = m_frame.view(); … … 509 526 BEGIN_BLOCK_OBJC_EXCEPTIONS; 510 527 511 CurrentEventScope scope(event );528 CurrentEventScope scope(event, correspondingPressureEvent); 512 529 513 530 // Our behavior here is a little different that Qt. Qt always sends … … 596 613 } 597 614 598 void EventHandler::mouseMoved(NSEvent *event )615 void EventHandler::mouseMoved(NSEvent *event, NSEvent* correspondingPressureEvent) 599 616 { 600 617 // Reject a mouse moved if the button is down - screws up tracking during autoscroll … … 604 621 605 622 BEGIN_BLOCK_OBJC_EXCEPTIONS; 606 CurrentEventScope scope(event );623 CurrentEventScope scope(event, correspondingPressureEvent); 607 624 mouseMoved(currentPlatformMouseEvent()); 608 625 END_BLOCK_OBJC_EXCEPTIONS; 609 626 } 610 627 611 void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event) 628 void EventHandler::pressureChange(NSEvent *event, NSEvent* correspondingPressureEvent) 629 { 630 if (!m_frame.view() || m_sendingEventToSubview) 631 return; 632 633 BEGIN_BLOCK_OBJC_EXCEPTIONS; 634 CurrentEventScope scope(event, correspondingPressureEvent); 635 handleMouseForceEvent(currentPlatformMouseEvent()); 636 END_BLOCK_OBJC_EXCEPTIONS; 637 } 638 639 void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event, NSEvent* correspondingPressureEvent) 612 640 { 613 641 // Reject a mouse moved if the button is down - screws up tracking during autoscroll … … 617 645 618 646 BEGIN_BLOCK_OBJC_EXCEPTIONS; 619 CurrentEventScope scope(event );647 CurrentEventScope scope(event, correspondingPressureEvent); 620 648 passMouseMovedEventToScrollbars(currentPlatformMouseEvent()); 621 649 END_BLOCK_OBJC_EXCEPTIONS; … … 675 703 if (Page* page = m_frame.page()) 676 704 windowView = page->chrome().platformPageClient(); 677 return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), windowView);705 return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), correspondingPressureEvent(), windowView); 678 706 } 679 707 -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h
r173176 r183954 35 35 class PlatformEventFactory { 36 36 public: 37 WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NS View *windowView);37 WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSEvent *correspondingPressureEvent, NSView *windowView); 38 38 static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView); 39 39 WEBCORE_EXPORT static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *); -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
r182589 r183954 50 50 { 51 51 switch ([event type]) { 52 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 53 case NSEventTypePressure: 54 #endif 52 55 case NSLeftMouseDown: 53 56 case NSLeftMouseDragged: … … 72 75 { 73 76 switch ([event type]) { 77 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 78 case NSEventTypePressure: 79 #endif 74 80 case NSLeftMouseDown: 75 81 case NSLeftMouseDragged: … … 100 106 { 101 107 switch ([event type]) { 108 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 109 case NSEventTypePressure: 110 #endif 102 111 case NSLeftMouseDown: 103 112 case NSLeftMouseUp: … … 412 421 class PlatformMouseEventBuilder : public PlatformMouseEvent { 413 422 public: 414 PlatformMouseEventBuilder(NSEvent *event, NS View *windowView)423 PlatformMouseEventBuilder(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView) 415 424 { 416 425 // PlatformEvent 417 m_type = mouseEventTypeForEvent(event); 418 m_modifiers = modifiersForEvent(event); 419 m_timestamp = eventTimeStampSince1970(event); 426 m_type = mouseEventTypeForEvent(event); 427 428 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 429 BOOL eventIsPressureEvent = [event type] == NSEventTypePressure; 430 if (eventIsPressureEvent) { 431 // Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure 432 // event and correspondingPressureEvent to detect if this is MouseForceDown, MouseForceUp, or just MouseForceChanged. 433 if (correspondingPressureEvent.stage == 1 && event.stage == 2) 434 m_type = PlatformEvent::MouseForceDown; 435 else if (correspondingPressureEvent.stage == 2 && event.stage == 1) 436 m_type = PlatformEvent::MouseForceUp; 437 else 438 m_type = PlatformEvent::MouseForceChanged; 439 } 440 #else 441 UNUSED_PARAM(correspondingPressureEvent); 442 #endif 443 444 m_modifiers = modifiersForEvent(event); 445 m_timestamp = eventTimeStampSince1970(event); 420 446 421 447 // PlatformMouseEvent 422 m_position = pointForEvent(event, windowView); 423 m_globalPosition = globalPointForEvent(event); 424 m_button = mouseButtonForEvent(event); 425 m_clickCount = clickCountForEvent(event); 426 448 m_position = pointForEvent(event, windowView); 449 m_globalPosition = globalPointForEvent(event); 450 m_button = mouseButtonForEvent(event); 451 m_clickCount = clickCountForEvent(event); 452 453 m_force = 0; 454 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 455 int stage = eventIsPressureEvent ? event.stage : correspondingPressureEvent.stage; 456 double pressure = eventIsPressureEvent ? event.pressure : correspondingPressureEvent.pressure; 457 m_force = stage < 1 ? pressure : pressure + stage - 1; 458 #endif 459 427 460 // Mac specific 428 m_modifierFlags 429 m_eventNumber 430 m_menuTypeForEvent 461 m_modifierFlags = [event modifierFlags]; 462 m_eventNumber = [event eventNumber]; 463 m_menuTypeForEvent = typeForEvent(event); 431 464 } 432 465 }; 433 466 434 PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NS View *windowView)435 { 436 return PlatformMouseEventBuilder(event, windowView);467 PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView) 468 { 469 return PlatformMouseEventBuilder(event, correspondingPressureEvent, windowView); 437 470 } 438 471 -
trunk/Source/WebKit/ChangeLog
r183479 r183954 1 2015-05-07 Beth Dakin <bdakin@apple.com> 2 3 New force-related DOM events should fire in WK1 views 4 https://bugs.webkit.org/show_bug.cgi?id=144663 5 -and corresponding- 6 rdar://problem/20281886 7 8 Reviewed by Sam Weinig. 9 10 Pass the lastPressureEvent to WebCore. 11 * WebView/WebHTMLView.mm: 12 (-[WebHTMLView _updateMouseoverWithEvent:]): 13 (-[WebHTMLView rightMouseUp:]): 14 (-[WebHTMLView menuForEvent:]): 15 (-[WebHTMLView acceptsFirstMouse:]): 16 (-[WebHTMLView shouldDelayWindowOrderingForEvent:]): 17 (-[WebHTMLView mouseDown:mouseDown:]): 18 (-[WebHTMLView mouseDragged:]): 19 (-[WebHTMLView mouseUp:mouseUp:]): 20 21 New NSRespnder method for pressure changes. 22 (-[WebHTMLView pressureChangeWithEvent:]): 23 24 New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the 25 default action. Get rid of willHandleMouseDown; now that the gesture recognizer 26 sets delaysPrimaryMouseButtonEvents to NO, we don’t need this. 27 * WebView/WebImmediateActionController.h: 28 * WebView/WebImmediateActionController.mm: 29 (-[WebImmediateActionController _clearImmediateActionState]): 30 31 Set all of the immediateActionStages on EventHandler. This is critical to keep 32 link navigation happening at the right time now that 33 delaysPrimaryMouseButtonEvents is set to NO. 34 (-[WebImmediateActionController performHitTestAtPoint:]): 35 (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]): 36 (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]): 37 (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): 38 39 Use a dummy animation controller if the content prevents default. 40 (-[WebImmediateActionController _defaultAnimationController]): 41 (-[WebImmediateActionController _updateImmediateActionItem]): 42 (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted. 43 44 Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when 45 we expect to. 46 * WebView/WebView.mm: 47 (-[WebView _commonInitializationWithFrameName:groupName:]): 48 49 Cache the most recent pressure event so that we can send it to WebCore for all of 50 the mouse events. 51 (-[WebView _pressureEvent]): 52 (-[WebView _setPressureEvent:]): 53 * WebView/WebViewData.h: 54 * WebView/WebViewData.mm: 55 (-[WebViewPrivate dealloc]): 56 * WebView/WebViewInternal.h: 57 1 58 2015-04-27 Brent Fulgham <bfulgham@apple.com> 2 59 -
trunk/Source/WebKit/mac/ChangeLog
r183940 r183954 1 2015-05-07 Beth Dakin <bdakin@apple.com> 2 3 New force-related DOM events should fire in WK1 views 4 https://bugs.webkit.org/show_bug.cgi?id=144663 5 -and corresponding- 6 rdar://problem/20281886 7 8 Reviewed by Sam Weinig. 9 10 Pass the lastPressureEvent to WebCore. 11 * WebView/WebHTMLView.mm: 12 (-[WebHTMLView _updateMouseoverWithEvent:]): 13 (-[WebHTMLView rightMouseUp:]): 14 (-[WebHTMLView menuForEvent:]): 15 (-[WebHTMLView acceptsFirstMouse:]): 16 (-[WebHTMLView shouldDelayWindowOrderingForEvent:]): 17 (-[WebHTMLView mouseDown:mouseDown:]): 18 (-[WebHTMLView mouseDragged:]): 19 (-[WebHTMLView mouseUp:mouseUp:]): 20 21 New NSRespnder method for pressure changes. 22 (-[WebHTMLView pressureChangeWithEvent:]): 23 24 New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the 25 default action. Get rid of willHandleMouseDown; now that the gesture recognizer 26 sets delaysPrimaryMouseButtonEvents to NO, we don’t need this. 27 * WebView/WebImmediateActionController.h: 28 * WebView/WebImmediateActionController.mm: 29 (-[WebImmediateActionController _clearImmediateActionState]): 30 31 Set all of the immediateActionStages on EventHandler. This is critical to keep 32 link navigation happening at the right time now that 33 delaysPrimaryMouseButtonEvents is set to NO. 34 (-[WebImmediateActionController performHitTestAtPoint:]): 35 (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]): 36 (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]): 37 (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): 38 39 Use a dummy animation controller if the content prevents default. 40 (-[WebImmediateActionController _defaultAnimationController]): 41 (-[WebImmediateActionController _updateImmediateActionItem]): 42 (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted. 43 44 Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when 45 we expect to. 46 * WebView/WebView.mm: 47 (-[WebView _commonInitializationWithFrameName:groupName:]): 48 49 Cache the most recent pressure event so that we can send it to WebCore for all of 50 the mouse events. 51 (-[WebView _pressureEvent]): 52 (-[WebView _setPressureEvent:]): 53 * WebView/WebViewData.h: 54 * WebView/WebViewData.mm: 55 (-[WebViewPrivate dealloc]): 56 * WebView/WebViewInternal.h: 57 1 58 2015-05-05 Myles C. Maxfield <mmaxfield@apple.com> 2 59 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r183871 r183954 1769 1769 eventNumber:0 clickCount:0 pressure:0]; 1770 1770 if (Frame* lastHitCoreFrame = core([lastHitView _frame])) 1771 lastHitCoreFrame->eventHandler().mouseMoved(event );1771 lastHitCoreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]); 1772 1772 } 1773 1773 … … 1788 1788 #endif 1789 1789 ) { 1790 coreFrame->eventHandler().mouseMoved(event );1790 coreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]); 1791 1791 } else 1792 coreFrame->eventHandler().passMouseMovedEventToScrollbars(event );1792 coreFrame->eventHandler().passMouseMovedEventToScrollbars(event, [[self _webView] _pressureEvent]); 1793 1793 } 1794 1794 … … 3304 3304 3305 3305 if (Frame* coreframe = core([self _frame])) 3306 coreframe->eventHandler().mouseUp(event );3306 coreframe->eventHandler().mouseUp(event, [[self _webView] _pressureEvent]); 3307 3307 } 3308 3308 … … 3349 3349 _private->handlingMouseDownEvent = YES; 3350 3350 page->contextMenuController().clearContextMenu(); 3351 coreFrame->eventHandler().mouseDown(event );3352 BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));3351 coreFrame->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]); 3352 BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient())); 3353 3353 _private->handlingMouseDownEvent = NO; 3354 3354 … … 3778 3778 #if ENABLE(DRAG_SUPPORT) 3779 3779 if (Page* page = coreFrame->page()) 3780 result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));3780 result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient())); 3781 3781 #endif 3782 3782 } else if ([hitHTMLView _isScrollBarEvent:event]) … … 3805 3805 if (Frame* coreFrame = core([hitHTMLView _frame])) { 3806 3806 if (Page* page = coreFrame->page()) 3807 result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));3807 result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient())); 3808 3808 } 3809 3809 #endif … … 3842 3842 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 3843 3843 [[[self _webView] _actionMenuController] webView:[self _webView] willHandleMouseDown:event]; 3844 [[[self _webView] _immediateActionController] webView:[self _webView] willHandleMouseDown:event];3845 3844 #endif 3846 3845 … … 3873 3872 // to start the autoscroll timer if appropriate. 3874 3873 if (Frame* coreframe = core([self _frame])) 3875 coreframe->eventHandler().mouseDown(event );3874 coreframe->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]); 3876 3875 } 3877 3876 } … … 3926 3925 if (Frame* frame = core([self _frame])) { 3927 3926 if (Page* page = frame->page()) 3928 page->mainFrame().eventHandler().mouseDragged(event );3927 page->mainFrame().eventHandler().mouseDragged(event, [[self _webView] _pressureEvent]); 3929 3928 } 3930 3929 } … … 4065 4064 [self _stopAutoscrollTimer]; 4066 4065 if (Frame* frame = core([self _frame])) { 4067 if (Page* page = frame->page()) 4066 if (Page* page = frame->page()) { 4067 #if PLATFORM(IOS) 4068 4068 page->mainFrame().eventHandler().mouseUp(event); 4069 #else 4070 page->mainFrame().eventHandler().mouseUp(event, [[self _webView] _pressureEvent]); 4071 #endif 4072 } 4069 4073 } 4070 4074 #if !PLATFORM(IOS) … … 4081 4085 } 4082 4086 #endif 4087 4088 - (void)pressureChangeWithEvent:(NSEvent *)event 4089 { 4090 #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003 4091 NSEvent *lastPressureEvent = [[self _webView] _pressureEvent]; 4092 if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded) 4093 return; 4094 4095 RefPtr<Frame> coreFrame = core([self _frame]); 4096 if (!coreFrame) 4097 return; 4098 4099 coreFrame->eventHandler().pressureChange(event, lastPressureEvent); 4100 [[self _webView] _setPressureEvent:event]; 4101 #endif 4102 } 4083 4103 4084 4104 #if !PLATFORM(IOS) -
trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h
r179230 r183954 46 46 BOOL _isShowingTextIndicator; 47 47 BOOL _hasActivatedActionContext; 48 BOOL _contentPreventsDefault; 48 49 } 49 50 … … 51 52 - (void)webViewClosed; 52 53 53 - (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event;54 54 - (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event; 55 55 -
trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm
r183517 r183954 65 65 @end 66 66 67 @interface WebAnimationController : NSObject <NSImmediateActionAnimationController> { 68 } 69 @end 70 71 @implementation WebAnimationController 72 @end 73 67 74 using namespace WebCore; 68 75 … … 95 102 } 96 103 97 - (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event98 {99 [self _clearImmediateActionState];100 [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];101 }102 103 104 - (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event 104 105 { … … 137 138 _currentActionContext = nil; 138 139 _currentQLPreviewMenuItem = nil; 140 _contentPreventsDefault = NO; 139 141 } 140 142 … … 145 147 return; 146 148 _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(viewPoint)); 149 coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest); 150 151 if (Element* element = _hitTestResult.innerElement()) 152 _contentPreventsDefault = element->dispatchMouseForceWillBegin(); 147 153 } 148 154 … … 189 195 return; 190 196 197 Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]); 198 if (!coreFrame) 199 return; 200 coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated); 201 if (_contentPreventsDefault) 202 return; 203 191 204 [_webView _setTextIndicatorAnimationProgress:[immediateActionRecognizer animationProgress]]; 192 205 } … … 196 209 if (immediateActionRecognizer != _immediateActionRecognizer) 197 210 return; 211 212 Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]); 213 if (coreFrame) 214 coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled); 198 215 199 216 [_webView _setTextIndicatorAnimationProgress:0]; … … 208 225 return; 209 226 227 Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]); 228 if (!coreFrame) 229 return; 230 coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted); 231 210 232 [_webView _setTextIndicatorAnimationProgress:1]; 211 233 [_webView _setMaintainsInactiveSelection:NO]; … … 216 238 - (id <NSImmediateActionAnimationController>)_defaultAnimationController 217 239 { 240 if (_contentPreventsDefault) { 241 RetainPtr<WebAnimationController> dummyController = [[WebAnimationController alloc] init]; 242 return dummyController.get(); 243 } 244 218 245 NSURL *url = _hitTestResult.absoluteLinkURL(); 219 246 NSString *absoluteURLString = [url absoluteString]; … … 266 293 id <NSImmediateActionAnimationController> defaultAnimationController = [self _defaultAnimationController]; 267 294 295 if (_contentPreventsDefault) { 296 [_immediateActionRecognizer setAnimationController:defaultAnimationController]; 297 return; 298 } 299 268 300 // Allow clients the opportunity to override the default immediate action. 269 301 id customClientAnimationController = nil; -
trunk/Source/WebKit/mac/WebView/WebView.mm
r183682 r183954 911 911 _private->immediateActionController = [[WebImmediateActionController alloc] initWithWebView:self recognizer:recognizer.get()]; 912 912 [recognizer setDelegate:_private->immediateActionController]; 913 [recognizer setDelaysPrimaryMouseButtonEvents:NO]; 913 914 } 914 915 #endif … … 8602 8603 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 8603 8604 8605 - (NSEvent *)_pressureEvent 8606 { 8607 return _private->pressureEvent.get(); 8608 } 8609 8610 - (void)_setPressureEvent:(NSEvent *)event 8611 { 8612 _private->pressureEvent = event; 8613 } 8614 8604 8615 - (void)_setTextIndicator:(TextIndicator&)textIndicator 8605 8616 { -
trunk/Source/WebKit/mac/WebView/WebViewData.h
r183172 r183954 176 176 BOOL hasInitializedLookupObserver; 177 177 RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver; 178 RetainPtr<NSEvent> pressureEvent; 178 179 #endif // PLATFORM(MAC) 179 180 -
trunk/Source/WebKit/mac/WebView/WebViewInternal.h
r183517 r183954 270 270 - (WebImmediateActionController *)_immediateActionController; 271 271 #endif 272 - (NSEvent *)_pressureEvent; 273 - (void)_setPressureEvent:(NSEvent *)event; 272 274 #endif 273 275 -
trunk/Tools/ChangeLog
r183945 r183954 1 2015-05-07 Beth Dakin <bdakin@apple.com> 2 3 New force-related DOM events should fire in WK1 views 4 https://bugs.webkit.org/show_bug.cgi?id=144663 5 -and corresponding- 6 rdar://problem/20281886 7 8 Reviewed by Sam Weinig. 9 10 PlatformEventFactory::createPlatformMouseEvent() takes the last pressure event 11 now. Just send nil. 12 * TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm: 13 (TestWebKitAPI::buildAndPerformTest): 14 1 15 2015-05-07 Michael Catanzaro <mcatanzaro@igalia.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm
r182589 r183954 53 53 pressure:0]; 54 54 55 auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, webView.get());55 auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, nil, webView.get()); 56 56 57 57 EXPECT_EQ(expectedButton, pme.button());
Note: See TracChangeset
for help on using the changeset viewer.