summaryrefslogtreecommitdiffstats
path: root/chromium/content/common/render_frame_metadata.mojom
blob: fb309ac48a52d1946539faef62a58c594fcca8cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// 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);
};