| 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" |
| 9 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 8 #include "third_party/WebKit/public/platform/WebSize.h" | 10 #include "third_party/WebKit/public/platform/WebSize.h" |
| 9 #include "ui/gfx/geometry/mojo/geometry.mojom-shared.h" | 11 #include "ui/gfx/geometry/mojo/geometry.mojom-shared.h" |
| 10 | 12 |
| 11 namespace mojo { | 13 namespace mojo { |
| 12 | 14 |
| 13 template <> | 15 template <> |
| 16 struct StructTraits<gfx::mojom::PointFDataView, ::blink::WebFloatPoint> { |
| 17 static float x(const ::blink::WebFloatPoint& point) { return point.x; } |
| 18 static float y(const ::blink::WebFloatPoint& point) { return point.y; } |
| 19 static bool Read(gfx::mojom::PointFDataView, ::blink::WebFloatPoint* out); |
| 20 }; |
| 21 |
| 22 template <> |
| 23 struct StructTraits<gfx::mojom::RectFDataView, ::blink::WebFloatRect> { |
| 24 static float x(const ::blink::WebFloatRect& rect) { return rect.x; } |
| 25 static float y(const ::blink::WebFloatRect& rect) { return rect.y; } |
| 26 static float width(const ::blink::WebFloatRect& rect) { return rect.width; } |
| 27 static float height(const ::blink::WebFloatRect& rect) { return rect.height; } |
| 28 static bool Read(gfx::mojom::RectFDataView, ::blink::WebFloatRect* out); |
| 29 }; |
| 30 |
| 31 template <> |
| 14 struct StructTraits<gfx::mojom::SizeDataView, ::blink::WebSize> { | 32 struct StructTraits<gfx::mojom::SizeDataView, ::blink::WebSize> { |
| 15 static int width(const ::blink::WebSize& size) { return size.width; } | 33 static int width(const ::blink::WebSize& size) { return size.width; } |
| 16 static int height(const ::blink::WebSize& size) { return size.height; } | 34 static int height(const ::blink::WebSize& size) { return size.height; } |
| 17 static bool Read(gfx::mojom::SizeDataView, ::blink::WebSize* out); | 35 static bool Read(gfx::mojom::SizeDataView, ::blink::WebSize* out); |
| 18 }; | 36 }; |
| 19 | 37 |
| 20 } // namespace mojo | 38 } // namespace mojo |
| 21 | 39 |
| 22 #endif // GeometryStructTraits_h | 40 #endif // GeometryStructTraits_h |
| OLD | NEW |