Convert optional webpoint

This commit is contained in:
Samuel Attard 2017-12-18 15:14:50 +11:00 committed by Aleksei Kuzmin
parent a8e013dcb6
commit 7356be0164

View file

@ -305,13 +305,21 @@ bool Converter<blink::WebFloatPoint>::FromV8(
return dict.Get("x", &out->x) && dict.Get("y", &out->y); return dict.Get("x", &out->x) && dict.Get("y", &out->y);
} }
bool Converter<blink::WebPoint>::FromV8( template<>
v8::Isolate* isolate, v8::Local<v8::Value> val, blink::WebPoint* out) { struct Converter<base::Optional<blink::WebPoint>> {
mate::Dictionary dict; static bool FromV8(
if (!ConvertFromV8(isolate, val, &dict)) v8::Isolate* isolate, v8::Local<v8::Value> val,
return false; base::Optional<blink::WebPoint>* out) {
return dict.Get("x", &out->x) && dict.Get("y", &out->y); mate::Dictionary dict;
} if (!ConvertFromV8(isolate, val, &dict))
return false;
blink::WebPoint point;
bool success = dict.Get("x", &point.x) && dict.Get("y", &point.y);
if (!success) return false;
out->emplace(point);
return true;
}
};
bool Converter<blink::WebSize>::FromV8( bool Converter<blink::WebSize>::FromV8(
v8::Isolate* isolate, v8::Local<v8::Value> val, blink::WebSize* out) { v8::Isolate* isolate, v8::Local<v8::Value> val, blink::WebSize* out) {