Source code

Revision control

Other Tools

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/. */
6
7
#ifndef GFX_ZOOMCONSTRAINTS_H
8
#define GFX_ZOOMCONSTRAINTS_H
9
10
#include "Units.h" // for CSSRect, CSSPixel, etc
11
#include "mozilla/Maybe.h"
12
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid
13
14
namespace mozilla {
15
namespace layers {
16
17
struct ZoomConstraints {
18
bool mAllowZoom;
19
bool mAllowDoubleTapZoom;
20
CSSToParentLayerScale mMinZoom;
21
CSSToParentLayerScale mMaxZoom;
22
23
ZoomConstraints() : mAllowZoom(true), mAllowDoubleTapZoom(true) {
24
MOZ_COUNT_CTOR(ZoomConstraints);
25
}
26
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);
35
}
36
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);
43
}
44
45
MOZ_COUNTED_DTOR(ZoomConstraints)
46
47
bool operator==(const ZoomConstraints& other) const {
48
return mAllowZoom == other.mAllowZoom &&
49
mAllowDoubleTapZoom == other.mAllowDoubleTapZoom &&
50
mMinZoom == other.mMinZoom && mMaxZoom == other.mMaxZoom;
51
}
52
53
bool operator!=(const ZoomConstraints& other) const {
54
return !(*this == other);
55
}
56
};
57
58
typedef Maybe<ZoomConstraints> MaybeZoomConstraints;
59
60
} // namespace layers
61
} // namespace mozilla
62
63
#endif /* GFX_ZOOMCONSTRAINTS_H */