Index: content/public/common/common_param_traits.cc |
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc |
index 8ee6b2afd8eb4f1b5abb53f036fe707dcd6811b2..90943d7771b0ad665b24ede70ecf76e6a40018a0 100644 |
--- a/content/public/common/common_param_traits.cc |
+++ b/content/public/common/common_param_traits.cc |
@@ -12,6 +12,7 @@ |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/base/range/range.h" |
#include "ui/gfx/rect.h" |
+#include "ui/gfx/rect_f.h" |
namespace { |
@@ -422,6 +423,34 @@ void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { |
p.width(), p.height())); |
} |
+void ParamTraits<gfx::RectF>::Write(Message* m, const gfx::RectF& p) { |
+ m->WriteFloat(p.x()); |
brettw
2012/07/23 19:06:21
I'd avoid adding anything to pickle and instead us
Leandro GraciĆ” Gil
2012/07/23 20:45:35
SGTM. Fixed.
On 2012/07/23 19:06:21, brettw wrote
|
+ m->WriteFloat(p.y()); |
+ m->WriteFloat(p.width()); |
+ m->WriteFloat(p.height()); |
+} |
+ |
+bool ParamTraits<gfx::RectF>::Read(const Message* m, |
+ PickleIterator* iter, |
+ gfx::RectF* r) { |
+ float x, y, w, h; |
+ if (!m->ReadFloat(iter, &x) || |
+ !m->ReadFloat(iter, &y) || |
+ !m->ReadFloat(iter, &w) || |
+ !m->ReadFloat(iter, &h)) |
+ return false; |
+ r->set_x(x); |
+ r->set_y(y); |
+ r->set_width(w); |
+ r->set_height(h); |
+ return true; |
+} |
+ |
+void ParamTraits<gfx::RectF>::Log(const gfx::RectF& p, std::string* l) { |
+ l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(), |
+ p.width(), p.height())); |
+} |
+ |
void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) { |
m->WriteUInt64(r.start()); |
m->WriteUInt64(r.end()); |