ChromeProcessController.h (4295B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_layers_ChromeProcessController_h 8 #define mozilla_layers_ChromeProcessController_h 9 10 #include "mozilla/layers/GeckoContentController.h" 11 #include "nsCOMPtr.h" 12 #include "mozilla/RefPtr.h" 13 #include "mozilla/layers/MatrixMessage.h" 14 15 class nsIDOMWindowUtils; 16 class nsISerialEventTarget; 17 class nsIWidget; 18 19 namespace mozilla { 20 class PresShell; 21 namespace dom { 22 class Document; 23 } 24 25 namespace layers { 26 27 class IAPZCTreeManager; 28 class APZEventState; 29 struct DoubleTapToZoomMetrics; 30 31 /** 32 * ChromeProcessController is a GeckoContentController attached to the root of 33 * a compositor's layer tree. It's used directly by APZ by default, and remoted 34 * using PAPZ if there is a gpu process. 35 * 36 * If ChromeProcessController needs to implement a new method on 37 * GeckoContentController PAPZ, APZChild, and RemoteContentController must be 38 * updated to handle it. 39 */ 40 class ChromeProcessController : public mozilla::layers::GeckoContentController { 41 protected: 42 typedef mozilla::layers::FrameMetrics FrameMetrics; 43 typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid; 44 45 public: 46 explicit ChromeProcessController(nsIWidget* aWidget, 47 APZEventState* aAPZEventState, 48 IAPZCTreeManager* aAPZCTreeManager); 49 virtual ~ChromeProcessController(); 50 void Destroy() override; 51 52 // GeckoContentController interface 53 void NotifyLayerTransforms(nsTArray<MatrixMessage>&& aTransforms) override; 54 void RequestContentRepaint(const RepaintRequest& aRequest) override; 55 bool IsRepaintThread() override; 56 void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) override; 57 MOZ_CAN_RUN_SCRIPT 58 void HandleTap( 59 TapType aType, const mozilla::LayoutDevicePoint& aPoint, 60 Modifiers aModifiers, const ScrollableLayerGuid& aGuid, 61 uint64_t aInputBlockId, 62 const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) override; 63 void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType, 64 const ScrollableLayerGuid& aGuid, 65 const LayoutDevicePoint& aFocusPoint, 66 LayoutDeviceCoord aSpanChange, 67 Modifiers aModifiers) override; 68 void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, 69 APZStateChange aChange, int aArg, 70 Maybe<uint64_t> aInputBlockId) override; 71 void NotifyMozMouseScrollEvent(const ScrollableLayerGuid::ViewID& aScrollId, 72 const nsString& aEvent) override; 73 void NotifyFlushComplete() override; 74 void NotifyAsyncScrollbarDragInitiated( 75 uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId, 76 ScrollDirection aDirection) override; 77 void NotifyAsyncScrollbarDragRejected( 78 const ScrollableLayerGuid::ViewID& aScrollId) override; 79 void NotifyAsyncAutoscrollRejected( 80 const ScrollableLayerGuid::ViewID& aScrollId) override; 81 void CancelAutoscroll(const ScrollableLayerGuid& aGuid) override; 82 void NotifyScaleGestureComplete(const ScrollableLayerGuid& aGuid, 83 float aScale) override; 84 85 PresShell* GetTopLevelPresShell() const override { return GetPresShell(); } 86 87 private: 88 nsCOMPtr<nsIWidget> mWidget; 89 RefPtr<APZEventState> mAPZEventState; 90 RefPtr<IAPZCTreeManager> mAPZCTreeManager; 91 nsCOMPtr<nsISerialEventTarget> mUIThread; 92 93 void InitializeRoot(); 94 PresShell* GetPresShell() const; 95 dom::Document* GetRootDocument() const; 96 dom::Document* GetRootContentDocument( 97 const ScrollableLayerGuid::ViewID& aScrollId) const; 98 void HandleDoubleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, 99 const ScrollableLayerGuid& aGuid, 100 const DoubleTapToZoomMetrics& aDoubleTapToZoomMetrics); 101 nsIFrame* GetWidgetFrame() const; 102 }; 103 104 } // namespace layers 105 } // namespace mozilla 106 107 #endif /* mozilla_layers_ChromeProcessController_h */