Changeset 157316 in webkit
- Timestamp:
- Oct 11, 2013 12:16:35 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r157260 r157316 1 2013-10-11 Anders Carlsson <andersca@apple.com> 2 3 Remove gesture event support from WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=122650 5 6 Reviewed by Ryosuke Niwa. 7 8 * wtf/FeatureDefines.h: 9 * wtf/nix/FeatureDefinesNix.h: 10 1 11 2013-10-09 Filip Pizlo <fpizlo@apple.com> 2 12 -
trunk/Source/WTF/wtf/FeatureDefines.h
r157143 r157316 175 175 #endif 176 176 177 #if !defined(ENABLE_GESTURE_EVENTS)178 #define ENABLE_GESTURE_EVENTS 1179 #endif180 181 177 #if !defined(ENABLE_RUBBER_BANDING) 182 178 #define ENABLE_RUBBER_BANDING 1 … … 486 482 #endif 487 483 488 #if !defined(ENABLE_GESTURE_EVENTS)489 #define ENABLE_GESTURE_EVENTS 0490 #endif491 492 484 #if !defined(ENABLE_GLIB_SUPPORT) 493 485 #define ENABLE_GLIB_SUPPORT 0 -
trunk/Source/WTF/wtf/nix/FeatureDefinesNix.h
r156567 r157316 135 135 #endif 136 136 137 #if !defined(ENABLE_GESTURE_EVENTS)138 #define ENABLE_GESTURE_EVENTS 1139 #endif140 141 137 #if !defined(ENABLE_ICONDATABASE) 142 138 #define ENABLE_ICONDATABASE 1 -
trunk/Source/WebCore/CMakeLists.txt
r157288 r157316 1138 1138 dom/FocusEvent.cpp 1139 1139 dom/GenericEventQueue.cpp 1140 dom/GestureEvent.cpp1141 1140 dom/IconURL.cpp 1142 1141 dom/IdTargetObserver.cpp -
trunk/Source/WebCore/ChangeLog
r157314 r157316 1 2013-10-11 Anders Carlsson <andersca@apple.com> 2 3 Remove gesture event support from WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=122650 5 6 Reviewed by Ryosuke Niwa. 7 8 * CMakeLists.txt: 9 * GNUmakefile.list.am: 10 * WebCore.exp.in: 11 * WebCore.xcodeproj/project.pbxproj: 12 * dom/GestureEvent.cpp: Removed. 13 * dom/GestureEvent.h: Removed. 14 * dom/Node.cpp: 15 * dom/Node.h: 16 * page/EventHandler.cpp: 17 (WebCore::EventHandler::EventHandler): 18 (WebCore::EventHandler::clear): 19 (WebCore::EventHandler::sendContextMenuEventForKey): 20 * page/EventHandler.h: 21 * platform/PlatformGestureEvent.h: Removed. 22 * platform/Scrollbar.cpp: 23 * platform/Scrollbar.h: 24 * platform/mac/PlatformEventFactoryMac.h: 25 * platform/mac/PlatformEventFactoryMac.mm: 26 1 27 2013-10-11 Tim Horton <timothy_horton@apple.com> 2 28 -
trunk/Source/WebCore/GNUmakefile.list.am
r157288 r157316 2844 2844 Source/WebCore/dom/FocusEvent.h \ 2845 2845 Source/WebCore/dom/FragmentScriptingPermission.h \ 2846 Source/WebCore/dom/GestureEvent.cpp \2847 Source/WebCore/dom/GestureEvent.h \2848 2846 Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h \ 2849 2847 Source/WebCore/dom/ExceptionCodePlaceholder.h \ -
trunk/Source/WebCore/WebCore.exp.in
r157265 r157316 2491 2491 #endif 2492 2492 2493 #if ENABLE(GESTURE_EVENTS)2494 __ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE2495 #endif2496 2497 2493 #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) 2498 2494 __ZN7WebCore8Settings38setHiddenPageDOMTimerThrottlingEnabledEb -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r157288 r157316 126 126 071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; }; 127 127 0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09E14D3323500642955 /* GenericEventQueue.cpp */; }; 128 0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642956 /* GestureEvent.cpp */; };129 128 0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642955 /* GenericEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 130 0720B0A114D3323500642957 /* GestureEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642957 /* GestureEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };131 129 07277E4C17D018CC0015534D /* JSMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4017D018CC0015534D /* JSMediaStream.cpp */; }; 132 130 07277E4D17D018CC0015534D /* JSMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4117D018CC0015534D /* JSMediaStream.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 4941 4939 BC94D1530C275C8B006BC617 /* History.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1500C275C8B006BC617 /* History.cpp */; }; 4942 4940 BC94D1540C275C8B006BC617 /* History.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1510C275C8B006BC617 /* History.h */; }; 4943 BC9585E112F0989500755821 /* PlatformGestureEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9585DF12F0989500755821 /* PlatformGestureEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };4944 4941 BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4945 4942 BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC96DB450F3A882200573CB3 /* RenderBoxModelObject.cpp */; }; … … 6493 6490 0720B09E14D3323500642955 /* GenericEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericEventQueue.cpp; sourceTree = "<group>"; }; 6494 6491 0720B09F14D3323500642955 /* GenericEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericEventQueue.h; sourceTree = "<group>"; }; 6495 0720B09F14D3323500642956 /* GestureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GestureEvent.cpp; sourceTree = "<group>"; };6496 0720B09F14D3323500642957 /* GestureEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GestureEvent.h; sourceTree = "<group>"; };6497 6492 07221B4A17CEC32700848E51 /* MediaConstraintsImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraintsImpl.cpp; sourceTree = "<group>"; }; 6498 6493 07221B4B17CEC32700848E51 /* MediaConstraintsImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaConstraintsImpl.h; sourceTree = "<group>"; }; … … 11812 11807 BC94D1510C275C8B006BC617 /* History.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = History.h; sourceTree = "<group>"; }; 11813 11808 BC94D1520C275C8B006BC617 /* History.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = History.idl; sourceTree = "<group>"; }; 11814 BC9585DF12F0989500755821 /* PlatformGestureEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformGestureEvent.h; sourceTree = "<group>"; };11815 11809 BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderBoxModelObject.h; sourceTree = "<group>"; }; 11816 11810 BC96DB450F3A882200573CB3 /* RenderBoxModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderBoxModelObject.cpp; sourceTree = "<group>"; }; … … 19772 19766 BC5C76291497FE1400BC4775 /* PlatformEvent.h */, 19773 19767 A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */, 19774 BC9585DF12F0989500755821 /* PlatformGestureEvent.h */,19775 19768 935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */, 19776 19769 932871BF0B20DEB70049035A /* PlatformMenuDescription.h */, … … 20855 20848 0720B09E14D3323500642955 /* GenericEventQueue.cpp */, 20856 20849 0720B09F14D3323500642955 /* GenericEventQueue.h */, 20857 0720B09F14D3323500642956 /* GestureEvent.cpp */,20858 0720B09F14D3323500642957 /* GestureEvent.h */,20859 20850 2442BBF81194C9D300D49469 /* HashChangeEvent.h */, 20860 20851 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */, … … 22443 22434 9746AF2A14F4DDE6003E7A70 /* Geoposition.h in Headers */, 22444 22435 078E092A17D14D1C00420AA1 /* RTCStatsReport.h in Headers */, 22445 0720B0A114D3323500642957 /* GestureEvent.h in Headers */,22446 22436 086BBD0F136039C2008B15D8 /* Glyph.h in Headers */, 22447 22437 B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */, … … 23536 23526 BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */, 23537 23527 A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */, 23538 BC9585E112F0989500755821 /* PlatformGestureEvent.h in Headers */,23539 23528 935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */, 23540 23529 0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */, … … 24671 24660 93F199FD08245E59001E9ABC /* Resources */, 24672 24661 CD0DBF001422765700280263 /* Copy Audio Resources */, 24673 1C81BA330E97357C00266E07 /* Copy Inspector Resources */,24674 1C5F9D760E09A1B400E91D0A /* Streamline Inspector Source */,24675 24662 93F19A0C08245E59001E9ABC /* Sources */, 24676 24663 93F19B1208245E59001E9ABC /* Frameworks */, … … 25656 25643 9746AF2314F4DDE6003E7A70 /* Geolocation.cpp in Sources */, 25657 25644 9746AF2614F4DDE6003E7A70 /* GeolocationController.cpp in Sources */, 25658 0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */,25659 25645 B2C3DA6D0D006CD600EF6F26 /* GlyphPageTreeNode.cpp in Sources */, 25660 25646 B2AFFC830D00A5C10030074D /* GlyphPageTreeNodeMac.cpp in Sources */, -
trunk/Source/WebCore/dom/Node.cpp
r157288 r157316 114 114 #include <wtf/text/StringBuilder.h> 115 115 116 #if ENABLE(GESTURE_EVENTS)117 #include "GestureEvent.h"118 #endif119 120 116 #if ENABLE(INDIE_UI) 121 117 #include "UIRequestEvent.h" … … 2101 2097 } 2102 2098 2103 #if ENABLE(GESTURE_EVENTS)2104 bool Node::dispatchGestureEvent(const PlatformGestureEvent& event)2105 {2106 RefPtr<GestureEvent> gestureEvent = GestureEvent::create(document().defaultView(), event);2107 if (!gestureEvent.get())2108 return false;2109 2110 if (isDisabledFormControl(this))2111 return true;2112 2113 EventDispatcher::dispatchEvent(this, gestureEvent);2114 2115 ASSERT(!gestureEvent->defaultPrevented());2116 return gestureEvent->defaultHandled() || gestureEvent->defaultPrevented();2117 }2118 #endif2119 2120 2099 #if ENABLE(TOUCH_EVENTS) 2121 2100 bool Node::dispatchTouchEvent(PassRefPtr<TouchEvent> event) -
trunk/Source/WebCore/dom/Node.h
r157288 r157316 80 80 class TagNodeList; 81 81 82 #if ENABLE(GESTURE_EVENTS)83 class PlatformGestureEvent;84 #endif85 86 82 #if ENABLE(INDIE_UI) 87 83 class UIRequestEvent; … … 538 534 bool dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent); 539 535 540 #if ENABLE(GESTURE_EVENTS)541 bool dispatchGestureEvent(const PlatformGestureEvent&);542 #endif543 536 #if ENABLE(TOUCH_EVENTS) 544 537 bool dispatchTouchEvent(PassRefPtr<TouchEvent>); -
trunk/Source/WebCore/page/EventHandler.cpp
r157058 r157316 93 93 #include <wtf/TemporaryChange.h> 94 94 95 #if ENABLE(GESTURE_EVENTS)96 #include "PlatformGestureEvent.h"97 #endif98 99 95 #if ENABLE(TOUCH_ADJUSTMENT) 100 96 #include "TouchAdjustment.h" … … 287 283 } 288 284 289 #if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)) || ENABLE(GESTURE_EVENTS)285 #if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)) 290 286 static inline bool shouldGesturesTriggerActive() 291 287 { … … 348 344 , m_originatingTouchPointTargetKey(0) 349 345 , m_touchPressed(false) 350 #endif351 #if ENABLE(GESTURE_EVENTS)352 , m_scrollGestureHandlingNode(nullptr)353 , m_lastHitTestResultOverWidget(false)354 346 #endif 355 347 , m_maxMouseMovedDuration(0) … … 417 409 m_originatingTouchPointDocument.clear(); 418 410 m_originatingTouchPointTargetKey = 0; 419 #endif420 #if ENABLE(GESTURE_EVENTS)421 m_scrollGestureHandlingNode = nullptr;422 m_lastHitTestResultOverWidget = false;423 m_previousGestureScrolledElement = nullptr;424 m_scrollbarHandlingScrollGesture = 0;425 411 #endif 426 412 m_maxMouseMovedDuration = 0; … … 2580 2566 } 2581 2567 2582 #if ENABLE(GESTURE_EVENTS)2583 bool EventHandler::handleGestureTapDown()2584 {2585 FrameView* view = m_frame.view();2586 if (!view)2587 return false;2588 if (ScrollAnimator* scrollAnimator = view->existingScrollAnimator())2589 scrollAnimator->cancelAnimations();2590 const FrameView::ScrollableAreaSet* areas = view->scrollableAreas();2591 if (!areas)2592 return false;2593 for (FrameView::ScrollableAreaSet::const_iterator it = areas->begin(); it != areas->end(); ++it) {2594 ScrollableArea* sa = *it;2595 ScrollAnimator* animator = sa->scrollAnimator();2596 if (animator)2597 animator->cancelAnimations();2598 }2599 return false;2600 }2601 2602 bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)2603 {2604 Node* eventTarget = 0;2605 Scrollbar* scrollbar = 0;2606 if (gestureEvent.type() == PlatformEvent::GestureScrollEnd2607 || gestureEvent.type() == PlatformEvent::GestureScrollUpdate2608 || gestureEvent.type() == PlatformEvent::GestureScrollUpdateWithoutPropagation) {2609 scrollbar = m_scrollbarHandlingScrollGesture.get();2610 eventTarget = m_scrollGestureHandlingNode.get();2611 }2612 2613 IntPoint adjustedPoint = gestureEvent.position();2614 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;2615 if (gestureEvent.type() == PlatformEvent::GestureTapDown) {2616 #if ENABLE(TOUCH_ADJUSTMENT)2617 adjustGesturePosition(gestureEvent, adjustedPoint);2618 #endif2619 hitType |= HitTestRequest::Active;2620 } else if (gestureEvent.type() == PlatformEvent::GestureTapDownCancel)2621 hitType |= HitTestRequest::Release;2622 else if (gestureEvent.type() == PlatformEvent::GestureTap) {2623 // The mouseup event synthesized for this gesture will clear the active state of the2624 // targeted node, so performing a ReadOnly hit test here is fine.2625 hitType |= HitTestRequest::ReadOnly;2626 }2627 else2628 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;2629 2630 if (!shouldGesturesTriggerActive())2631 hitType |= HitTestRequest::ReadOnly;2632 2633 if ((!scrollbar && !eventTarget) || !(hitType & HitTestRequest::ReadOnly)) {2634 IntPoint hitTestPoint = m_frame.view()->windowToContents(adjustedPoint);2635 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType | HitTestRequest::AllowFrameScrollbars);2636 eventTarget = result.targetNode();2637 if (!scrollbar)2638 scrollbar = result.scrollbar();2639 }2640 2641 if (scrollbar) {2642 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent);2643 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin && eventSwallowed)2644 m_scrollbarHandlingScrollGesture = scrollbar;2645 else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || !eventSwallowed)2646 m_scrollbarHandlingScrollGesture = 0;2647 2648 if (eventSwallowed)2649 return true;2650 }2651 2652 if (eventTarget) {2653 bool eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent);2654 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin || gestureEvent.type() == PlatformEvent::GestureScrollEnd) {2655 if (eventSwallowed)2656 m_scrollGestureHandlingNode = eventTarget;2657 }2658 2659 if (eventSwallowed)2660 return true;2661 }2662 2663 // FIXME: A more general scroll system (https://bugs.webkit.org/show_bug.cgi?id=80596) will2664 // eliminate the need for this.2665 TemporaryChange<PlatformEvent::Type> baseEventType(m_baseEventType, gestureEvent.type());2666 2667 switch (gestureEvent.type()) {2668 case PlatformEvent::GestureScrollBegin:2669 return handleGestureScrollBegin(gestureEvent);2670 case PlatformEvent::GestureScrollUpdate:2671 case PlatformEvent::GestureScrollUpdateWithoutPropagation:2672 return handleGestureScrollUpdate(gestureEvent);2673 case PlatformEvent::GestureScrollEnd:2674 clearGestureScrollNodes();2675 return true;2676 case PlatformEvent::GestureTap:2677 return handleGestureTap(gestureEvent);2678 case PlatformEvent::GestureTapDown:2679 return handleGestureTapDown();2680 case PlatformEvent::GestureLongPress:2681 return handleGestureLongPress(gestureEvent);2682 case PlatformEvent::GestureLongTap:2683 return handleGestureLongTap(gestureEvent);2684 case PlatformEvent::GestureTwoFingerTap:2685 return handleGestureTwoFingerTap(gestureEvent);2686 case PlatformEvent::GestureTapDownCancel:2687 break;2688 default:2689 ASSERT_NOT_REACHED();2690 }2691 2692 return false;2693 }2694 2695 bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent)2696 {2697 // FIXME: Refactor this code to not hit test multiple times. We use the adjusted position to ensure that the correct node is targeted by the later redundant hit tests.2698 IntPoint adjustedPoint = gestureEvent.position();2699 #if ENABLE(TOUCH_ADJUSTMENT)2700 adjustGesturePosition(gestureEvent, adjustedPoint);2701 #endif2702 2703 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(),2704 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,2705 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());2706 mouseMoved(fakeMouseMove);2707 2708 int tapCount = 1;2709 // FIXME: deletaX is overloaded to mean different things for different gestures.2710 // http://wkb.ug/931232711 if (gestureEvent.deltaX() > 0)2712 tapCount = static_cast<int>(gestureEvent.deltaX());2713 2714 bool defaultPrevented = false;2715 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(),2716 LeftButton, PlatformEvent::MousePressed, tapCount,2717 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());2718 defaultPrevented |= handleMousePressEvent(fakeMouseDown);2719 2720 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(),2721 LeftButton, PlatformEvent::MouseReleased, tapCount,2722 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());2723 defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp);2724 2725 return defaultPrevented;2726 }2727 2728 bool EventHandler::handleGestureLongPress(const PlatformGestureEvent& gestureEvent)2729 {2730 #if ENABLE(DRAG_SUPPORT)2731 if (m_frame.settings().touchDragDropEnabled()) {2732 IntPoint adjustedPoint = gestureEvent.position();2733 #if ENABLE(TOUCH_ADJUSTMENT)2734 adjustGesturePosition(gestureEvent, adjustedPoint);2735 #endif2736 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosition(), LeftButton, PlatformEvent::MousePressed, 0, false, false, false, false, WTF::currentTime());2737 handleMousePressEvent(mouseDownEvent);2738 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosition(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WTF::currentTime());2739 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);2740 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragEvent);2741 m_didStartDrag = false;2742 RefPtr<Frame> subframe = subframeForHitTestResult(mev);2743 if (subframe && !m_mouseDownMayStartDrag) {2744 if (subframe->eventHandler().handleGestureLongPress(gestureEvent))2745 return true;2746 }2747 handleDrag(mev, DontCheckDragHysteresis);2748 if (m_didStartDrag)2749 return true;2750 }2751 #endif2752 return handleGestureForTextSelectionOrContextMenu(gestureEvent);2753 }2754 2755 bool EventHandler::handleGestureLongTap(const PlatformGestureEvent& gestureEvent)2756 {2757 #if ENABLE(CONTEXT_MENUS)2758 if (!m_didLongPressInvokeContextMenu)2759 return sendContextMenuEventForGesture(gestureEvent);2760 #endif // ENABLE(CONTEXT_MENUS)2761 return false;2762 }2763 2764 bool EventHandler::handleGestureForTextSelectionOrContextMenu(const PlatformGestureEvent& gestureEvent)2765 {2766 #if ENABLE(CONTEXT_MENUS)2767 m_didLongPressInvokeContextMenu = (gestureEvent.type() == PlatformEvent::GestureLongPress);2768 return sendContextMenuEventForGesture(gestureEvent);2769 #else2770 return false;2771 #endif2772 }2773 2774 bool EventHandler::handleGestureTwoFingerTap(const PlatformGestureEvent& gestureEvent)2775 {2776 return handleGestureForTextSelectionOrContextMenu(gestureEvent);2777 }2778 2779 bool EventHandler::passGestureEventToWidget(const PlatformGestureEvent& gestureEvent, Widget* widget)2780 {2781 if (!widget)2782 return false;2783 2784 if (!widget->isFrameView())2785 return false;2786 2787 return toFrameView(widget)->frame().eventHandler().handleGestureEvent(gestureEvent);2788 }2789 2790 bool EventHandler::passGestureEventToWidgetIfPossible(const PlatformGestureEvent& gestureEvent, RenderObject* renderer)2791 {2792 if (m_lastHitTestResultOverWidget && renderer && renderer->isWidget()) {2793 Widget* widget = toRenderWidget(renderer)->widget();2794 return widget && passGestureEventToWidget(gestureEvent, widget);2795 }2796 return false;2797 }2798 2799 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureEvent)2800 {2801 Document* document = m_frame.document();2802 RenderObject* documentRenderer = document->renderView();2803 if (!documentRenderer)2804 return false;2805 2806 FrameView* view = m_frame.view();2807 if (!view)2808 return false;2809 2810 LayoutPoint viewPoint = view->windowToContents(gestureEvent.position());2811 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);2812 HitTestResult result(viewPoint);2813 document->renderView()->hitTest(request, result);2814 2815 m_lastHitTestResultOverWidget = result.isOverWidget();2816 m_scrollGestureHandlingNode = result.innerNode();2817 m_previousGestureScrolledElement = nullptr;2818 2819 Node* node = m_scrollGestureHandlingNode.get();2820 if (node)2821 passGestureEventToWidgetIfPossible(gestureEvent, node->renderer());2822 2823 return node && node->renderer();2824 }2825 2826 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gestureEvent)2827 {2828 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY());2829 if (delta.isZero())2830 return false;2831 2832 const float scaleFactor = m_frame.pageZoomFactor() * m_frame.frameScaleFactor();2833 delta.scale(1 / scaleFactor, 1 / scaleFactor);2834 2835 Node* node = m_scrollGestureHandlingNode.get();2836 if (!node)2837 return sendScrollEventToView(gestureEvent, delta);2838 2839 // Ignore this event if the targeted node does not have a valid renderer.2840 RenderObject* renderer = node->renderer();2841 if (!renderer)2842 return false;2843 2844 RefPtr<FrameView> protector(m_frame.view());2845 2846 // Try to send the event to the correct view.2847 if (passGestureEventToWidgetIfPossible(gestureEvent, renderer))2848 return true;2849 2850 Element* stopElement = 0;2851 bool scrollShouldNotPropagate = gestureEvent.type() == PlatformEvent::GestureScrollUpdateWithoutPropagation;2852 if (scrollShouldNotPropagate)2853 stopElement = m_previousGestureScrolledElement.get();2854 2855 // First try to scroll the closest scrollable RenderBox ancestor of |node|.2856 ScrollGranularity granularity = ScrollByPixel;2857 bool horizontalScroll = scrollNode(delta.width(), granularity, ScrollLeft, ScrollRight, node, &stopElement);2858 bool verticalScroll = scrollNode(delta.height(), granularity, ScrollUp, ScrollDown, node, &stopElement);2859 2860 if (scrollShouldNotPropagate)2861 m_previousGestureScrolledElement = stopElement;2862 2863 if (horizontalScroll || verticalScroll) {2864 setFrameWasScrolledByUser();2865 return true;2866 }2867 2868 // Otherwise try to scroll the view.2869 return sendScrollEventToView(gestureEvent, delta);2870 }2871 2872 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEvent, const FloatSize& scaledDelta)2873 {2874 FrameView* view = m_frame.view();2875 if (!view)2876 return false;2877 2878 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier);2879 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y());2880 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalPosition().y());2881 PlatformWheelEvent syntheticWheelEvent(point, globalPoint,2882 scaledDelta.width(), scaledDelta.height(),2883 scaledDelta.width() / tickDivisor, scaledDelta.height() / tickDivisor,2884 ScrollByPixelWheelEvent,2885 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey());2886 #if PLATFORM(MAC)2887 syntheticWheelEvent.setHasPreciseScrollingDeltas(true);2888 #endif2889 2890 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent);2891 if (scrolledFrame)2892 setFrameWasScrolledByUser();2893 2894 return scrolledFrame;2895 }2896 2897 void EventHandler::clearGestureScrollNodes()2898 {2899 m_scrollGestureHandlingNode = nullptr;2900 m_previousGestureScrolledElement = nullptr;2901 }2902 2903 bool EventHandler::isScrollbarHandlingGestures() const2904 {2905 return m_scrollbarHandlingScrollGesture.get();2906 }2907 #endif // ENABLE(GESTURE_EVENTS)2908 2909 2568 #if ENABLE(TOUCH_ADJUSTMENT) 2910 2569 bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const … … 3079 2738 return !dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, mouseEvent, false); 3080 2739 } 3081 3082 #if ENABLE(GESTURE_EVENTS)3083 bool EventHandler::sendContextMenuEventForGesture(const PlatformGestureEvent& event)3084 {3085 #if OS(WINDOWS)3086 PlatformEvent::Type eventType = PlatformEvent::MouseReleased;3087 #else3088 PlatformEvent::Type eventType = PlatformEvent::MousePressed;3089 #endif3090 3091 IntPoint adjustedPoint = event.position();3092 #if ENABLE(TOUCH_ADJUSTMENT)3093 adjustGesturePosition(event, adjustedPoint);3094 #endif3095 PlatformMouseEvent mouseEvent(adjustedPoint, event.globalPosition(), RightButton, eventType, 1, false, false, false, false, WTF::currentTime());3096 // To simulate right-click behavior, we send a right mouse down and then3097 // context menu event.3098 handleMousePressEvent(mouseEvent);3099 return sendContextMenuEvent(mouseEvent);3100 // We do not need to send a corresponding mouse release because in case of3101 // right-click, the context menu takes capture and consumes all events.3102 }3103 #endif // ENABLE(GESTURE_EVENTS)3104 2740 #endif // ENABLE(CONTEXT_MENUS) 3105 2741 -
trunk/Source/WebCore/page/EventHandler.h
r156815 r157316 86 86 struct DragState; 87 87 88 #if ENABLE(GESTURE_EVENTS)89 class PlatformGestureEvent;90 #endif91 92 88 #if ENABLE(DRAG_SUPPORT) 93 89 extern const int LinkDragHysteresis; … … 180 176 bool handlePasteGlobalSelection(const PlatformMouseEvent&); 181 177 182 #if ENABLE(GESTURE_EVENTS)183 bool handleGestureEvent(const PlatformGestureEvent&);184 bool handleGestureTap(const PlatformGestureEvent&);185 bool handleGestureLongPress(const PlatformGestureEvent&);186 bool handleGestureLongTap(const PlatformGestureEvent&);187 bool handleGestureTwoFingerTap(const PlatformGestureEvent&);188 bool handleGestureScrollUpdate(const PlatformGestureEvent&);189 bool handleGestureScrollBegin(const PlatformGestureEvent&);190 void clearGestureScrollNodes();191 bool isScrollbarHandlingGestures() const;192 #endif193 194 178 #if ENABLE(TOUCH_ADJUSTMENT) 195 179 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; … … 205 189 bool sendContextMenuEvent(const PlatformMouseEvent&); 206 190 bool sendContextMenuEventForKey(); 207 #if ENABLE(GESTURE_EVENTS)208 bool sendContextMenuEventForGesture(const PlatformGestureEvent&);209 #endif210 191 #endif 211 192 … … 395 376 #endif 396 377 397 #if ENABLE(GESTURE_EVENTS)398 bool handleGestureTapDown();399 bool handleGestureForTextSelectionOrContextMenu(const PlatformGestureEvent&);400 bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*);401 bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderObject*);402 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&);403 #endif404 405 378 void setLastKnownMousePosition(const PlatformMouseEvent&); 406 379 … … 497 470 #endif 498 471 499 #if ENABLE(GESTURE_EVENTS)500 RefPtr<Node> m_scrollGestureHandlingNode;501 bool m_lastHitTestResultOverWidget;502 RefPtr<Element> m_previousGestureScrolledElement;503 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture;504 #endif505 506 472 double m_maxMouseMovedDuration; 507 473 PlatformEvent::Type m_baseEventType; -
trunk/Source/WebCore/platform/Scrollbar.cpp
r157253 r157316 35 35 #include <algorithm> 36 36 37 #if ENABLE(GESTURE_EVENTS)38 #include "PlatformGestureEvent.h"39 #endif40 41 37 using namespace std; 42 38 … … 341 337 } 342 338 343 #if ENABLE(GESTURE_EVENTS)344 bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt)345 {346 bool handled = false;347 switch (evt.type()) {348 case PlatformEvent::GestureTapDown:349 setPressedPart(theme()->hitTest(this, evt.position()));350 m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());351 return true;352 case PlatformEvent::GestureTapDownCancel:353 case PlatformEvent::GestureScrollBegin:354 if (m_pressedPart == ThumbPart) {355 m_scrollPos = m_pressedPos;356 return true;357 }358 break;359 case PlatformEvent::GestureScrollUpdate:360 case PlatformEvent::GestureScrollUpdateWithoutPropagation:361 if (m_pressedPart == ThumbPart) {362 m_scrollPos += HorizontalScrollbar ? evt.deltaX() : evt.deltaY();363 moveThumb(m_scrollPos, false);364 return true;365 }366 break;367 case PlatformEvent::GestureScrollEnd:368 m_scrollPos = 0;369 break;370 case PlatformEvent::GestureTap:371 if (m_pressedPart != ThumbPart && m_pressedPart != NoPart)372 handled = m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity());373 break;374 default:375 break;376 }377 setPressedPart(NoPart);378 m_pressedPos = 0;379 return handled;380 }381 #endif382 383 339 bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt) 384 340 { -
trunk/Source/WebCore/platform/Scrollbar.h
r157253 r157316 42 42 class ScrollbarTheme; 43 43 44 #if ENABLE(GESTURE_EVENTS)45 class PlatformGestureEvent;46 #endif47 48 44 class Scrollbar : public Widget, 49 45 public ScrollbarThemeClient { … … 127 123 bool isWindowActive() const; 128 124 129 #if ENABLE(GESTURE_EVENTS)130 bool gestureEvent(const PlatformGestureEvent&);131 #endif132 133 125 // These methods are used for platform scrollbars to give :hover feedback. They will not get called 134 126 // when the mouse went down in a scrollbar, since it is assumed the scrollbar will start -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h
r151757 r157316 31 31 #include "PlatformWheelEvent.h" 32 32 33 #if ENABLE(GESTURE_EVENTS)34 #include "PlatformGestureEvent.h"35 #endif36 37 33 namespace WebCore { 38 34 … … 42 38 static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView); 43 39 static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *); 44 #if ENABLE(GESTURE_EVENTS)45 static PlatformGestureEvent createPlatformGestureEvent(NSEvent *, NSView *windowView);46 #endif47 40 }; 48 41 -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
r156860 r157316 195 195 return static_cast<PlatformWheelEventPhase>(phase); 196 196 } 197 198 #if ENABLE(GESTURE_EVENTS)199 static PlatformEvent::Type gestureEventTypeForEvent(NSEvent *event)200 {201 switch ([event type]) {202 case NSEventTypeBeginGesture:203 return PlatformEvent::GestureScrollBegin;204 case NSEventTypeEndGesture:205 return PlatformEvent::GestureScrollEnd;206 default:207 ASSERT_NOT_REACHED();208 return PlatformEvent::GestureScrollEnd;209 }210 }211 #endif212 197 213 198 static inline String textFromEvent(NSEvent* event) … … 525 510 } 526 511 527 #if ENABLE(GESTURE_EVENTS)528 class PlatformGestureEventBuilder : public PlatformGestureEvent {529 public:530 PlatformGestureEventBuilder(NSEvent *event, NSView *windowView)531 {532 // PlatformEvent533 m_type = gestureEventTypeForEvent(event);534 m_modifiers = modifiersForEvent(event);535 m_timestamp = eventTimeStampSince1970(event);536 537 // PlatformGestureEvent538 m_position = pointForEvent(event, windowView);539 m_globalPosition = globalPointForEvent(event);540 m_deltaX = 0;541 m_deltaY = 0;542 }543 };544 545 PlatformGestureEvent PlatformEventFactory::createPlatformGestureEvent(NSEvent *event, NSView *windowView)546 {547 return PlatformGestureEventBuilder(event, windowView);548 }549 #endif550 551 512 } // namespace WebCore -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r157272 r157316 34 34 #include "GraphicsLayer.h" 35 35 #include "NSScrollerImpDetails.h" 36 #include "PlatformGestureEvent.h"37 36 #include "PlatformWheelEvent.h" 38 37 #include "ScrollView.h"
Note: See TracChangeset
for help on using the changeset viewer.