blob: f1302d7d6265d2add3059c51a61d4e6f65bce866 [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 content.mojom;
import "mojo/public/mojom/base/time.mojom";
import "services/viz/public/interfaces/compositing/local_surface_id_allocation.mojom";
import "services/viz/public/interfaces/compositing/selection.mojom";
import "ui/gfx/geometry/mojo/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;
// 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::LocalSurfaceIdAllocation used to submit a CompositorFrame.
viz.mojom.LocalSurfaceIdAllocation? local_surface_id_allocation;
// 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;
// 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 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 can optionally enable
// notifications for all frame submissions.
interface RenderFrameMetadataObserver {
// When |enabled| is set to true, this will notify the associated client of
// all frame submissions.
ReportAllFrameSubmissionsForTesting(bool enabled);
};
// This interface is provided by the browser. It is notified of all changes to
// RenderFrameMetadata. It can be notified of all frame submissions, via
// RenderFrameMetadataObserver::ReportAllFrameSubmissionsForTesting.
interface RenderFrameMetadataObserverClient {
// Notified when RenderFrameMetadata has changed.
OnRenderFrameMetadataChanged(uint32 frame_token, RenderFrameMetadata metadata);
// Notified on all frame submissions.
OnFrameSubmissionForTesting(uint32 frame_token);
};