| Index: ui/gfx/geometry/mojo/geometry_struct_traits.h
|
| diff --git a/ui/gfx/geometry/mojo/geometry_struct_traits.h b/ui/gfx/geometry/mojo/geometry_struct_traits.h
|
| index f559f308e55bbb9f99fd48b6f9bb2831a85f8452..480b54652e1d8ad5525e31344b30d1e97669c4d0 100644
|
| --- a/ui/gfx/geometry/mojo/geometry_struct_traits.h
|
| +++ b/ui/gfx/geometry/mojo/geometry_struct_traits.h
|
| @@ -7,7 +7,6 @@
|
|
|
| #include "ui/gfx/geometry/insets.h"
|
| #include "ui/gfx/geometry/insets_f.h"
|
| -#include "ui/gfx/geometry/mojo/geometry.mojom.h"
|
| #include "ui/gfx/geometry/point.h"
|
| #include "ui/gfx/geometry/point_f.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| @@ -19,57 +18,57 @@
|
|
|
| namespace mojo {
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Insets, gfx::Insets> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Insets> {
|
| static int top(const gfx::Insets& p) { return p.top(); }
|
| static int left(const gfx::Insets& p) { return p.left(); }
|
| static int bottom(const gfx::Insets& p) { return p.bottom(); }
|
| static int right(const gfx::Insets& p) { return p.right(); }
|
| - static bool Read(gfx::mojom::InsetsDataView data, gfx::Insets* out) {
|
| + static bool Read(typename T::DataView data, gfx::Insets* out) {
|
| out->Set(data.top(), data.left(), data.bottom(), data.right());
|
| return true;
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::InsetsF, gfx::InsetsF> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::InsetsF> {
|
| static float top(const gfx::InsetsF& p) { return p.top(); }
|
| static float left(const gfx::InsetsF& p) { return p.left(); }
|
| static float bottom(const gfx::InsetsF& p) { return p.bottom(); }
|
| static float right(const gfx::InsetsF& p) { return p.right(); }
|
| - static bool Read(gfx::mojom::InsetsFDataView data, gfx::InsetsF* out) {
|
| + static bool Read(typename T::DataView data, gfx::InsetsF* out) {
|
| out->Set(data.top(), data.left(), data.bottom(), data.right());
|
| return true;
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Point, gfx::Point> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Point> {
|
| static int x(const gfx::Point& p) { return p.x(); }
|
| static int y(const gfx::Point& p) { return p.y(); }
|
| - static bool Read(gfx::mojom::PointDataView data, gfx::Point* out) {
|
| + static bool Read(typename T::DataView data, gfx::Point* out) {
|
| out->SetPoint(data.x(), data.y());
|
| return true;
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::PointF, gfx::PointF> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::PointF> {
|
| static float x(const gfx::PointF& p) { return p.x(); }
|
| static float y(const gfx::PointF& p) { return p.y(); }
|
| - static bool Read(gfx::mojom::PointFDataView data, gfx::PointF* out) {
|
| + static bool Read(typename T::DataView data, gfx::PointF* out) {
|
| out->SetPoint(data.x(), data.y());
|
| return true;
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Rect, gfx::Rect> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Rect> {
|
| static int x(const gfx::Rect& p) { return p.x(); }
|
| static int y(const gfx::Rect& p) { return p.y(); }
|
| static int width(const gfx::Rect& p) { return p.width(); }
|
| static int height(const gfx::Rect& p) { return p.height(); }
|
| - static bool Read(gfx::mojom::RectDataView data, gfx::Rect* out) {
|
| + static bool Read(typename T::DataView data, gfx::Rect* out) {
|
| if (data.width() < 0 || data.height() < 0)
|
| return false;
|
|
|
| @@ -78,13 +77,13 @@ struct StructTraits<gfx::mojom::Rect, gfx::Rect> {
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::RectF, gfx::RectF> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::RectF> {
|
| static float x(const gfx::RectF& p) { return p.x(); }
|
| static float y(const gfx::RectF& p) { return p.y(); }
|
| static float width(const gfx::RectF& p) { return p.width(); }
|
| static float height(const gfx::RectF& p) { return p.height(); }
|
| - static bool Read(gfx::mojom::RectFDataView data, gfx::RectF* out) {
|
| + static bool Read(typename T::DataView data, gfx::RectF* out) {
|
| if (data.width() < 0 || data.height() < 0)
|
| return false;
|
|
|
| @@ -93,11 +92,11 @@ struct StructTraits<gfx::mojom::RectF, gfx::RectF> {
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Size, gfx::Size> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Size> {
|
| static int width(const gfx::Size& p) { return p.width(); }
|
| static int height(const gfx::Size& p) { return p.height(); }
|
| - static bool Read(gfx::mojom::SizeDataView data, gfx::Size* out) {
|
| + static bool Read(typename T::DataView data, gfx::Size* out) {
|
| if (data.width() < 0 || data.height() < 0)
|
| return false;
|
|
|
| @@ -106,11 +105,11 @@ struct StructTraits<gfx::mojom::Size, gfx::Size> {
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::SizeF, gfx::SizeF> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::SizeF> {
|
| static float width(const gfx::SizeF& p) { return p.width(); }
|
| static float height(const gfx::SizeF& p) { return p.height(); }
|
| - static bool Read(gfx::mojom::SizeFDataView data, gfx::SizeF* out) {
|
| + static bool Read(typename T::DataView data, gfx::SizeF* out) {
|
| if (data.width() < 0 || data.height() < 0)
|
| return false;
|
|
|
| @@ -119,22 +118,22 @@ struct StructTraits<gfx::mojom::SizeF, gfx::SizeF> {
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Vector2d, gfx::Vector2d> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Vector2d> {
|
| static int x(const gfx::Vector2d& v) { return v.x(); }
|
| static int y(const gfx::Vector2d& v) { return v.y(); }
|
| - static bool Read(gfx::mojom::Vector2dDataView data, gfx::Vector2d* out) {
|
| + static bool Read(typename T::DataView data, gfx::Vector2d* out) {
|
| out->set_x(data.x());
|
| out->set_y(data.y());
|
| return true;
|
| }
|
| };
|
|
|
| -template <>
|
| -struct StructTraits<gfx::mojom::Vector2dF, gfx::Vector2dF> {
|
| +template <typename T>
|
| +struct StructTraits<T, gfx::Vector2dF> {
|
| static float x(const gfx::Vector2dF& v) { return v.x(); }
|
| static float y(const gfx::Vector2dF& v) { return v.y(); }
|
| - static bool Read(gfx::mojom::Vector2dFDataView data, gfx::Vector2dF* out) {
|
| + static bool Read(typename T::DataView data, gfx::Vector2dF* out) {
|
| out->set_x(data.x());
|
| out->set_y(data.y());
|
| return true;
|
|
|