diff --git a/atom/common/native_mate_converters/gfx_converter.cc b/atom/common/native_mate_converters/gfx_converter.cc index 9ce2fffc3935..7a7cfd39e061 100644 --- a/atom/common/native_mate_converters/gfx_converter.cc +++ b/atom/common/native_mate_converters/gfx_converter.cc @@ -35,6 +35,28 @@ bool Converter::FromV8(v8::Isolate* isolate, return true; } +v8::Local Converter::ToV8(v8::Isolate* isolate, + const gfx::PointF& val) { + mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); + dict.SetHidden("simple", true); + dict.Set("x", val.x()); + dict.Set("y", val.y()); + return dict.GetHandle(); +} + +bool Converter::FromV8(v8::Isolate* isolate, + v8::Local val, + gfx::PointF* out) { + mate::Dictionary dict; + if (!ConvertFromV8(isolate, val, &dict)) + return false; + float x, y; + if (!dict.Get("x", &x) || !dict.Get("y", &y)) + return false; + *out = gfx::PointF(x, y); + return true; +} + v8::Local Converter::ToV8(v8::Isolate* isolate, const gfx::Size& val) { mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); diff --git a/atom/common/native_mate_converters/gfx_converter.h b/atom/common/native_mate_converters/gfx_converter.h index 705d91b72b50..745e6528093f 100644 --- a/atom/common/native_mate_converters/gfx_converter.h +++ b/atom/common/native_mate_converters/gfx_converter.h @@ -6,6 +6,7 @@ #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_GFX_CONVERTER_H_ #include "native_mate/converter.h" +#include "ui/gfx/geometry/point_f.h" namespace display { class Display; @@ -27,6 +28,15 @@ struct Converter { gfx::Point* out); }; +template <> +struct Converter { + static v8::Local ToV8(v8::Isolate* isolate, + const gfx::PointF& val); + static bool FromV8(v8::Isolate* isolate, + v8::Local val, + gfx::PointF* out); +}; + template <> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, const gfx::Size& val); diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 2a7925d8c66b..c82be9bb7097 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -711,8 +711,7 @@ describe(' tag', function () { }) }) - // TODO(alexeykuzmin): Enable the tests. - xdescribe('devtools-opened event', () => { + describe('devtools-opened event', () => { it('should fire when webview.openDevTools() is called', async () => { loadWebView(webview, { src: `file://${fixtures}/pages/base-page.html` @@ -726,8 +725,7 @@ describe(' tag', function () { }) }) - // TODO(alexeykuzmin): Enable the tests. - xdescribe('devtools-closed event', () => { + describe('devtools-closed event', () => { it('should fire when webview.closeDevTools() is called', async () => { loadWebView(webview, { src: `file://${fixtures}/pages/base-page.html` @@ -742,8 +740,7 @@ describe(' tag', function () { }) }) - // TODO(alexeykuzmin): Enable the tests. - xdescribe('devtools-focused event', () => { + describe('devtools-focused event', () => { it('should fire when webview.openDevTools() is called', async () => { loadWebView(webview, { src: `file://${fixtures}/pages/base-page.html` @@ -1212,10 +1209,7 @@ describe(' tag', function () { }) }) - // TODO(alexeykuzmin): Enable the test. - // The app crashes if this test and "devtools-opened event" tests - // are run at the same time. - xit('loads devtools extensions registered on the parent window', async () => { + it('loads devtools extensions registered on the parent window', async () => { const w = await openTheWindow({ show: false }) BrowserWindow.removeDevToolsExtension('foo')