123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- // 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 "skia/public/mojom/skcolor4f.mojom";
- import "ui/gfx/geometry/mojom/geometry.mojom";
- // Contains information to assist in making a decision about forwarding
- // pointerevents to viz for use in a delegated ink trail.
- struct DelegatedInkBrowserMetadata {
- // Flag used to indicate the state of the hovering on the pointerevent that
- // the delegated ink metadata was created from. If this state does not match
- // the point under consideration to send to viz, it won't be sent. As soon
- // as it matches again the point will be sent, regardless of if the renderer
- // has processed the point that didn't match yet or not. It is true when
- // hovering, false otherwise.
- bool delegated_ink_is_hovering;
- };
- // 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.
- skia.mojom.SkColor4f root_background_color;
- // Scroll offset of the root layer. This optional parameter is only sent
- // during tests.
- gfx.mojom.PointF? 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;
- // Existence of this flag informs the browser process to start forwarding
- // points to viz for use in a delegated ink trail. It contains more
- // information to be used in making the forwarding decision. It exists the
- // entire time points could be forwarded, and forwarding must stop as soon as
- // it is null.
- DelegatedInkBrowserMetadata? 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;
- // The cumulative time spent performing visual updates since the last commit.
- // Tracked for all `local_surface_id` before this one.
- mojo_base.mojom.TimeDelta previous_surfaces_visual_update_duration;
- // The cumulative time spend performing visual updates for the current
- // `local_surface_id` since the last commit.
- mojo_base.mojom.TimeDelta current_surface_visual_update_duration;
- // 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.PointF root_scroll_offset);
- };
|