From: Cheng Zhao Date: Tue, 7 Jan 2014 12:00:02 +0000 (+0800) Subject: Add support to convert gfx::Point to v8 value. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b1cf87115726b6f69b23d18f3ca7697e2921e52;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add support to convert gfx::Point to v8 value. --- diff --git a/common/v8/native_type_conversions.h b/common/v8/native_type_conversions.h index 4949b61..8da7238 100644 --- a/common/v8/native_type_conversions.h +++ b/common/v8/native_type_conversions.h @@ -18,6 +18,7 @@ #include "common/v8/scoped_persistent.h" #include "common/v8/v8_value_converter.h" #include "content/public/renderer/v8_value_converter.h" +#include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "url/gurl.h" @@ -154,6 +155,13 @@ v8::Handle ToV8Value(const std::vector& paths) { return result; } +inline v8::Handle ToV8Value(const gfx::Point& point) { + v8::Handle obj = v8::Object::New(); + obj->Set(ToV8Value("x"), ToV8Value(point.x())); + obj->Set(ToV8Value("y"), ToV8Value(point.y())); + return obj; +} + // Check if a V8 Value is of specified type. template inline bool V8ValueCanBeConvertedTo(v8::Handle value) {