Changeset 157316 in webkit


Ignore:
Timestamp:
Oct 11, 2013 12:16:35 PM (11 years ago)
Author:
andersca@apple.com
Message:

Remove gesture event support from WebCore
https://bugs.webkit.org/show_bug.cgi?id=122650

Reviewed by Ryosuke Niwa.

Source/WebCore:

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.exp.in:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/GestureEvent.cpp: Removed.
  • dom/GestureEvent.h: Removed.
  • dom/Node.cpp:
  • dom/Node.h:
  • page/EventHandler.cpp:

(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::sendContextMenuEventForKey):

  • page/EventHandler.h:
  • platform/PlatformGestureEvent.h: Removed.
  • platform/Scrollbar.cpp:
  • platform/Scrollbar.h:
  • platform/mac/PlatformEventFactoryMac.h:
  • platform/mac/PlatformEventFactoryMac.mm:

Source/WTF:

  • wtf/FeatureDefines.h:
  • wtf/nix/FeatureDefinesNix.h:
Location:
trunk/Source
Files:
3 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r157260 r157316  
     12013-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
    1112013-10-09  Filip Pizlo  <fpizlo@apple.com>
    212
  • trunk/Source/WTF/wtf/FeatureDefines.h

    r157143 r157316  
    175175#endif
    176176
    177 #if !defined(ENABLE_GESTURE_EVENTS)
    178 #define ENABLE_GESTURE_EVENTS 1
    179 #endif
    180 
    181177#if !defined(ENABLE_RUBBER_BANDING)
    182178#define ENABLE_RUBBER_BANDING 1
     
    486482#endif
    487483
    488 #if !defined(ENABLE_GESTURE_EVENTS)
    489 #define ENABLE_GESTURE_EVENTS 0
    490 #endif
    491 
    492484#if !defined(ENABLE_GLIB_SUPPORT)
    493485#define ENABLE_GLIB_SUPPORT 0
  • trunk/Source/WTF/wtf/nix/FeatureDefinesNix.h

    r156567 r157316  
    135135#endif
    136136
    137 #if !defined(ENABLE_GESTURE_EVENTS)
    138 #define ENABLE_GESTURE_EVENTS 1
    139 #endif
    140 
    141137#if !defined(ENABLE_ICONDATABASE)
    142138#define ENABLE_ICONDATABASE 1
  • trunk/Source/WebCore/CMakeLists.txt

    r157288 r157316  
    11381138    dom/FocusEvent.cpp
    11391139    dom/GenericEventQueue.cpp
    1140     dom/GestureEvent.cpp
    11411140    dom/IconURL.cpp
    11421141    dom/IdTargetObserver.cpp
  • trunk/Source/WebCore/ChangeLog

    r157314 r157316  
     12013-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
    1272013-10-11  Tim Horton  <timothy_horton@apple.com>
    228
  • trunk/Source/WebCore/GNUmakefile.list.am

    r157288 r157316  
    28442844        Source/WebCore/dom/FocusEvent.h \
    28452845        Source/WebCore/dom/FragmentScriptingPermission.h \
    2846         Source/WebCore/dom/GestureEvent.cpp \
    2847         Source/WebCore/dom/GestureEvent.h \
    28482846        Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h \
    28492847        Source/WebCore/dom/ExceptionCodePlaceholder.h \
  • trunk/Source/WebCore/WebCore.exp.in

    r157265 r157316  
    24912491#endif
    24922492
    2493 #if ENABLE(GESTURE_EVENTS)
    2494 __ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE
    2495 #endif
    2496 
    24972493#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
    24982494__ZN7WebCore8Settings38setHiddenPageDOMTimerThrottlingEnabledEb
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r157288 r157316  
    126126                071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; };
    127127                0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09E14D3323500642955 /* GenericEventQueue.cpp */; };
    128                 0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642956 /* GestureEvent.cpp */; };
    129128                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, ); }; };
    131129                07277E4C17D018CC0015534D /* JSMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4017D018CC0015534D /* JSMediaStream.cpp */; };
    132130                07277E4D17D018CC0015534D /* JSMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4117D018CC0015534D /* JSMediaStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    49414939                BC94D1530C275C8B006BC617 /* History.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1500C275C8B006BC617 /* History.cpp */; };
    49424940                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, ); }; };
    49444941                BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    49454942                BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC96DB450F3A882200573CB3 /* RenderBoxModelObject.cpp */; };
     
    64936490                0720B09E14D3323500642955 /* GenericEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericEventQueue.cpp; sourceTree = "<group>"; };
    64946491                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>"; };
    64976492                07221B4A17CEC32700848E51 /* MediaConstraintsImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraintsImpl.cpp; sourceTree = "<group>"; };
    64986493                07221B4B17CEC32700848E51 /* MediaConstraintsImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaConstraintsImpl.h; sourceTree = "<group>"; };
     
    1181211807                BC94D1510C275C8B006BC617 /* History.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = History.h; sourceTree = "<group>"; };
    1181311808                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>"; };
    1181511809                BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderBoxModelObject.h; sourceTree = "<group>"; };
    1181611810                BC96DB450F3A882200573CB3 /* RenderBoxModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderBoxModelObject.cpp; sourceTree = "<group>"; };
     
    1977219766                                BC5C76291497FE1400BC4775 /* PlatformEvent.h */,
    1977319767                                A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */,
    19774                                 BC9585DF12F0989500755821 /* PlatformGestureEvent.h */,
    1977519768                                935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */,
    1977619769                                932871BF0B20DEB70049035A /* PlatformMenuDescription.h */,
     
    2085520848                                0720B09E14D3323500642955 /* GenericEventQueue.cpp */,
    2085620849                                0720B09F14D3323500642955 /* GenericEventQueue.h */,
    20857                                 0720B09F14D3323500642956 /* GestureEvent.cpp */,
    20858                                 0720B09F14D3323500642957 /* GestureEvent.h */,
    2085920850                                2442BBF81194C9D300D49469 /* HashChangeEvent.h */,
    2086020851                                8482B7441198C32E00BFB005 /* HashChangeEvent.idl */,
     
    2244322434                                9746AF2A14F4DDE6003E7A70 /* Geoposition.h in Headers */,
    2244422435                                078E092A17D14D1C00420AA1 /* RTCStatsReport.h in Headers */,
    22445                                 0720B0A114D3323500642957 /* GestureEvent.h in Headers */,
    2244622436                                086BBD0F136039C2008B15D8 /* Glyph.h in Headers */,
    2244722437                                B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */,
     
    2353623526                                BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */,
    2353723527                                A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */,
    23538                                 BC9585E112F0989500755821 /* PlatformGestureEvent.h in Headers */,
    2353923528                                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
    2354023529                                0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */,
     
    2467124660                                93F199FD08245E59001E9ABC /* Resources */,
    2467224661                                CD0DBF001422765700280263 /* Copy Audio Resources */,
    24673                                 1C81BA330E97357C00266E07 /* Copy Inspector Resources */,
    24674                                 1C5F9D760E09A1B400E91D0A /* Streamline Inspector Source */,
    2467524662                                93F19A0C08245E59001E9ABC /* Sources */,
    2467624663                                93F19B1208245E59001E9ABC /* Frameworks */,
     
    2565625643                                9746AF2314F4DDE6003E7A70 /* Geolocation.cpp in Sources */,
    2565725644                                9746AF2614F4DDE6003E7A70 /* GeolocationController.cpp in Sources */,
    25658                                 0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */,
    2565925645                                B2C3DA6D0D006CD600EF6F26 /* GlyphPageTreeNode.cpp in Sources */,
    2566025646                                B2AFFC830D00A5C10030074D /* GlyphPageTreeNodeMac.cpp in Sources */,
  • trunk/Source/WebCore/dom/Node.cpp

    r157288 r157316  
    114114#include <wtf/text/StringBuilder.h>
    115115
    116 #if ENABLE(GESTURE_EVENTS)
    117 #include "GestureEvent.h"
    118 #endif
    119 
    120116#if ENABLE(INDIE_UI)
    121117#include "UIRequestEvent.h"
     
    21012097}
    21022098
    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 #endif
    2119 
    21202099#if ENABLE(TOUCH_EVENTS)
    21212100bool Node::dispatchTouchEvent(PassRefPtr<TouchEvent> event)
  • trunk/Source/WebCore/dom/Node.h

    r157288 r157316  
    8080class TagNodeList;
    8181
    82 #if ENABLE(GESTURE_EVENTS)
    83 class PlatformGestureEvent;
    84 #endif
    85 
    8682#if ENABLE(INDIE_UI)
    8783class UIRequestEvent;
     
    538534    bool dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent);
    539535
    540 #if ENABLE(GESTURE_EVENTS)
    541     bool dispatchGestureEvent(const PlatformGestureEvent&);
    542 #endif
    543536#if ENABLE(TOUCH_EVENTS)
    544537    bool dispatchTouchEvent(PassRefPtr<TouchEvent>);
  • trunk/Source/WebCore/page/EventHandler.cpp

    r157058 r157316  
    9393#include <wtf/TemporaryChange.h>
    9494
    95 #if ENABLE(GESTURE_EVENTS)
    96 #include "PlatformGestureEvent.h"
    97 #endif
    98 
    9995#if ENABLE(TOUCH_ADJUSTMENT)
    10096#include "TouchAdjustment.h"
     
    287283}
    288284
    289 #if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)) || ENABLE(GESTURE_EVENTS)
     285#if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS))
    290286static inline bool shouldGesturesTriggerActive()
    291287{
     
    348344    , m_originatingTouchPointTargetKey(0)
    349345    , m_touchPressed(false)
    350 #endif
    351 #if ENABLE(GESTURE_EVENTS)
    352     , m_scrollGestureHandlingNode(nullptr)
    353     , m_lastHitTestResultOverWidget(false)
    354346#endif
    355347    , m_maxMouseMovedDuration(0)
     
    417409    m_originatingTouchPointDocument.clear();
    418410    m_originatingTouchPointTargetKey = 0;
    419 #endif
    420 #if ENABLE(GESTURE_EVENTS)
    421     m_scrollGestureHandlingNode = nullptr;
    422     m_lastHitTestResultOverWidget = false;
    423     m_previousGestureScrolledElement = nullptr;
    424     m_scrollbarHandlingScrollGesture = 0;
    425411#endif
    426412    m_maxMouseMovedDuration = 0;
     
    25802566}
    25812567
    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::GestureScrollEnd
    2607         || gestureEvent.type() == PlatformEvent::GestureScrollUpdate
    2608         || 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 #endif
    2619         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 the
    2624         // targeted node, so performing a ReadOnly hit test here is fine.
    2625         hitType |= HitTestRequest::ReadOnly;
    2626     }
    2627     else
    2628         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) will
    2664     // 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 #endif
    2702 
    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/93123
    2711     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 #endif
    2736         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 #endif
    2752     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 #else
    2770     return false;
    2771 #endif
    2772 }
    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 #endif
    2889 
    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() const
    2904 {
    2905     return m_scrollbarHandlingScrollGesture.get();
    2906 }
    2907 #endif // ENABLE(GESTURE_EVENTS)
    2908 
    29092568#if ENABLE(TOUCH_ADJUSTMENT)
    29102569bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const
     
    30792738    return !dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, mouseEvent, false);
    30802739}
    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 #else
    3088     PlatformEvent::Type eventType = PlatformEvent::MousePressed;
    3089 #endif
    3090 
    3091     IntPoint adjustedPoint = event.position();
    3092 #if ENABLE(TOUCH_ADJUSTMENT)
    3093     adjustGesturePosition(event, adjustedPoint);
    3094 #endif
    3095     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 then
    3097     // context menu event.
    3098     handleMousePressEvent(mouseEvent);
    3099     return sendContextMenuEvent(mouseEvent);
    3100     // We do not need to send a corresponding mouse release because in case of
    3101     // right-click, the context menu takes capture and consumes all events.
    3102 }
    3103 #endif // ENABLE(GESTURE_EVENTS)
    31042740#endif // ENABLE(CONTEXT_MENUS)
    31052741
  • trunk/Source/WebCore/page/EventHandler.h

    r156815 r157316  
    8686struct DragState;
    8787
    88 #if ENABLE(GESTURE_EVENTS)
    89 class PlatformGestureEvent;
    90 #endif
    91 
    9288#if ENABLE(DRAG_SUPPORT)
    9389extern const int LinkDragHysteresis;
     
    180176    bool handlePasteGlobalSelection(const PlatformMouseEvent&);
    181177
    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 #endif
    193 
    194178#if ENABLE(TOUCH_ADJUSTMENT)
    195179    bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const;
     
    205189    bool sendContextMenuEvent(const PlatformMouseEvent&);
    206190    bool sendContextMenuEventForKey();
    207 #if ENABLE(GESTURE_EVENTS)
    208     bool sendContextMenuEventForGesture(const PlatformGestureEvent&);
    209 #endif
    210191#endif
    211192
     
    395376#endif
    396377
    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 #endif
    404 
    405378    void setLastKnownMousePosition(const PlatformMouseEvent&);
    406379
     
    497470#endif
    498471
    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 #endif
    505 
    506472    double m_maxMouseMovedDuration;
    507473    PlatformEvent::Type m_baseEventType;
  • trunk/Source/WebCore/platform/Scrollbar.cpp

    r157253 r157316  
    3535#include <algorithm>
    3636
    37 #if ENABLE(GESTURE_EVENTS)
    38 #include "PlatformGestureEvent.h"
    39 #endif
    40 
    4137using namespace std;
    4238
     
    341337}
    342338
    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 #endif
    382 
    383339bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
    384340{
  • trunk/Source/WebCore/platform/Scrollbar.h

    r157253 r157316  
    4242class ScrollbarTheme;
    4343
    44 #if ENABLE(GESTURE_EVENTS)
    45 class PlatformGestureEvent;
    46 #endif
    47 
    4844class Scrollbar : public Widget,
    4945                  public ScrollbarThemeClient {
     
    127123    bool isWindowActive() const;
    128124
    129 #if ENABLE(GESTURE_EVENTS)
    130     bool gestureEvent(const PlatformGestureEvent&);
    131 #endif
    132 
    133125    // These methods are used for platform scrollbars to give :hover feedback.  They will not get called
    134126    // 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  
    3131#include "PlatformWheelEvent.h"
    3232
    33 #if ENABLE(GESTURE_EVENTS)
    34 #include "PlatformGestureEvent.h"
    35 #endif
    36 
    3733namespace WebCore {
    3834
     
    4238    static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView);
    4339    static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *);
    44 #if ENABLE(GESTURE_EVENTS)
    45     static PlatformGestureEvent createPlatformGestureEvent(NSEvent *, NSView *windowView);
    46 #endif
    4740};
    4841
  • trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm

    r156860 r157316  
    195195    return static_cast<PlatformWheelEventPhase>(phase);
    196196}
    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 #endif
    212197
    213198static inline String textFromEvent(NSEvent* event)
     
    525510}
    526511
    527 #if ENABLE(GESTURE_EVENTS)
    528 class PlatformGestureEventBuilder : public PlatformGestureEvent {
    529 public:
    530     PlatformGestureEventBuilder(NSEvent *event, NSView *windowView)
    531     {
    532         // PlatformEvent
    533         m_type                              = gestureEventTypeForEvent(event);
    534         m_modifiers                         = modifiersForEvent(event);
    535         m_timestamp                         = eventTimeStampSince1970(event);
    536 
    537         // PlatformGestureEvent
    538         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 #endif
    550 
    551512} // namespace WebCore
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r157272 r157316  
    3434#include "GraphicsLayer.h"
    3535#include "NSScrollerImpDetails.h"
    36 #include "PlatformGestureEvent.h"
    3736#include "PlatformWheelEvent.h"
    3837#include "ScrollView.h"
Note: See TracChangeset for help on using the changeset viewer.