OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebDeviceEmulationParams_h | 5 #ifndef WebDeviceEmulationParams_h |
6 #define WebDeviceEmulationParams_h | 6 #define WebDeviceEmulationParams_h |
7 | 7 |
8 #include "../platform/WebFloatPoint.h" | 8 #include "../platform/WebFloatPoint.h" |
9 #include "../platform/WebPoint.h" | 9 #include "../platform/WebPoint.h" |
10 #include "../platform/WebRect.h" | 10 #include "../platform/WebRect.h" |
11 #include "../platform/WebSize.h" | 11 #include "../platform/WebSize.h" |
| 12 #include "../platform/modules/screen_orientation/WebScreenOrientationType.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 // All sizes are measured in device independent pixels. | 16 // All sizes are measured in device independent pixels. |
16 struct WebDeviceEmulationParams { | 17 struct WebDeviceEmulationParams { |
17 // For mobile, |screenSize| and |viewPosition| are used. | 18 // For mobile, |screenSize| and |viewPosition| are used. |
18 // For desktop, screen size and view position are preserved. | 19 // For desktop, screen size and view position are preserved. |
19 enum ScreenPosition { | 20 enum ScreenPosition { |
20 Desktop, | 21 Desktop, |
21 Mobile, | 22 Mobile, |
(...skipping 16 matching lines...) Expand all Loading... |
38 | 39 |
39 // Whether emulated view should be scaled down if necessary to fit into avai
lable space. | 40 // Whether emulated view should be scaled down if necessary to fit into avai
lable space. |
40 bool fitToView; | 41 bool fitToView; |
41 | 42 |
42 // Offset of emulated view inside available space, not in fit to view mode. | 43 // Offset of emulated view inside available space, not in fit to view mode. |
43 WebFloatPoint offset; | 44 WebFloatPoint offset; |
44 | 45 |
45 // Scale of emulated view inside available space, not in fit to view mode. | 46 // Scale of emulated view inside available space, not in fit to view mode. |
46 float scale; | 47 float scale; |
47 | 48 |
| 49 // Optional screen orientation type, with WebScreenOrientationUndefined |
| 50 // value meaning no emulation necessary. |
| 51 WebScreenOrientationType screenOrientationType; |
| 52 |
| 53 // Screen orientation angle, used together with screenOrientationType. |
| 54 int screenOrientationAngle; |
| 55 |
48 WebDeviceEmulationParams() | 56 WebDeviceEmulationParams() |
49 : screenPosition(Desktop) | 57 : screenPosition(Desktop) |
50 , deviceScaleFactor(0) | 58 , deviceScaleFactor(0) |
51 , fitToView(false) | 59 , fitToView(false) |
52 , scale(1) { } | 60 , scale(1) |
| 61 , screenOrientationType(WebScreenOrientationUndefined) |
| 62 , screenOrientationAngle(0) { } |
53 }; | 63 }; |
54 | 64 |
55 inline bool operator==(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) | 65 inline bool operator==(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) |
56 { | 66 { |
57 return a.screenPosition == b.screenPosition && a.screenSize == b.screenSize
&& a.viewPosition == b.viewPosition && a.deviceScaleFactor == b.deviceScaleFacto
r && a.viewSize == b.viewSize && a.fitToView == b.fitToView && a.offset == b.off
set && a.scale == b.scale; | 67 return a.screenPosition == b.screenPosition && a.screenSize == b.screenSize
&& a.viewPosition == b.viewPosition && a.deviceScaleFactor == b.deviceScaleFacto
r |
| 68 && a.viewSize == b.viewSize && a.fitToView == b.fitToView && a.offset ==
b.offset && a.scale == b.scale |
| 69 && a.screenOrientationType == b.screenOrientationType && a.screenOrienta
tionAngle == b.screenOrientationAngle; |
58 } | 70 } |
59 | 71 |
60 inline bool operator!=(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) | 72 inline bool operator!=(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) |
61 { | 73 { |
62 return !(a == b); | 74 return !(a == b); |
63 } | 75 } |
64 | 76 |
65 } // namespace blink | 77 } // namespace blink |
66 | 78 |
67 #endif | 79 #endif |
OLD | NEW |