// third_party/blink/public/mojom/frame/frame_visual_properties.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "third_party/blink/public/mojom/frame/frame_visual_properties.mojom.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "third_party/blink/public/mojom/frame/frame_visual_properties.mojom-params-data.h"
#include "third_party/blink/public/mojom/frame/frame_visual_properties.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/frame/frame_visual_properties.mojom-import-headers.h"
#include "third_party/blink/public/mojom/frame/frame_visual_properties.mojom-test-utils.h"


namespace blink::mojom {
FrameVisualProperties::FrameVisualProperties()
    : screen_infos(),
      auto_resize_enabled(),
      is_pinch_gesture_active(),
      zoom_level(),
      css_zoom_factor(),
      page_scale_factor(1),
      compositing_scale_factor(1),
      cursor_accessibility_scale_factor(1),
      visible_viewport_size(),
      min_size_for_auto_resize(),
      max_size_for_auto_resize(),
      root_widget_viewport_segments(),
      compositor_viewport(),
      rect_in_local_root(),
      local_frame_size(),
      local_surface_id() {}

FrameVisualProperties::FrameVisualProperties(
    const ::display::ScreenInfos& screen_infos_in,
    bool auto_resize_enabled_in,
    bool is_pinch_gesture_active_in,
    double zoom_level_in,
    double css_zoom_factor_in,
    float page_scale_factor_in,
    float compositing_scale_factor_in,
    float cursor_accessibility_scale_factor_in,
    const ::gfx::Size& visible_viewport_size_in,
    const ::gfx::Size& min_size_for_auto_resize_in,
    const ::gfx::Size& max_size_for_auto_resize_in,
    std::vector<::gfx::Rect> root_widget_viewport_segments_in,
    const ::gfx::Rect& compositor_viewport_in,
    const ::gfx::Rect& rect_in_local_root_in,
    const ::gfx::Size& local_frame_size_in,
    const ::viz::LocalSurfaceId& local_surface_id_in)
    : screen_infos(std::move(screen_infos_in)),
      auto_resize_enabled(std::move(auto_resize_enabled_in)),
      is_pinch_gesture_active(std::move(is_pinch_gesture_active_in)),
      zoom_level(std::move(zoom_level_in)),
      css_zoom_factor(std::move(css_zoom_factor_in)),
      page_scale_factor(std::move(page_scale_factor_in)),
      compositing_scale_factor(std::move(compositing_scale_factor_in)),
      cursor_accessibility_scale_factor(std::move(cursor_accessibility_scale_factor_in)),
      visible_viewport_size(std::move(visible_viewport_size_in)),
      min_size_for_auto_resize(std::move(min_size_for_auto_resize_in)),
      max_size_for_auto_resize(std::move(max_size_for_auto_resize_in)),
      root_widget_viewport_segments(std::move(root_widget_viewport_segments_in)),
      compositor_viewport(std::move(compositor_viewport_in)),
      rect_in_local_root(std::move(rect_in_local_root_in)),
      local_frame_size(std::move(local_frame_size_in)),
      local_surface_id(std::move(local_surface_id_in)) {}

FrameVisualProperties::~FrameVisualProperties() = default;

void FrameVisualProperties::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "screen_infos"), this->screen_infos,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::display::ScreenInfos&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "auto_resize_enabled"), this->auto_resize_enabled,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "is_pinch_gesture_active"), this->is_pinch_gesture_active,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "zoom_level"), this->zoom_level,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "css_zoom_factor"), this->css_zoom_factor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "page_scale_factor"), this->page_scale_factor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "compositing_scale_factor"), this->compositing_scale_factor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "cursor_accessibility_scale_factor"), this->cursor_accessibility_scale_factor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "visible_viewport_size"), this->visible_viewport_size,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "min_size_for_auto_resize"), this->min_size_for_auto_resize,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "max_size_for_auto_resize"), this->max_size_for_auto_resize,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "root_widget_viewport_segments"), this->root_widget_viewport_segments,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<::gfx::Rect>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "compositor_viewport"), this->compositor_viewport,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Rect&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "rect_in_local_root"), this->rect_in_local_root,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Rect&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "local_frame_size"), this->local_frame_size,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "local_surface_id"), this->local_surface_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::viz::LocalSurfaceId&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool FrameVisualProperties::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // blink::mojom


namespace mojo {


// static
bool StructTraits<::blink::mojom::FrameVisualProperties::DataView, ::blink::mojom::FrameVisualPropertiesPtr>::Read(
    ::blink::mojom::FrameVisualProperties::DataView input,
    ::blink::mojom::FrameVisualPropertiesPtr* output) {
  bool success = true;
  ::blink::mojom::FrameVisualPropertiesPtr result(::blink::mojom::FrameVisualProperties::New());
  
      if (success && !input.ReadScreenInfos(&result->screen_infos))
        success = false;
      if (success)
        result->auto_resize_enabled = input.auto_resize_enabled();
      if (success)
        result->is_pinch_gesture_active = input.is_pinch_gesture_active();
      if (success)
        result->zoom_level = input.zoom_level();
      if (success)
        result->css_zoom_factor = input.css_zoom_factor();
      if (success)
        result->page_scale_factor = input.page_scale_factor();
      if (success)
        result->compositing_scale_factor = input.compositing_scale_factor();
      if (success)
        result->cursor_accessibility_scale_factor = input.cursor_accessibility_scale_factor();
      if (success && !input.ReadVisibleViewportSize(&result->visible_viewport_size))
        success = false;
      if (success && !input.ReadMinSizeForAutoResize(&result->min_size_for_auto_resize))
        success = false;
      if (success && !input.ReadMaxSizeForAutoResize(&result->max_size_for_auto_resize))
        success = false;
      if (success && !input.ReadRootWidgetViewportSegments(&result->root_widget_viewport_segments))
        success = false;
      if (success && !input.ReadCompositorViewport(&result->compositor_viewport))
        success = false;
      if (success && !input.ReadRectInLocalRoot(&result->rect_in_local_root))
        success = false;
      if (success && !input.ReadLocalFrameSize(&result->local_frame_size))
        success = false;
      if (success && !input.ReadLocalSurfaceId(&result->local_surface_id))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace blink::mojom {




}  // blink::mojom


#if defined(__clang__)
#pragma clang diagnostic pop
#endif