| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GeometryStructTraits_h | 5 #ifndef GeometryStructTraits_h |
| 6 #define GeometryStructTraits_h | 6 #define GeometryStructTraits_h |
| 7 | 7 |
| 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 9 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 9 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 10 #include "third_party/WebKit/public/platform/WebRect.h" |
| 10 #include "third_party/WebKit/public/platform/WebSize.h" | 11 #include "third_party/WebKit/public/platform/WebSize.h" |
| 11 #include "ui/gfx/geometry/mojo/geometry.mojom-shared.h" | 12 #include "ui/gfx/geometry/mojo/geometry.mojom-shared.h" |
| 12 | 13 |
| 13 namespace mojo { | 14 namespace mojo { |
| 14 | 15 |
| 15 template <> | 16 template <> |
| 16 struct StructTraits<gfx::mojom::PointFDataView, ::blink::WebFloatPoint> { | 17 struct StructTraits<gfx::mojom::PointFDataView, ::blink::WebFloatPoint> { |
| 17 static float x(const ::blink::WebFloatPoint& point) { return point.x; } | 18 static float x(const ::blink::WebFloatPoint& point) { return point.x; } |
| 18 static float y(const ::blink::WebFloatPoint& point) { return point.y; } | 19 static float y(const ::blink::WebFloatPoint& point) { return point.y; } |
| 19 static bool Read(gfx::mojom::PointFDataView, ::blink::WebFloatPoint* out); | 20 static bool Read(gfx::mojom::PointFDataView, ::blink::WebFloatPoint* out); |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 template <> | 23 template <> |
| 23 struct StructTraits<gfx::mojom::RectFDataView, ::blink::WebFloatRect> { | 24 struct StructTraits<gfx::mojom::RectFDataView, ::blink::WebFloatRect> { |
| 24 static float x(const ::blink::WebFloatRect& rect) { return rect.x; } | 25 static float x(const ::blink::WebFloatRect& rect) { return rect.x; } |
| 25 static float y(const ::blink::WebFloatRect& rect) { return rect.y; } | 26 static float y(const ::blink::WebFloatRect& rect) { return rect.y; } |
| 26 static float width(const ::blink::WebFloatRect& rect) { return rect.width; } | 27 static float width(const ::blink::WebFloatRect& rect) { return rect.width; } |
| 27 static float height(const ::blink::WebFloatRect& rect) { return rect.height; } | 28 static float height(const ::blink::WebFloatRect& rect) { return rect.height; } |
| 28 static bool Read(gfx::mojom::RectFDataView, ::blink::WebFloatRect* out); | 29 static bool Read(gfx::mojom::RectFDataView, ::blink::WebFloatRect* out); |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 template <> | 32 template <> |
| 33 struct StructTraits<gfx::mojom::RectDataView, ::blink::WebRect> { |
| 34 static int x(const ::blink::WebRect& rect) { return rect.x; } |
| 35 static int y(const ::blink::WebRect& rect) { return rect.y; } |
| 36 static int width(const ::blink::WebRect& rect) { return rect.width; } |
| 37 static int height(const ::blink::WebRect& rect) { return rect.height; } |
| 38 static bool Read(gfx::mojom::RectDataView, ::blink::WebRect* out); |
| 39 }; |
| 40 |
| 41 template <> |
| 32 struct StructTraits<gfx::mojom::SizeDataView, ::blink::WebSize> { | 42 struct StructTraits<gfx::mojom::SizeDataView, ::blink::WebSize> { |
| 33 static int width(const ::blink::WebSize& size) { return size.width; } | 43 static int width(const ::blink::WebSize& size) { return size.width; } |
| 34 static int height(const ::blink::WebSize& size) { return size.height; } | 44 static int height(const ::blink::WebSize& size) { return size.height; } |
| 35 static bool Read(gfx::mojom::SizeDataView, ::blink::WebSize* out); | 45 static bool Read(gfx::mojom::SizeDataView, ::blink::WebSize* out); |
| 36 }; | 46 }; |
| 37 | 47 |
| 38 } // namespace mojo | 48 } // namespace mojo |
| 39 | 49 |
| 40 #endif // GeometryStructTraits_h | 50 #endif // GeometryStructTraits_h |
| OLD | NEW |