Bug 1890689 apply drift correction to input rate instead of output rate r=pehrsons
[gecko.git] / layout / base / GeckoMVMContext.h
blobfdbdcf22aef10994bb5b4fca72213db2757f539f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef GeckoMVMContext_h_
6 #define GeckoMVMContext_h_
8 #include "MVMContext.h"
10 #include "mozilla/Attributes.h" // for MOZ_NON_OWNING_REF
11 #include "mozilla/RefPtr.h"
12 #include "nsCOMPtr.h"
14 namespace mozilla {
15 class PresShell;
16 namespace dom {
17 class Document;
18 class EventTarget;
19 } // namespace dom
21 /**
22 * An implementation of MVMContext that uses actual Gecko components.
23 * This is intended for production use (whereas TestMVMContext is intended for
24 * testing.)
26 class GeckoMVMContext final : public MVMContext {
27 public:
28 explicit GeckoMVMContext(dom::Document* aDocument, PresShell* aPresShell);
29 void AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener,
30 bool aUseCapture) override;
31 void RemoveEventListener(const nsAString& aType,
32 nsIDOMEventListener* aListener,
33 bool aUseCapture) override;
34 void AddObserver(nsIObserver* aObserver, const char* aTopic,
35 bool aOwnsWeak) override;
36 void RemoveObserver(nsIObserver* aObserver, const char* aTopic) override;
37 void Destroy() override;
39 nsViewportInfo GetViewportInfo(
40 const ScreenIntSize& aDisplaySize) const override;
41 CSSToLayoutDeviceScale CSSToDevPixelScale() const override;
42 float GetResolution() const override;
43 bool SubjectMatchesDocument(nsISupports* aSubject) const override;
44 Maybe<CSSRect> CalculateScrollableRectForRSF() const override;
45 bool IsResolutionUpdatedByApz() const override;
46 LayoutDeviceMargin ScrollbarAreaToExcludeFromCompositionBounds()
47 const override;
48 Maybe<LayoutDeviceIntSize> GetDocumentViewerSize() const override;
49 bool AllowZoomingForDocument() const override;
50 bool IsInReaderMode() const override;
51 bool IsDocumentLoading() const override;
53 void SetResolutionAndScaleTo(float aResolution,
54 ResolutionChangeOrigin aOrigin) override;
55 void SetVisualViewportSize(const CSSSize& aSize) override;
56 void PostVisualViewportResizeEventByDynamicToolbar() override;
57 void UpdateDisplayPortMargins() override;
58 MOZ_CAN_RUN_SCRIPT_BOUNDARY void Reflow(const CSSSize& aNewSize) override;
59 ScreenIntCoord GetDynamicToolbarOffset() override;
61 private:
62 RefPtr<dom::Document> mDocument;
63 // raw ref since the presShell owns this
64 PresShell* MOZ_NON_OWNING_REF mPresShell;
65 nsCOMPtr<dom::EventTarget> mEventTarget;
68 } // namespace mozilla
70 #endif // GeckoMVMContext_h_