2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-06-17 19:32:42 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef ZoomConstraintsClient_h_
|
|
|
|
#define ZoomConstraintsClient_h_
|
|
|
|
|
2018-11-01 23:15:46 +03:00
|
|
|
#include "mozilla/layers/ScrollableLayerGuid.h"
|
2020-09-22 07:50:54 +03:00
|
|
|
#include "mozilla/layers/ZoomConstraints.h"
|
2015-06-17 19:32:42 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
2018-11-27 01:07:03 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2015-06-17 19:32:42 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
|
2018-04-05 20:42:40 +03:00
|
|
|
namespace mozilla {
|
2019-04-16 10:25:10 +03:00
|
|
|
class PresShell;
|
2018-04-05 20:42:40 +03:00
|
|
|
namespace dom {
|
2020-02-04 22:34:51 +03:00
|
|
|
class Document;
|
2018-04-05 20:42:40 +03:00
|
|
|
class EventTarget;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-06-17 19:32:42 +03:00
|
|
|
class ZoomConstraintsClient final : public nsIDOMEventListener,
|
|
|
|
public nsIObserver {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
ZoomConstraintsClient();
|
|
|
|
|
|
|
|
private:
|
|
|
|
~ZoomConstraintsClient();
|
|
|
|
|
|
|
|
public:
|
2019-04-16 10:25:10 +03:00
|
|
|
void Init(mozilla::PresShell* aPresShell, mozilla::dom::Document* aDocument);
|
2015-06-17 19:32:42 +03:00
|
|
|
void Destroy();
|
2015-08-26 21:41:12 +03:00
|
|
|
void ScreenSizeChanged();
|
2015-06-17 19:32:42 +03:00
|
|
|
|
2020-09-22 14:21:39 +03:00
|
|
|
bool GetAllowZoom() const { return mZoomConstraints.mAllowZoom; }
|
|
|
|
|
2015-06-17 19:32:42 +03:00
|
|
|
private:
|
|
|
|
void RefreshZoomConstraints();
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
RefPtr<mozilla::dom::Document> mDocument;
|
2015-06-17 19:32:42 +03:00
|
|
|
// raw ref since the presShell owns this
|
2019-04-16 10:25:10 +03:00
|
|
|
mozilla::PresShell* MOZ_NON_OWNING_REF mPresShell;
|
2018-04-05 20:42:40 +03:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
|
2015-06-17 19:32:42 +03:00
|
|
|
mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid;
|
2020-09-22 07:50:54 +03:00
|
|
|
mozilla::layers::ZoomConstraints mZoomConstraints;
|
2015-06-17 19:32:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|