// ui/gfx/mojom/selection_bound.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 "ui/gfx/mojom/selection_bound.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 "ui/gfx/mojom/selection_bound.mojom-params-data.h"
#include "ui/gfx/mojom/selection_bound.mojom-shared-message-ids.h"

#include "ui/gfx/mojom/selection_bound.mojom-blink-import-headers.h"
#include "ui/gfx/mojom/selection_bound.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace gfx::mojom::blink {
SelectionBound::SelectionBound()
    : type(),
      edge_start(),
      edge_end(),
      visible_edge_start(),
      visible_edge_end(),
      visible() {}

SelectionBound::SelectionBound(
    ::gfx::SelectionBound::Type type_in,
    const ::gfx::PointF& edge_start_in,
    const ::gfx::PointF& edge_end_in,
    const ::gfx::PointF& visible_edge_start_in,
    const ::gfx::PointF& visible_edge_end_in,
    bool visible_in)
    : type(std::move(type_in)),
      edge_start(std::move(edge_start_in)),
      edge_end(std::move(edge_end_in)),
      visible_edge_start(std::move(visible_edge_start_in)),
      visible_edge_end(std::move(visible_edge_end_in)),
      visible(std::move(visible_in)) {}

SelectionBound::~SelectionBound() = default;

void SelectionBound::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "type"), this->type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::gfx::SelectionBound::Type>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "edge_start"), this->edge_start,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "edge_end"), this->edge_end,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "visible_edge_start"), this->visible_edge_start,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "visible_edge_end"), this->visible_edge_end,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "visible"), this->visible,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // gfx::mojom::blink


namespace mojo {


// static
bool StructTraits<::gfx::mojom::blink::SelectionBound::DataView, ::gfx::mojom::blink::SelectionBoundPtr>::Read(
    ::gfx::mojom::blink::SelectionBound::DataView input,
    ::gfx::mojom::blink::SelectionBoundPtr* output) {
  bool success = true;
  ::gfx::mojom::blink::SelectionBoundPtr result(::gfx::mojom::blink::SelectionBound::New());
  
      if (success && !input.ReadType(&result->type))
        success = false;
      if (success && !input.ReadEdgeStart(&result->edge_start))
        success = false;
      if (success && !input.ReadEdgeEnd(&result->edge_end))
        success = false;
      if (success && !input.ReadVisibleEdgeStart(&result->visible_edge_start))
        success = false;
      if (success && !input.ReadVisibleEdgeEnd(&result->visible_edge_end))
        success = false;
      if (success)
        result->visible = input.visible();
  *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 gfx::mojom::blink {




}  // gfx::mojom::blink


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