// third_party/blink/public/mojom/frame/view_transition_state.mojom-blink.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/view_transition_state.mojom-blink.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/view_transition_state.mojom-params-data.h"
#include "third_party/blink/public/mojom/frame/view_transition_state.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/frame/view_transition_state.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/frame/view_transition_state.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
#include "third_party/blink/public/common/frame/view_transition_state_mojom_traits.h"


namespace blink::mojom::blink {
ViewTransitionElementLayeredBoxProperties::ViewTransitionElementLayeredBoxProperties()
    : content_box(),
      padding_box(),
      box_sizing() {}

ViewTransitionElementLayeredBoxProperties::ViewTransitionElementLayeredBoxProperties(
    const ::gfx::RectF& content_box_in,
    const ::gfx::RectF& padding_box_in,
    ViewTransitionElementBoxSizing box_sizing_in)
    : content_box(std::move(content_box_in)),
      padding_box(std::move(padding_box_in)),
      box_sizing(std::move(box_sizing_in)) {}

ViewTransitionElementLayeredBoxProperties::~ViewTransitionElementLayeredBoxProperties() = default;

void ViewTransitionElementLayeredBoxProperties::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "content_box"), this->content_box,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::RectF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "padding_box"), this->padding_box,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::RectF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "box_sizing"), this->box_sizing,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ViewTransitionElementBoxSizing>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool ViewTransitionElementLayeredBoxProperties::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
ViewTransitionElement::ViewTransitionElement()
    : tag_name(),
      border_box_rect_in_enclosing_layer_css_space(),
      viewport_matrix(),
      overflow_rect_in_layout_space(),
      captured_rect_in_layout_space(),
      snapshot_id(),
      paint_order(),
      captured_css_properties(),
      group_children_css_properties(),
      border_offset(),
      class_list(),
      containing_group_name(),
      layered_box_properties() {}

ViewTransitionElement::ViewTransitionElement(
    const ::blink::String& tag_name_in,
    const ::gfx::RectF& border_box_rect_in_enclosing_layer_css_space_in,
    const ::gfx::Transform& viewport_matrix_in,
    const ::gfx::RectF& overflow_rect_in_layout_space_in,
    const std::optional<::gfx::RectF>& captured_rect_in_layout_space_in,
    ::viz::mojom::blink::ViewTransitionElementResourceIdPtr snapshot_id_in,
    int32_t paint_order_in,
    const ::blink::HashMap<ViewTransitionPropertyId, ::blink::String>& captured_css_properties_in,
    const ::blink::HashMap<ViewTransitionPropertyId, ::blink::String>& group_children_css_properties_in,
    const ::gfx::Vector2dF& border_offset_in,
    ::blink::Vector<::blink::String> class_list_in,
    const ::blink::String& containing_group_name_in,
    ViewTransitionElementLayeredBoxPropertiesPtr layered_box_properties_in)
    : tag_name(std::move(tag_name_in)),
      border_box_rect_in_enclosing_layer_css_space(std::move(border_box_rect_in_enclosing_layer_css_space_in)),
      viewport_matrix(std::move(viewport_matrix_in)),
      overflow_rect_in_layout_space(std::move(overflow_rect_in_layout_space_in)),
      captured_rect_in_layout_space(std::move(captured_rect_in_layout_space_in)),
      snapshot_id(std::move(snapshot_id_in)),
      paint_order(std::move(paint_order_in)),
      captured_css_properties(std::move(captured_css_properties_in)),
      group_children_css_properties(std::move(group_children_css_properties_in)),
      border_offset(std::move(border_offset_in)),
      class_list(std::move(class_list_in)),
      containing_group_name(std::move(containing_group_name_in)),
      layered_box_properties(std::move(layered_box_properties_in)) {}

ViewTransitionElement::~ViewTransitionElement() = default;

void ViewTransitionElement::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "tag_name"), this->tag_name,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::String&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "border_box_rect_in_enclosing_layer_css_space"), this->border_box_rect_in_enclosing_layer_css_space,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::RectF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "viewport_matrix"), this->viewport_matrix,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Transform&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "overflow_rect_in_layout_space"), this->overflow_rect_in_layout_space,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::RectF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "captured_rect_in_layout_space"), this->captured_rect_in_layout_space,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::optional<::gfx::RectF>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "snapshot_id"), this->snapshot_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::viz::mojom::blink::ViewTransitionElementResourceIdPtr>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "paint_order"), this->paint_order,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "captured_css_properties"), this->captured_css_properties,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::HashMap<ViewTransitionPropertyId, ::blink::String>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "group_children_css_properties"), this->group_children_css_properties,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::HashMap<ViewTransitionPropertyId, ::blink::String>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "border_offset"), this->border_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Vector2dF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "class_list"), this->class_list,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::Vector<::blink::String>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "containing_group_name"), this->containing_group_name,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::String&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "layered_box_properties"), this->layered_box_properties,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ViewTransitionElementLayeredBoxPropertiesPtr>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool ViewTransitionElement::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
ViewTransitionState::ViewTransitionState()
    : elements(),
      transition_token(),
      snapshot_root_size_at_capture(),
      device_pixel_ratio(),
      next_element_resource_id(),
      subframe_snapshot_id(),
      id_to_auto_name_map(),
      delay_layer_tree_view_deletion() {}

ViewTransitionState::ViewTransitionState(
    ::blink::Vector<::blink::ViewTransitionElement> elements_in,
    const ::blink::ViewTransitionToken& transition_token_in,
    const ::gfx::Size& snapshot_root_size_at_capture_in,
    float device_pixel_ratio_in,
    uint32_t next_element_resource_id_in,
    ::viz::mojom::blink::ViewTransitionElementResourceIdPtr subframe_snapshot_id_in,
    const ::blink::HashMap<::blink::String, ::blink::String>& id_to_auto_name_map_in,
    bool delay_layer_tree_view_deletion_in)
    : elements(std::move(elements_in)),
      transition_token(std::move(transition_token_in)),
      snapshot_root_size_at_capture(std::move(snapshot_root_size_at_capture_in)),
      device_pixel_ratio(std::move(device_pixel_ratio_in)),
      next_element_resource_id(std::move(next_element_resource_id_in)),
      subframe_snapshot_id(std::move(subframe_snapshot_id_in)),
      id_to_auto_name_map(std::move(id_to_auto_name_map_in)),
      delay_layer_tree_view_deletion(std::move(delay_layer_tree_view_deletion_in)) {}

ViewTransitionState::~ViewTransitionState() = default;

void ViewTransitionState::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "elements"), this->elements,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::Vector<::blink::ViewTransitionElement>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "transition_token"), this->transition_token,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::ViewTransitionToken&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "snapshot_root_size_at_capture"), this->snapshot_root_size_at_capture,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Size&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "device_pixel_ratio"), this->device_pixel_ratio,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "next_element_resource_id"), this->next_element_resource_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "subframe_snapshot_id"), this->subframe_snapshot_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::viz::mojom::blink::ViewTransitionElementResourceIdPtr>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "id_to_auto_name_map"), this->id_to_auto_name_map,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::HashMap<::blink::String, ::blink::String>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "delay_layer_tree_view_deletion"), this->delay_layer_tree_view_deletion,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // blink::mojom::blink


namespace mojo {


// static
bool StructTraits<::blink::mojom::blink::ViewTransitionElementLayeredBoxProperties::DataView, ::blink::mojom::blink::ViewTransitionElementLayeredBoxPropertiesPtr>::Read(
    ::blink::mojom::blink::ViewTransitionElementLayeredBoxProperties::DataView input,
    ::blink::mojom::blink::ViewTransitionElementLayeredBoxPropertiesPtr* output) {
  bool success = true;
  ::blink::mojom::blink::ViewTransitionElementLayeredBoxPropertiesPtr result(::blink::mojom::blink::ViewTransitionElementLayeredBoxProperties::New());
  
      if (success && !input.ReadContentBox(&result->content_box))
        success = false;
      if (success && !input.ReadPaddingBox(&result->padding_box))
        success = false;
      if (success && !input.ReadBoxSizing(&result->box_sizing))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::blink::mojom::blink::ViewTransitionElement::DataView, ::blink::mojom::blink::ViewTransitionElementPtr>::Read(
    ::blink::mojom::blink::ViewTransitionElement::DataView input,
    ::blink::mojom::blink::ViewTransitionElementPtr* output) {
  bool success = true;
  ::blink::mojom::blink::ViewTransitionElementPtr result(::blink::mojom::blink::ViewTransitionElement::New());
  
      if (success && !input.ReadTagName(&result->tag_name))
        success = false;
      if (success && !input.ReadBorderBoxRectInEnclosingLayerCssSpace(&result->border_box_rect_in_enclosing_layer_css_space))
        success = false;
      if (success && !input.ReadViewportMatrix(&result->viewport_matrix))
        success = false;
      if (success && !input.ReadOverflowRectInLayoutSpace(&result->overflow_rect_in_layout_space))
        success = false;
      if (success && !input.ReadCapturedRectInLayoutSpace(&result->captured_rect_in_layout_space))
        success = false;
      if (success && !input.ReadSnapshotId(&result->snapshot_id))
        success = false;
      if (success)
        result->paint_order = input.paint_order();
      if (success && !input.ReadCapturedCssProperties(&result->captured_css_properties))
        success = false;
      if (success && !input.ReadGroupChildrenCssProperties(&result->group_children_css_properties))
        success = false;
      if (success && !input.ReadBorderOffset(&result->border_offset))
        success = false;
      if (success && !input.ReadClassList(&result->class_list))
        success = false;
      if (success && !input.ReadContainingGroupName(&result->containing_group_name))
        success = false;
      if (success && !input.ReadLayeredBoxProperties(&result->layered_box_properties))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::blink::mojom::blink::ViewTransitionState::DataView, ::blink::mojom::blink::ViewTransitionStatePtr>::Read(
    ::blink::mojom::blink::ViewTransitionState::DataView input,
    ::blink::mojom::blink::ViewTransitionStatePtr* output) {
  bool success = true;
  ::blink::mojom::blink::ViewTransitionStatePtr result(::blink::mojom::blink::ViewTransitionState::New());
  
      if (success && !input.ReadElements(&result->elements))
        success = false;
      if (success && !input.ReadTransitionToken(&result->transition_token))
        success = false;
      if (success && !input.ReadSnapshotRootSizeAtCapture(&result->snapshot_root_size_at_capture))
        success = false;
      if (success)
        result->device_pixel_ratio = input.device_pixel_ratio();
      if (success)
        result->next_element_resource_id = input.next_element_resource_id();
      if (success && !input.ReadSubframeSnapshotId(&result->subframe_snapshot_id))
        success = false;
      if (success && !input.ReadIdToAutoNameMap(&result->id_to_auto_name_map))
        success = false;
      if (success)
        result->delay_layer_tree_view_deletion = input.delay_layer_tree_view_deletion();
  *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 {




}  // blink::mojom::blink


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