chromium/third_party/blink/public/mojom/frame/frame_visual_properties.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;

import "cc/mojom/browser_controls_params.mojom";
import "services/viz/public/mojom/compositing/local_surface_id.mojom";
import "ui/display/mojom/screen_infos.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// See public/common/frame/frame_visual_properties.h
struct FrameVisualProperties {
  // Information about the screens (dpi, depth, etc..).
  display.mojom.ScreenInfos screen_infos;

  // Whether or not blink should be in auto-resize mode.
  bool auto_resize_enabled;

  // Indicates whether a pinch gesture is currently active. Originates in the
  // main frame's renderer, and needs to be shared with subframes.
  bool is_pinch_gesture_active;

  // This represents the latest capture sequence number requested. When this is
  // incremented, that means the caller wants to synchronize surfaces which
  // should cause a new LocalSurfaceId to be generated.
  uint32 capture_sequence_number;

  // This represents the page zoom level for a WebContents.
  // (0 is the default value which results in 1.0 zoom factor).
  // Page scoped value.
  double zoom_level;

  // This represents the cumulative effect of the CSS "zoom" property on this
  // frame's embedding element and its ancestors.
  double css_zoom_factor;

  // This represents the page's scale factor, which changes during pinch zoom.
  // It needs to be shared with subframes.
  float page_scale_factor = 1;

  // This represents the child frame's raster scale factor which takes into
  // account the transform from child frame space to main frame space.
  float compositing_scale_factor = 1;

  // The OS cursor accessibility scale factor.
  float cursor_accessibility_scale_factor = 1;

  // The size of the area of the widget that is visible to the user, in DIPs.
  // The visible area may be empty if the visible area does not intersect with
  // the widget, for example in the case of a child frame that is entirely
  // scrolled out of the main frame's viewport. It may also be smaller than the
  // widget's size in |new_size| due to the UI hiding part of the widget, such
  // as with an on-screen keyboard.
  gfx.mojom.Size visible_viewport_size;

  // The minimum size for Blink if auto-resize is enabled.
  gfx.mojom.Size min_size_for_auto_resize;

  // The maximum size for Blink if auto-resize is enabled.
  gfx.mojom.Size max_size_for_auto_resize;

  // The logical segments of the root widget, in widget-relative DIPs. This
  // property is set by the root RenderWidget in the renderer process, then
  // propagated to child local frame roots via RenderFrameProxy/
  // CrossProcessFrameConnector.
  array<gfx.mojom.Rect> root_widget_viewport_segments;

  // The rect of compositor's viewport in pixels. Note that for top level
  // widgets this is roughly the DSF scaled new_size put into a rect. For child
  // frame widgets it is a pixel-perfect bounds of the visible region of the
  // widget. The size would be similar to visible_viewport_size, but in physical
  // pixels and computed via very different means.
  // TODO(danakj): It would be super nice to remove one of |new_size|,
  // |visible_viewport_size| and |compositor_viewport_pixel_rect|. Their values
  // overlap in purpose, creating a very confusing situation about which to use
  // for what, and how they should relate or not.
  gfx.mojom.Rect compositor_viewport;

  // The frame's rect relative to the nearest ancestor local root frame.
  gfx.mojom.Rect rect_in_local_root;

  gfx.mojom.Size local_frame_size;

  // The local surface ID to use (if valid) and its allocation time.
  viz.mojom.LocalSurfaceId local_surface_id;
};