Bug 1879449 [wpt PR 44489] - [wptrunner] Add `infrastructure/expected-fail/` test...
[gecko.git] / layout / base / ZoomConstraintsClient.h
blob3f80ca75580e089b5fdf1377632991fa5d641d1c
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/. */
7 #ifndef ZoomConstraintsClient_h_
8 #define ZoomConstraintsClient_h_
10 #include "mozilla/layers/ScrollableLayerGuid.h"
11 #include "mozilla/layers/ZoomConstraints.h"
12 #include "mozilla/Maybe.h"
13 #include "nsCOMPtr.h"
14 #include "nsIDOMEventListener.h"
15 #include "nsIObserver.h"
17 namespace mozilla {
18 class PresShell;
19 namespace dom {
20 class Document;
21 class EventTarget;
22 } // namespace dom
23 } // namespace mozilla
25 class ZoomConstraintsClient final : public nsIDOMEventListener,
26 public nsIObserver {
27 public:
28 NS_DECL_ISUPPORTS
29 NS_DECL_NSIDOMEVENTLISTENER
30 NS_DECL_NSIOBSERVER
32 ZoomConstraintsClient();
34 private:
35 ~ZoomConstraintsClient();
37 public:
38 void Init(mozilla::PresShell* aPresShell, mozilla::dom::Document* aDocument);
39 void Destroy();
40 void ScreenSizeChanged();
42 bool GetAllowZoom() const { return mZoomConstraints.mAllowZoom; }
44 private:
45 void RefreshZoomConstraints();
47 RefPtr<mozilla::dom::Document> mDocument;
48 // raw ref since the presShell owns this
49 mozilla::PresShell* MOZ_NON_OWNING_REF mPresShell;
50 nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
51 mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid;
52 mozilla::layers::ZoomConstraints mZoomConstraints;
55 #endif