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
12 #include "Units.h" // for CSSRect, CSSPixel, etc
13 #include "mozilla/Maybe.h"
14 #include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid
19 struct ZoomConstraints
{
21 bool mAllowDoubleTapZoom
;
22 CSSToParentLayerScale mMinZoom
;
23 CSSToParentLayerScale mMaxZoom
;
25 ZoomConstraints() : mAllowZoom(true), mAllowDoubleTapZoom(true) {
26 MOZ_COUNT_CTOR(ZoomConstraints
);
29 ZoomConstraints(bool aAllowZoom
, bool aAllowDoubleTapZoom
,
30 const CSSToParentLayerScale
& aMinZoom
,
31 const CSSToParentLayerScale
& aMaxZoom
)
32 : mAllowZoom(aAllowZoom
),
33 mAllowDoubleTapZoom(aAllowDoubleTapZoom
),
36 MOZ_COUNT_CTOR(ZoomConstraints
);
39 ZoomConstraints(const ZoomConstraints
& other
)
40 : mAllowZoom(other
.mAllowZoom
),
41 mAllowDoubleTapZoom(other
.mAllowDoubleTapZoom
),
42 mMinZoom(other
.mMinZoom
),
43 mMaxZoom(other
.mMaxZoom
) {
44 MOZ_COUNT_CTOR(ZoomConstraints
);
47 MOZ_COUNTED_DTOR(ZoomConstraints
)
49 bool operator==(const ZoomConstraints
& other
) const {
50 return mAllowZoom
== other
.mAllowZoom
&&
51 mAllowDoubleTapZoom
== other
.mAllowDoubleTapZoom
&&
52 mMinZoom
== other
.mMinZoom
&& mMaxZoom
== other
.mMaxZoom
;
55 bool operator!=(const ZoomConstraints
& other
) const {
56 return !(*this == other
);
59 friend std::ostream
& operator<<(std::ostream
& aStream
,
60 const ZoomConstraints
& z
);
64 } // namespace mozilla
66 #endif /* GFX_ZOOMCONSTRAINTS_H */