1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/mojom/render_frame_metadata_mojom_traits.h"
7 #include "build/build_config.h"
8 #include "services/viz/public/cpp/compositing/selection_mojom_traits.h"
9 #include "services/viz/public/cpp/compositing/vertical_scroll_direction_mojom_traits.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
12 #include "ui/gfx/mojom/selection_bound_mojom_traits.h"
17 bool StructTraits<cc::mojom::DelegatedInkBrowserMetadataDataView,
18 cc::DelegatedInkBrowserMetadata>::
19 Read(cc::mojom::DelegatedInkBrowserMetadataDataView data,
20 cc::DelegatedInkBrowserMetadata* out) {
21 out->delegated_ink_is_hovering = data.delegated_ink_is_hovering();
27 cc::mojom::RenderFrameMetadataDataView,
28 cc::RenderFrameMetadata>::Read(cc::mojom::RenderFrameMetadataDataView data,
29 cc::RenderFrameMetadata* out) {
30 out->is_scroll_offset_at_top = data.is_scroll_offset_at_top();
31 out->is_mobile_optimized = data.is_mobile_optimized();
32 out->device_scale_factor = data.device_scale_factor();
33 out->page_scale_factor = data.page_scale_factor();
34 out->external_page_scale_factor = data.external_page_scale_factor();
35 out->top_controls_height = data.top_controls_height();
36 out->top_controls_shown_ratio = data.top_controls_shown_ratio();
37 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
38 out->bottom_controls_height = data.bottom_controls_height();
39 out->bottom_controls_shown_ratio = data.bottom_controls_shown_ratio();
40 out->top_controls_min_height_offset = data.top_controls_min_height_offset();
41 out->bottom_controls_min_height_offset =
42 data.bottom_controls_min_height_offset();
43 out->min_page_scale_factor = data.min_page_scale_factor();
44 out->max_page_scale_factor = data.max_page_scale_factor();
45 out->root_overflow_y_hidden = data.root_overflow_y_hidden();
46 out->has_transparent_background = data.has_transparent_background();
48 return data.ReadRootScrollOffset(&out->root_scroll_offset) &&
49 data.ReadSelection(&out->selection) &&
50 data.ReadDelegatedInkMetadata(&out->delegated_ink_metadata) &&
51 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
52 data.ReadScrollableViewportSize(&out->scrollable_viewport_size) &&
53 data.ReadRootLayerSize(&out->root_layer_size) &&
55 data.ReadViewportSizeInPixels(&out->viewport_size_in_pixels) &&
56 data.ReadLocalSurfaceId(&out->local_surface_id) &&
57 data.ReadNewVerticalScrollDirection(
58 &out->new_vertical_scroll_direction) &&
59 data.ReadRootBackgroundColor(&out->root_background_color);