OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_ |
| 6 #define COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "components/arc/common/ime.mojom.h" |
| 9 #include "ui/gfx/geometry/rect.h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 template <> |
| 14 struct StructTraits<arc::mojom::CursorRectDataView, gfx::Rect> { |
| 15 static int32_t left(const gfx::Rect& r) { return r.x(); } |
| 16 static int32_t top(const gfx::Rect& r) { return r.y(); } |
| 17 static int32_t right(const gfx::Rect& r) { return r.right(); } |
| 18 static int32_t bottom(const gfx::Rect& r) { return r.bottom(); } |
| 19 |
| 20 static bool Read(arc::mojom::CursorRectDataView data, gfx::Rect* out); |
| 21 }; |
| 22 |
| 23 template <> |
| 24 struct StructTraits<arc::mojom::TextRangeDataView, gfx::Range> { |
| 25 static uint32_t start(const gfx::Range& r) { return r.start(); } |
| 26 static uint32_t end(const gfx::Range& r) { return r.end(); } |
| 27 |
| 28 static bool Read(arc::mojom::TextRangeDataView data, gfx::Range* out); |
| 29 }; |
| 30 |
| 31 } // namespace mojo |
| 32 |
| 33 #endif // COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_ |
OLD | NEW |