layout/base/ZoomConstraintsClient.h
author Mike Hommey <mh+mozilla@glandium.org>
Wed, 16 Jan 2019 21:44:54 +0000
changeset 514172 e0fd6ca971ae522dd9398d49f564fe3f7263112b
parent 512431 f0a91d36587266d7454a450c6044d573664fbed5
child 531516 35aed2f899c30a440c551d51d791c0986db8ac7f
permissions -rw-r--r--
Bug 1520377 - Replace/Inline subconfigure.{prefix_lines,execute_and_prefix}. r=nalexander Use an I/O wrapper on the configure output handler to add the "js/src>" prefix. Depends on D16643 Differential Revision: https://phabricator.services.mozilla.com/D16644

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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_

#include "mozilla/layers/ScrollableLayerGuid.h"
#include "mozilla/Maybe.h"
#include "nsCOMPtr.h"
#include "nsIDOMEventListener.h"
#include "nsIObserver.h"

class nsIPresShell;

namespace mozilla {
namespace dom {
class EventTarget;
}  // namespace dom
}  // namespace mozilla

class ZoomConstraintsClient final : public nsIDOMEventListener,
                                    public nsIObserver {
 public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMEVENTLISTENER
  NS_DECL_NSIOBSERVER

  ZoomConstraintsClient();

 private:
  ~ZoomConstraintsClient();

 public:
  void Init(nsIPresShell* aPresShell, mozilla::dom::Document* aDocument);
  void Destroy();
  void ScreenSizeChanged();

 private:
  void RefreshZoomConstraints();

  RefPtr<mozilla::dom::Document> mDocument;
  // raw ref since the presShell owns this
  nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
  nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
  mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid;
};

#endif