Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / web / WebDeviceEmulationParams.h
blobc1e8f4ca842e2a4edacfe7949092d9ca2acdaf37
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
3 // found in the LICENSE file.
5 #ifndef WebDeviceEmulationParams_h
6 #define WebDeviceEmulationParams_h
8 #include "../platform/WebFloatPoint.h"
9 #include "../platform/WebPoint.h"
10 #include "../platform/WebRect.h"
11 #include "../platform/WebSize.h"
13 namespace blink {
15 // All sizes are measured in device independent pixels.
16 struct WebDeviceEmulationParams {
17 // For mobile, |screenSize| and |viewPosition| are used.
18 // For desktop, screen size and view position are preserved.
19 enum ScreenPosition {
20 Desktop,
21 Mobile,
22 ScreenPositionLast = Mobile
25 ScreenPosition screenPosition;
27 // Emulated screen size. Used with |screenPosition == Mobile|.
28 WebSize screenSize;
30 // Position of view on the screen. Used with |screenPosition == Mobile|.
31 WebPoint viewPosition;
33 // If zero, the original device scale factor is preserved.
34 float deviceScaleFactor;
36 // Emulated view size. Empty size means no override.
37 WebSize viewSize;
39 // Whether emulated view should be scaled down if necessary to fit into available space.
40 bool fitToView;
42 // Offset of emulated view inside available space, not in fit to view mode.
43 WebFloatPoint offset;
45 // Scale of emulated view inside available space, not in fit to view mode.
46 float scale;
48 WebDeviceEmulationParams()
49 : screenPosition(Desktop)
50 , deviceScaleFactor(0)
51 , fitToView(false)
52 , scale(1) { }
55 inline bool operator==(const WebDeviceEmulationParams& a, const WebDeviceEmulationParams& b)
57 return a.screenPosition == b.screenPosition && a.screenSize == b.screenSize && a.viewPosition == b.viewPosition && a.deviceScaleFactor == b.deviceScaleFactor && a.viewSize == b.viewSize && a.fitToView == b.fitToView && a.offset == b.offset && a.scale == b.scale;
60 inline bool operator!=(const WebDeviceEmulationParams& a, const WebDeviceEmulationParams& b)
62 return !(a == b);
65 } // namespace blink
67 #endif