Index: mojo/converters/geometry/geometry_type_converters.cc |
diff --git a/mojo/converters/geometry/geometry_type_converters.cc b/mojo/converters/geometry/geometry_type_converters.cc |
index 00f4f3430c9b242ebe3523cc0fe4ece1561a39eb..c918d01a7240e428a8b2cee3423f386ad8b57aaa 100644 |
--- a/mojo/converters/geometry/geometry_type_converters.cc |
+++ b/mojo/converters/geometry/geometry_type_converters.cc |
@@ -115,4 +115,39 @@ gfx::Size TypeConverter<gfx::Size, Size>::Convert(const Size& input) { |
return gfx::Size(input.width, input.height); |
} |
+// static |
+Insets TypeConverter<Insets, gfx::Insets>::Convert(const gfx::Insets& input) { |
+ Insets insets; |
+ insets.top = input.top(); |
+ insets.left = input.left(); |
+ insets.bottom = input.bottom(); |
+ insets.right = input.right(); |
+ return insets; |
+} |
+ |
+// static |
+gfx::Insets TypeConverter<gfx::Insets, Insets>::Convert(const Insets& input) { |
+ return gfx::Insets(input.top, input.left, input.bottom, input.right); |
+} |
+ |
+// static |
+InsetsPtr TypeConverter<InsetsPtr, gfx::Insets>::Convert( |
+ const gfx::Insets& input) { |
+ InsetsPtr insets(Insets::New()); |
+ insets->top = input.top(); |
+ insets->left = input.left(); |
+ insets->bottom = input.bottom(); |
+ insets->right = input.right(); |
+ return insets.Pass(); |
+} |
+ |
+// static |
+gfx::Insets TypeConverter<gfx::Insets, InsetsPtr>::Convert( |
+ const InsetsPtr& input) { |
+ if (input.is_null()) |
+ return gfx::Insets(); |
+ |
+ return gfx::Insets(input->top, input->left, input->bottom, input->right); |
+} |
+ |
} // namespace mojo |