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"
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.
22 ScreenPositionLast
= Mobile
25 ScreenPosition screenPosition
;
27 // Emulated screen size. Used with |screenPosition == Mobile|.
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.
39 // Whether emulated view should be scaled down if necessary to fit into available space.
42 // Offset 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.
48 WebDeviceEmulationParams()
49 : screenPosition(Desktop
)
50 , deviceScaleFactor(0)
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
)