// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module viz.mojom;
import "mojo/public/mojom/base/time.mojom";
import "services/viz/public/mojom/compositing/begin_frame_args.mojom";
import "services/viz/public/mojom/compositing/compositor_frame_transition_directive.mojom";
import "ui/gfx/mojom/delegated_ink_metadata.mojom";
import "services/viz/public/mojom/compositing/offset_tag.mojom";
import "services/viz/public/mojom/compositing/frame_deadline.mojom";
import "services/viz/public/mojom/compositing/frame_interval_inputs.mojom";
import "services/viz/public/mojom/compositing/region_capture_bounds.mojom";
import "services/viz/public/mojom/compositing/selection.mojom";
import "services/viz/public/mojom/compositing/surface_id.mojom";
import "services/viz/public/mojom/compositing/surface_range.mojom";
import "skia/public/mojom/skcolor4f.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/display_color_spaces.mojom";
import "ui/gfx/mojom/overlay_transform.mojom";
import "ui/latency/mojom/latency_info.mojom";
// See cc/trees/render_frame_metadata.h
// This is sent from viz clients such as the browser and renderer to the viz
// compositor in the GPU process.
struct CompositorFrameMetadata {
float device_scale_factor;
gfx.mojom.PointF root_scroll_offset;
float page_scale_factor;
gfx.mojom.SizeF scrollable_viewport_size;
gfx.mojom.ContentColorUsage content_color_usage;
bool may_contain_video;
bool may_throttle_if_undrawn_frames;
bool is_handling_interaction;
skia.mojom.SkColor4f root_background_color;
array<ui.mojom.LatencyInfo> latency_info;
array<SurfaceRange> referenced_surfaces;
FrameDeadline deadline;
array<SurfaceId> activation_dependencies;
BeginFrameAck begin_frame_ack;
uint32 frame_token;
bool send_frame_token_to_embedder;
// TODO(crbug.com/40489779): This should be a `float?`.
bool top_controls_visible_height_set;
float top_controls_visible_height;
float min_page_scale_factor;
gfx.mojom.OverlayTransform display_transform_hint;
// Contains the metadata required for drawing a delegated ink trail onto the
// end of a rendered ink stroke. This should only be present when two
// conditions are met:
// 1. The JS API |updateInkTrailStartPoint| is used - This gathers the
// metadata and puts it onto a compositor frame to be sent to viz.
// 2. This frame will not be submitted to the root surface - The browser UI
// does not use this, and the frame must be contained within a
// SurfaceDrawQuad.
// The ink trail created with this metadata will only last for a single frame
// before it disappears, regardless of whether or not the next frame contains
// delegated ink metadata.
gfx.mojom.DelegatedInkMetadata? delegated_ink_metadata;
// Transition directives represent a list of directives for animating a
// transition between different compositor frames / render passes.
array<CompositorFrameTransitionDirective> transition_directives;
// Contains a map of region capture crop identifiers to gfx::Rects
// representing their coordinates in the root render pass system.
RegionCaptureBounds capture_bounds;
// Indicates if this frame is embedding ViewTransitionElementResourceIds which need to
// be replaced by corresponding live render passes or cached textures in the
// Viz process.
bool has_shared_element_resources;
// When set, the compositor frame submission also informs viz to issue a
// screenshot against the previous surface.
blink.mojom.SameDocNavigationScreenshotDestinationToken?
screenshot_destination;
// When set, this frame contains software resources. See
// TransferableResource::is_software for details.
bool is_software;
array<OffsetTagDefinition> offset_tag_definitions;
array<OffsetTagValue> offset_tag_values;
FrameIntervalInputs frame_interval_inputs;
};