render_frame_metadata.mojom 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module cc.mojom;
  5. import "mojo/public/mojom/base/time.mojom";
  6. import "services/viz/public/mojom/compositing/local_surface_id.mojom";
  7. import "services/viz/public/mojom/compositing/selection.mojom";
  8. import "services/viz/public/mojom/compositing/vertical_scroll_direction.mojom";
  9. import "skia/public/mojom/skcolor4f.mojom";
  10. import "ui/gfx/geometry/mojom/geometry.mojom";
  11. // Contains information to assist in making a decision about forwarding
  12. // pointerevents to viz for use in a delegated ink trail.
  13. struct DelegatedInkBrowserMetadata {
  14. // Flag used to indicate the state of the hovering on the pointerevent that
  15. // the delegated ink metadata was created from. If this state does not match
  16. // the point under consideration to send to viz, it won't be sent. As soon
  17. // as it matches again the point will be sent, regardless of if the renderer
  18. // has processed the point that didn't match yet or not. It is true when
  19. // hovering, false otherwise.
  20. bool delegated_ink_is_hovering;
  21. };
  22. // See components/viz/service/quads/render_frame_metadata.h
  23. struct RenderFrameMetadata {
  24. // The background color of a CompositorFrame. It can be used for filling the
  25. // content area if the primary surface is unavailable and fallback is not
  26. // specified.
  27. skia.mojom.SkColor4f root_background_color;
  28. // Scroll offset of the root layer. This optional parameter is only sent
  29. // during tests.
  30. gfx.mojom.PointF? root_scroll_offset;
  31. // Indicates whether the scroll offset of the root layer is at top, i.e.,
  32. // whether scroll_offset.y() == 0.
  33. bool is_scroll_offset_at_top;
  34. // Selection region relative to the current viewport. If the selection is
  35. // empty or otherwise unused, the bound types will indicate such.
  36. viz.mojom.Selection selection;
  37. // Determines whether the page is mobile optimized or not, which means at
  38. // least one of the following has to be true:
  39. // - page has a width=device-width or narrower viewport.
  40. // - page prevents zooming in or out (i.e. min and max page scale factors
  41. // are the same).
  42. bool is_mobile_optimized;
  43. // Existence of this flag informs the browser process to start forwarding
  44. // points to viz for use in a delegated ink trail. It contains more
  45. // information to be used in making the forwarding decision. It exists the
  46. // entire time points could be forwarded, and forwarding must stop as soon as
  47. // it is null.
  48. DelegatedInkBrowserMetadata? delegated_ink_metadata;
  49. // The device scale factor used to generate CompositorFrame.
  50. float device_scale_factor;
  51. // The size of the viewport used to generate a CompositorFrame.
  52. gfx.mojom.Size viewport_size_in_pixels;
  53. // The last viz::LocalSurfaceId used to submit a CompositorFrame.
  54. viz.mojom.LocalSurfaceId? local_surface_id;
  55. // The page scale factor used on the content.
  56. float page_scale_factor;
  57. // The subframe page scale factor used on the content. This value will match
  58. // |page_scale_factor|, which is only ever set for the main frame, and it is
  59. // only used for setting raster scale in child renderers.
  60. float external_page_scale_factor;
  61. // Used to position the Android location top bar and page content, whose
  62. // precise position is computed by the renderer compositor.
  63. float top_controls_height;
  64. float top_controls_shown_ratio;
  65. viz.mojom.VerticalScrollDirection new_vertical_scroll_direction;
  66. // The cumulative time spent performing visual updates since the last commit.
  67. // Tracked for all `local_surface_id` before this one.
  68. mojo_base.mojom.TimeDelta previous_surfaces_visual_update_duration;
  69. // The cumulative time spend performing visual updates for the current
  70. // `local_surface_id` since the last commit.
  71. mojo_base.mojom.TimeDelta current_surface_visual_update_duration;
  72. // Used to position Android bottom bar, whose position is computed by the
  73. // renderer compositor.
  74. [EnableIf=is_android]
  75. float bottom_controls_height;
  76. [EnableIf=is_android]
  77. float bottom_controls_shown_ratio;
  78. [EnableIf=is_android]
  79. float top_controls_min_height_offset;
  80. [EnableIf=is_android]
  81. float bottom_controls_min_height_offset;
  82. [EnableIf=is_android]
  83. float min_page_scale_factor;
  84. [EnableIf=is_android]
  85. float max_page_scale_factor;
  86. [EnableIf=is_android]
  87. bool root_overflow_y_hidden;
  88. [EnableIf=is_android]
  89. gfx.mojom.SizeF scrollable_viewport_size;
  90. [EnableIf=is_android]
  91. gfx.mojom.SizeF root_layer_size;
  92. [EnableIf=is_android]
  93. bool has_transparent_background;
  94. };
  95. // This interface is provided by the renderer. It impacts the frequency with
  96. // which a fully populated RenderFrameMetadata object (above) is delivered to
  97. // the RenderFrameMetadataObserverClient.
  98. interface RenderFrameMetadataObserver {
  99. // When |enabled| is set to true this notifies the client of any change to the
  100. // root scroll offset. The client is notified in two ways:
  101. // . OnRenderFrameMetadataChanged(), is sent if the client would normally be
  102. // notified of the frame (for example, the viewport changed).
  103. // . OnRootScrollOffsetChanged() if the client is not notified of the frame
  104. // change, but the root scroll offset has changed. In other words, if this
  105. // is sent, *only* the root-scroll-offset has changed and the client is not
  106. // sent a OnRenderFrameMetadataChanged() for the frame.
  107. // Used on Android for acessibility and GestureListenerManager.
  108. [EnableIf=is_android]
  109. ReportAllRootScrolls(bool enabled);
  110. // When |enabled| is set to true, this will send RenderFrameMetadata to
  111. // the RenderFrameMetadataObserverClient for all frames. Only used for
  112. // tests.
  113. ReportAllFrameSubmissionsForTesting(bool enabled);
  114. };
  115. // This interface is provided by the browser. It is notified of changes to
  116. // RenderFrameMetadata. It can be notified of all frame submissions, via
  117. // RenderFrameMetadataObserver::ReportAllFrameSubmissionsForTesting, or of
  118. // additional frames with root scroll offset changes via
  119. // RenderFrameMetadataObserver::ReportAllRootScrolls.
  120. interface RenderFrameMetadataObserverClient {
  121. // Notified when RenderFrameMetadata has changed.
  122. OnRenderFrameMetadataChanged(uint32 frame_token,
  123. RenderFrameMetadata metadata);
  124. // Notified on all frame submissions.
  125. OnFrameSubmissionForTesting(uint32 frame_token);
  126. // Only called if ReportAllRootScrolls(true) has been called. See
  127. // ReportAllRootScrolls() for details.
  128. [EnableIf=is_android]
  129. OnRootScrollOffsetChanged(gfx.mojom.PointF root_scroll_offset);
  130. };