chromium/third_party/blink/public/mojom/widget/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 "third_party/blink/public/mojom/manifest/display_mode.mojom";
import "ui/display/mojom/screen_infos.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/base/mojom/ui_base_types.mojom";

// See public/common/widget/visual_properties.h
struct VisualProperties {
  // Info about all screens, including the one currently showing the widget.
  display.mojom.ScreenInfos screen_infos;

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

  // Whether or not the widget can be resized.
  bool resizable = true;

  // 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 size for the widget in DIPs.
  gfx.mojom.Size new_size;

  // 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 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_pixel_rect;

  // Browser controls params such as top and bottom controls heights, whether
  // controls shrink blink size etc.
  cc.mojom.BrowserControlsParams browser_controls_params;

  // Whether or not the focused node should be scrolled into view after the
  // resize.
  // Page scoped value.
  bool scroll_focused_node_into_view;

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

  // Indicates whether tab-initiated fullscreen was granted.
  // Page scoped value.
  bool is_fullscreen_granted;

  // The display mode. This will be replicated amongst subframes.
  DisplayMode display_mode = DisplayMode.kUndefined;

  // The window show state.
  ui.mojom.WindowShowState window_show_state
      = ui.mojom.WindowShowState.SHOW_STATE_DEFAULT;

  // 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 is composed from browser zoom (i.e. the page zoom level for a
  // WebContents) and, for a non-main-frame widget, the effect of the CSS "zoom"
  // property applied to the embedding element (e.g. <iframe>) in the embedding
  // document. 0 is the default value which results in 1.0 zoom factor.
  // See WebFrameWidgetImpl::SetZoomLevel() for how this value is used.

  // This is the zoom setting from the browser UI.
  double zoom_level;

  // For an embedded widget this is the cumulative effect of the CSS "zoom"
  // property on the embedding element (e.g. <iframe>) and its ancestors. For a
  // top-level widget this is 1.0.
  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 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;

  // 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;

  // The rect of the Windows Control Overlay, which contains system UX
  // affordances (e.g. close), for installed desktop Progress Web Apps (PWAs),
  // if the app specifies the 'window-controls-overlay' DisplayMode in its
  // manifest. This is only valid and to be consumed by the outermost main
  // frame.
  gfx.mojom.Rect window_controls_overlay_rect;

  // If shown and resizing the renderer, returns the height of the virtual
  // keyboard in physical pixels. Otherwise, returns 0. Always 0 in a
  // non-outermost main frame.
  uint32 virtual_keyboard_resize_height_physical_px;
};