blob: 2db01c54bb6bd0d5d4082c629948362234a014ef [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module cc.mojom;
import "mojo/public/mojom/base/time.mojom";
import "services/viz/public/mojom/compositing/local_surface_id.mojom";
import "services/viz/public/mojom/compositing/selection.mojom";
import "services/viz/public/mojom/compositing/vertical_scroll_direction.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
// See components/viz/service/quads/render_frame_metadata.h
struct RenderFrameMetadata {
// The background color of a CompositorFrame. It can be used for filling the
// content area if the primary surface is unavailable and fallback is not
// specified.
uint32 root_background_color;
// Scroll offset of the root layer. This optional parameter is only sent
// during tests.
gfx.mojom.Vector2dF? root_scroll_offset;
// Indicates whether the scroll offset of the root layer is at top, i.e.,
// whether scroll_offset.y() == 0.
bool is_scroll_offset_at_top;
// Selection region relative to the current viewport. If the selection is
// empty or otherwise unused, the bound types will indicate such.
viz.mojom.Selection selection;
// Determines whether the page is mobile optimized or not, which means at
// least one of the following has to be true:
// - page has a width=device-width or narrower viewport.
// - page prevents zooming in or out (i.e. min and max page scale factors
// are the same).
bool is_mobile_optimized;
// Flag used to notify the browser process to start or stop forwarding points
// to viz for use in a delegated ink trail. True the entire time points should
// be forwarded, and forwarding stops as soon as it is false again.
bool has_delegated_ink_metadata;
// The device scale factor used to generate CompositorFrame.
float device_scale_factor;
// The size of the viewport used to generate a CompositorFrame.
gfx.mojom.Size viewport_size_in_pixels;
// The last viz::LocalSurfaceId used to submit a CompositorFrame.
viz.mojom.LocalSurfaceId? local_surface_id;
// The page scale factor used on the content.
float page_scale_factor;
// The subframe page scale factor used on the content. This value will match
// |page_scale_factor|, which is only ever set for the main frame, and it is
// only used for setting raster scale in child renderers.
float external_page_scale_factor;
// Used to position the Android location top bar and page content, whose
// precise position is computed by the renderer compositor.
float top_controls_height;
float top_controls_shown_ratio;
viz.mojom.VerticalScrollDirection new_vertical_scroll_direction;
// Used to position Android bottom bar, whose position is computed by the
// renderer compositor.
[EnableIf=is_android]
float bottom_controls_height;
[EnableIf=is_android]
float bottom_controls_shown_ratio;
[EnableIf=is_android]
float top_controls_min_height_offset;
[EnableIf=is_android]
float bottom_controls_min_height_offset;
[EnableIf=is_android]
float min_page_scale_factor;
[EnableIf=is_android]
float max_page_scale_factor;
[EnableIf=is_android]
bool root_overflow_y_hidden;
[EnableIf=is_android]
gfx.mojom.SizeF scrollable_viewport_size;
[EnableIf=is_android]
gfx.mojom.SizeF root_layer_size;
[EnableIf=is_android]
bool has_transparent_background;
};
// This interface is provided by the renderer. It impacts the frequency with
// which a fully populated RenderFrameMetadata object (above) is delivered to
// the RenderFrameMetadataObserverClient.
interface RenderFrameMetadataObserver {
// When |enabled| is set to true this notifies the client of any change to the
// root scroll offset. The client is notified in two ways:
// . OnRenderFrameMetadataChanged(), is sent if the client would normally be
// notified of the frame (for example, the viewport changed).
// . OnRootScrollOffsetChanged() if the client is not notified of the frame
// change, but the root scroll offset has changed. In other words, if this
// is sent, *only* the root-scroll-offset has changed and the client is not
// sent a OnRenderFrameMetadataChanged() for the frame.
// Used on Android for acessibility and GestureListenerManager.
[EnableIf=is_android]
ReportAllRootScrolls(bool enabled);
// When |enabled| is set to true, this will send RenderFrameMetadata to
// the RenderFrameMetadataObserverClient for all frames. Only used for
// tests.
ReportAllFrameSubmissionsForTesting(bool enabled);
};
// This interface is provided by the browser. It is notified of changes to
// RenderFrameMetadata. It can be notified of all frame submissions, via
// RenderFrameMetadataObserver::ReportAllFrameSubmissionsForTesting, or of
// additional frames with root scroll offset changes via
// RenderFrameMetadataObserver::ReportAllRootScrolls.
interface RenderFrameMetadataObserverClient {
// Notified when RenderFrameMetadata has changed.
OnRenderFrameMetadataChanged(uint32 frame_token,
RenderFrameMetadata metadata);
// Notified on all frame submissions.
OnFrameSubmissionForTesting(uint32 frame_token);
// Only called if ReportAllRootScrolls(true) has been called. See
// ReportAllRootScrolls() for details.
[EnableIf=is_android]
OnRootScrollOffsetChanged(gfx.mojom.Vector2dF root_scroll_offset);
};