Commit ddd94b25 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Add gfx StructTraits for ScrollOffset.

To support synchronous compositor for Android webview over mojo add
a struct trait for ScrollOffset

BUG=722928
TBR=vollick@chromium.org

Change-Id: I4138ac3ff93fc17e6a123335ac3a82975df48db4
Reviewed-on: https://chromium-review.googlesource.com/830115
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524713}
parent 6fbc587c
...@@ -3,3 +3,6 @@ per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS ...@@ -3,3 +3,6 @@ per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
per-file *.mojom=set noparent per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS per-file *.mojom=file://ipc/SECURITY_OWNERS
per-file *.typemap=set noparent
per-file *.typemap=file://ipc/SECURITY_OWNERS
...@@ -68,3 +68,8 @@ struct Vector2dF { ...@@ -68,3 +68,8 @@ struct Vector2dF {
float x; float x;
float y; float y;
}; };
struct ScrollOffset {
float x;
float y;
};
...@@ -10,6 +10,7 @@ public_headers = [ ...@@ -10,6 +10,7 @@ public_headers = [
"//ui/gfx/geometry/rect.h", "//ui/gfx/geometry/rect.h",
"//ui/gfx/geometry/rect_f.h", "//ui/gfx/geometry/rect_f.h",
"//ui/gfx/geometry/safe_integer_conversions.h", "//ui/gfx/geometry/safe_integer_conversions.h",
"//ui/gfx/geometry/scroll_offset.h",
"//ui/gfx/geometry/insets.h", "//ui/gfx/geometry/insets.h",
"//ui/gfx/geometry/vector2d.h", "//ui/gfx/geometry/vector2d.h",
"//ui/gfx/geometry/vector2d_f.h", "//ui/gfx/geometry/vector2d_f.h",
...@@ -29,4 +30,5 @@ type_mappings = [ ...@@ -29,4 +30,5 @@ type_mappings = [
"gfx.mojom.InsetsF=gfx::InsetsF", "gfx.mojom.InsetsF=gfx::InsetsF",
"gfx.mojom.Vector2d=gfx::Vector2d", "gfx.mojom.Vector2d=gfx::Vector2d",
"gfx.mojom.Vector2dF=gfx::Vector2dF", "gfx.mojom.Vector2dF=gfx::Vector2dF",
"gfx.mojom.ScrollOffset=gfx::ScrollOffset",
] ]
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/scroll_offset.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/geometry/vector2d.h"
...@@ -141,6 +142,18 @@ struct StructTraits<gfx::mojom::Vector2dFDataView, gfx::Vector2dF> { ...@@ -141,6 +142,18 @@ struct StructTraits<gfx::mojom::Vector2dFDataView, gfx::Vector2dF> {
} }
}; };
template <>
struct StructTraits<gfx::mojom::ScrollOffsetDataView, gfx::ScrollOffset> {
static float x(const gfx::ScrollOffset& v) { return v.x(); }
static float y(const gfx::ScrollOffset& v) { return v.y(); }
static bool Read(gfx::mojom::ScrollOffsetDataView data,
gfx::ScrollOffset* out) {
out->set_x(data.x());
out->set_y(data.y());
return true;
}
};
} // namespace mojo } // namespace mojo
#endif // UI_GFX_GEOMETRY_MOJO_GEOMETRY_STRUCT_TRAITS_H_ #endif // UI_GFX_GEOMETRY_MOJO_GEOMETRY_STRUCT_TRAITS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment