Bug 1700051: part 33) Move `AdjustSoftBeginAndBuildSoftText` to `SoftText`. r=smaug
[gecko.git] / layout / base / MVMContext.h
blob0884cc45f14507810a70762f5c2bdafe4735ba16
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 MVMContext_h_
6 #define MVMContext_h_
8 #include "Units.h"
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;
16 class nsIObserver;
17 class nsISupports;
19 namespace mozilla {
21 /**
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.
26 class MVMContext {
27 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MVMContext)
28 protected:
29 virtual ~MVMContext() {}
31 public:
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,
39 bool aOwnsWeak) = 0;
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()
51 const = 0;
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_