diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-05 11:57:10 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-14 16:43:37 +0200 |
commit | 3a30ed4ecc9c828641daef85f88f93baf78826b6 (patch) | |
tree | c3315442f4f7241a22d881bf916661e5f34f4f49 /src/core/render_widget_host_view_qt.h | |
parent | b1d423a3fc2cb3eeacc2a3e91ac9bdd2211c2613 (diff) |
Use the unified gesture recognizer
The ui::GestureRecognizer is now tightly coupled with Aura and won't
be usable on Mac or Android.
Fortunately, the reason for this is that a new gesture recognizer
common to both Android and Aura, ui::GestureProvider has been
introduced. Using it allows us to stop pulling touch event types
from Aura build files.
Most of the change is about using ui::MotionEvent instead of
ui::TouchEvent, and to feed them to the GestureProvider.
A major difference is that the touch events sent to the renderer
are not passed through the gesture recognizer only when the come
back unhandled. They are instead always sent to both the renderer
and the GestureProvider, and the call to OnTouchEventAck on the
gesture filter tells it if the next event in the queue was handled
or not, deciding if the gesture should be cancelled.
Change-Id: Ifccebf85800cdf0ef29cf52b13f1bd659428e3f6
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/core/render_widget_host_view_qt.h')
-rw-r--r-- | src/core/render_widget_host_view_qt.h | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index bb0478787..cbcd3a36e 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -49,14 +49,13 @@ #include "cc/resources/transferable_resource.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "delegated_frame_node.h" -#include "ui/events/gestures/gesture_recognizer.h" -#include "ui/events/gestures/gesture_types.h" -#include <QMap> +#include "ui/events/gesture_detection/filtered_gesture_provider.h" #include <QPoint> #include <QRect> #include <QtGlobal> +#include "delegated_frame_node.h" + QT_BEGIN_NAMESPACE class QEvent; class QFocusEvent; @@ -93,8 +92,7 @@ struct MultipleMouseClickHelper class RenderWidgetHostViewQt : public content::RenderWidgetHostViewBase - , public ui::GestureConsumer - , public ui::GestureEventHelper + , public ui::GestureProviderClient , public RenderWidgetHostViewQtDelegateClient , public content::BrowserAccessibilityDelegate , public base::SupportsWeakPtr<RenderWidgetHostViewQt> @@ -157,10 +155,8 @@ public: // Overridden from RenderWidgetHostViewBase. virtual void SelectionChanged(const base::string16 &text, size_t offset, const gfx::Range &range) Q_DECL_OVERRIDE; - // Overridden from ui::GestureEventHelper. - virtual bool CanDispatchToConsumer(ui::GestureConsumer*) Q_DECL_OVERRIDE; - virtual void DispatchGestureEvent(ui::GestureEvent*) Q_DECL_OVERRIDE; - virtual void DispatchCancelTouchEvent(ui::TouchEvent*) Q_DECL_OVERRIDE; + // Overridden from ui::GestureProviderClient. + virtual void OnGestureEvent(const ui::GestureEventData& gesture) Q_DECL_OVERRIDE; // Overridden from RenderWidgetHostViewQtDelegateClient. virtual QSGNode *updatePaintNode(QSGNode *) Q_DECL_OVERRIDE; @@ -224,20 +220,16 @@ public: private: void sendDelegatedFrameAck(); - void ProcessGestures(ui::GestureRecognizer::Gestures *gestures); - void ForwardGestureEventToRenderer(ui::GestureEvent* gesture); - int GetMappedTouch(int qtTouchId); - void RemoveExpiredMappings(QTouchEvent *ev); + void processMotionEvent(const ui::MotionEvent &motionEvent); float dpiScale() const; bool IsPopup() const; void CreateBrowserAccessibilityManagerIfNeeded(); content::RenderWidgetHostImpl *m_host; - scoped_ptr<ui::GestureRecognizer> m_gestureRecognizer; + ui::FilteredGestureProvider m_gestureProvider; base::TimeDelta m_eventsToNowDelta; - QMap<int, int> m_touchIdMapping; - blink::WebTouchEvent m_accumTouchEvent; + bool m_sendMotionActionDown; scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate; QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_frameNodeData; |