OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * | |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef WebDeviceOrientation_h | |
27 #define WebDeviceOrientation_h | |
28 | |
29 #if WEBKIT_IMPLEMENTATION | |
30 namespace WTF { template <typename T> class PassRefPtr; } | |
31 namespace WebCore { class DeviceOrientationData; } | |
32 #endif | |
33 | |
34 namespace WebKit { | |
35 | |
36 class WebDeviceOrientation { | |
37 public: | |
38 WebDeviceOrientation() | |
39 : m_isNull(true) | |
40 , m_canProvideAlpha(false) | |
41 , m_alpha(0) | |
42 , m_canProvideBeta(false) | |
43 , m_beta(0) | |
44 , m_canProvideGamma(false) | |
45 , m_gamma(0) | |
46 , m_canProvideAbsolute(false) | |
47 , m_absolute(false) | |
48 { | |
49 } | |
50 | |
51 static WebDeviceOrientation nullOrientation() { return WebDeviceOrientation(
); } | |
52 | |
53 void setNull(bool isNull) { m_isNull = isNull; } | |
54 bool isNull() const { return m_isNull; } | |
55 | |
56 void setAlpha(double alpha) | |
57 { | |
58 m_canProvideAlpha = true; | |
59 m_alpha = alpha; | |
60 } | |
61 bool canProvideAlpha() const { return m_canProvideAlpha; } | |
62 double alpha() const { return m_alpha; } | |
63 | |
64 void setBeta(double beta) | |
65 { | |
66 m_canProvideBeta = true; | |
67 m_beta = beta; | |
68 } | |
69 bool canProvideBeta() const { return m_canProvideBeta; } | |
70 double beta() const { return m_beta; } | |
71 | |
72 void setGamma(double gamma) | |
73 { | |
74 m_canProvideGamma = true; | |
75 m_gamma = gamma; | |
76 } | |
77 bool canProvideGamma() const { return m_canProvideGamma; } | |
78 double gamma() const { return m_gamma; } | |
79 | |
80 void setAbsolute(bool absolute) | |
81 { | |
82 m_canProvideAbsolute = true; | |
83 m_absolute = absolute; | |
84 } | |
85 bool canProvideAbsolute() const {return m_canProvideAbsolute; } | |
86 bool absolute() const { return m_absolute; } | |
87 | |
88 #if WEBKIT_IMPLEMENTATION | |
89 WebDeviceOrientation(const WebCore::DeviceOrientationData*); | |
90 operator WTF::PassRefPtr<WebCore::DeviceOrientationData>() const; | |
91 #endif | |
92 | |
93 private: | |
94 bool m_isNull; | |
95 bool m_canProvideAlpha; | |
96 double m_alpha; | |
97 bool m_canProvideBeta; | |
98 double m_beta; | |
99 bool m_canProvideGamma; | |
100 double m_gamma; | |
101 bool m_canProvideAbsolute; | |
102 bool m_absolute; | |
103 }; | |
104 | |
105 } // namespace WebKit | |
106 | |
107 #endif // WebDeviceOrientation_h | |
OLD | NEW |