Bug 1568876 - Make copyRule in the ChangesView fission compatible. r=rcaliman
[gecko.git] / gfx / layers / ZoomConstraints.h
blobff96086c78c15c198e8312ff99eaa5fd16d291ab
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 GFX_ZOOMCONSTRAINTS_H
8 #define GFX_ZOOMCONSTRAINTS_H
10 #include "Units.h" // for CSSRect, CSSPixel, etc
11 #include "mozilla/Maybe.h"
12 #include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid
14 namespace mozilla {
15 namespace layers {
17 struct ZoomConstraints {
18 bool mAllowZoom;
19 bool mAllowDoubleTapZoom;
20 CSSToParentLayerScale mMinZoom;
21 CSSToParentLayerScale mMaxZoom;
23 ZoomConstraints() : mAllowZoom(true), mAllowDoubleTapZoom(true) {
24 MOZ_COUNT_CTOR(ZoomConstraints);
27 ZoomConstraints(bool aAllowZoom, bool aAllowDoubleTapZoom,
28 const CSSToParentLayerScale& aMinZoom,
29 const CSSToParentLayerScale& aMaxZoom)
30 : mAllowZoom(aAllowZoom),
31 mAllowDoubleTapZoom(aAllowDoubleTapZoom),
32 mMinZoom(aMinZoom),
33 mMaxZoom(aMaxZoom) {
34 MOZ_COUNT_CTOR(ZoomConstraints);
37 ZoomConstraints(const ZoomConstraints& other)
38 : mAllowZoom(other.mAllowZoom),
39 mAllowDoubleTapZoom(other.mAllowDoubleTapZoom),
40 mMinZoom(other.mMinZoom),
41 mMaxZoom(other.mMaxZoom) {
42 MOZ_COUNT_CTOR(ZoomConstraints);
45 ~ZoomConstraints() { MOZ_COUNT_DTOR(ZoomConstraints); }
47 bool operator==(const ZoomConstraints& other) const {
48 return mAllowZoom == other.mAllowZoom &&
49 mAllowDoubleTapZoom == other.mAllowDoubleTapZoom &&
50 mMinZoom == other.mMinZoom && mMaxZoom == other.mMaxZoom;
53 bool operator!=(const ZoomConstraints& other) const {
54 return !(*this == other);
58 typedef Maybe<ZoomConstraints> MaybeZoomConstraints;
60 } // namespace layers
61 } // namespace mozilla
63 #endif /* GFX_ZOOMCONSTRAINTS_H */