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/. */
9 #include "mozilla/Maybe.h"
10 #include "mozilla/PresShellForwards.h"
11 #include "nsISupportsImpl.h"
12 #include "nsStringFwd.h"
13 #include "nsViewportInfo.h"
15 class nsIDOMEventListener
;
22 * The interface MobileViewportManager uses to interface with its surroundings.
23 * This mainly exists to facilitate testing MobileViewportManager in isolation
24 * from the rest of Gecko.
27 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MVMContext
)
29 virtual ~MVMContext() {}
32 virtual void AddEventListener(const nsAString
& aType
,
33 nsIDOMEventListener
* aListener
,
34 bool aUseCapture
) = 0;
35 virtual void RemoveEventListener(const nsAString
& aType
,
36 nsIDOMEventListener
* aListener
,
37 bool aUseCapture
) = 0;
38 virtual void AddObserver(nsIObserver
* aObserver
, const char* aTopic
,
40 virtual void RemoveObserver(nsIObserver
* aObserver
, const char* aTopic
) = 0;
41 virtual void Destroy() = 0;
43 virtual nsViewportInfo
GetViewportInfo(
44 const ScreenIntSize
& aDisplaySize
) const = 0;
45 virtual CSSToLayoutDeviceScale
CSSToDevPixelScale() const = 0;
46 virtual float GetResolution() const = 0;
47 virtual bool SubjectMatchesDocument(nsISupports
* aSubject
) const = 0;
48 virtual Maybe
<CSSRect
> CalculateScrollableRectForRSF() const = 0;
49 virtual bool IsResolutionUpdatedByApz() const = 0;
50 virtual LayoutDeviceMargin
ScrollbarAreaToExcludeFromCompositionBounds()
52 virtual Maybe
<LayoutDeviceIntSize
> GetContentViewerSize() const = 0;
53 virtual bool AllowZoomingForDocument() const = 0;
54 virtual bool IsInReaderMode() const = 0;
55 virtual bool IsDocumentLoading() const = 0;
57 virtual void SetResolutionAndScaleTo(float aResolution
,
58 ResolutionChangeOrigin aOrigin
) = 0;
59 virtual void SetVisualViewportSize(const CSSSize
& aSize
) = 0;
60 virtual void PostVisualViewportResizeEventByDynamicToolbar() = 0;
61 virtual void UpdateDisplayPortMargins() = 0;
63 virtual void Reflow(const CSSSize
& aNewSize
) = 0;
66 } // namespace mozilla
68 #endif // MVMContext_h_