Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: third_party/WebKit/Source/platform/mojo/GeometryStructTraits.h

Issue 2928413002: Add RectF and PointF typemaps in blink. (Closed)
Patch Set: address comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698