Home | History | Annotate | Download | only in web
      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.
      4 
      5 #ifndef WebDeviceEmulationParams_h
      6 #define WebDeviceEmulationParams_h
      7 
      8 #include "public/platform/WebFloatPoint.h"
      9 #include "public/platform/WebRect.h"
     10 #include "public/platform/WebSize.h"
     11 
     12 namespace blink {
     13 
     14 // All sizes are measured in device independent pixels.
     15 struct WebDeviceEmulationParams {
     16     // For mobile, screen has the same size as view, which is positioned at (0;0).
     17     // For desktop, screen size and view position are preserved.
     18     enum ScreenPosition {
     19         Desktop,
     20         Mobile
     21     };
     22 
     23     ScreenPosition screenPosition;
     24 
     25     // If zero, the original device scale factor is preserved.
     26     float deviceScaleFactor;
     27 
     28     // Emulated view size. Empty size means no override.
     29     WebSize viewSize;
     30 
     31     // Whether emulated view should be scaled down if necessary to fit into available space.
     32     bool fitToView;
     33 
     34     // Insets of emulated view inside available view space, in fit to view mode.
     35     WebSize viewInsets;
     36 
     37     // Offset of emulated view inside available space, not in fit to view mode.
     38     WebFloatPoint offset;
     39 
     40     // Scale of emulated view inside available space, not in fit to view mode.
     41     float scale;
     42 
     43     WebDeviceEmulationParams()
     44         : screenPosition(Desktop)
     45         , deviceScaleFactor(0)
     46         , fitToView(false)
     47         , scale(1) { }
     48 };
     49 
     50 } // namespace blink
     51 
     52 #endif
     53