| 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" | |
| 13 | 12 |
| 14 namespace blink { | 13 namespace blink { |
| 15 | 14 |
| 16 // All sizes are measured in device independent pixels. | 15 // All sizes are measured in device independent pixels. |
| 17 struct WebDeviceEmulationParams { | 16 struct WebDeviceEmulationParams { |
| 18 // For mobile, |screenSize| and |viewPosition| are used. | 17 // For mobile, |screenSize| and |viewPosition| are used. |
| 19 // For desktop, screen size and view position are preserved. | 18 // For desktop, screen size and view position are preserved. |
| 20 enum ScreenPosition { | 19 enum ScreenPosition { |
| 21 Desktop, | 20 Desktop, |
| 22 Mobile, | 21 Mobile, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 | 38 |
| 40 // Whether emulated view should be scaled down if necessary to fit into avai
lable space. | 39 // Whether emulated view should be scaled down if necessary to fit into avai
lable space. |
| 41 bool fitToView; | 40 bool fitToView; |
| 42 | 41 |
| 43 // Offset of emulated view inside available space, not in fit to view mode. | 42 // Offset of emulated view inside available space, not in fit to view mode. |
| 44 WebFloatPoint offset; | 43 WebFloatPoint offset; |
| 45 | 44 |
| 46 // Scale of emulated view inside available space, not in fit to view mode. | 45 // Scale of emulated view inside available space, not in fit to view mode. |
| 47 float scale; | 46 float scale; |
| 48 | 47 |
| 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 | |
| 56 WebDeviceEmulationParams() | 48 WebDeviceEmulationParams() |
| 57 : screenPosition(Desktop) | 49 : screenPosition(Desktop) |
| 58 , deviceScaleFactor(0) | 50 , deviceScaleFactor(0) |
| 59 , fitToView(false) | 51 , fitToView(false) |
| 60 , scale(1) | 52 , scale(1) { } |
| 61 , screenOrientationType(WebScreenOrientationUndefined) | |
| 62 , screenOrientationAngle(0) { } | |
| 63 }; | 53 }; |
| 64 | 54 |
| 65 inline bool operator==(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) | 55 inline bool operator==(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) |
| 66 { | 56 { |
| 67 return a.screenPosition == b.screenPosition && a.screenSize == b.screenSize
&& a.viewPosition == b.viewPosition && a.deviceScaleFactor == b.deviceScaleFacto
r | 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; |
| 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; | |
| 70 } | 58 } |
| 71 | 59 |
| 72 inline bool operator!=(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) | 60 inline bool operator!=(const WebDeviceEmulationParams& a, const WebDeviceEmulati
onParams& b) |
| 73 { | 61 { |
| 74 return !(a == b); | 62 return !(a == b); |
| 75 } | 63 } |
| 76 | 64 |
| 77 } // namespace blink | 65 } // namespace blink |
| 78 | 66 |
| 79 #endif | 67 #endif |
| OLD | NEW |