From 8b19cd5bc014da15a2b78bc1b726916ddfb9e5e9 Mon Sep 17 00:00:00 2001 From: Alan Hoffmeister Date: Sat, 4 Mar 2017 02:46:10 -0300 Subject: [PATCH 1/3] Trigger WindowEvent::Resize when resizing in headless mode --- ports/glutin/window.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 79582972de71..4e685cedf74c 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -834,7 +834,10 @@ impl WindowMethods for Window { WindowKind::Window(ref window) => { window.set_inner_size(size.width as u32, size.height as u32) } - WindowKind::Headless(..) => {} + WindowKind::Headless(..) => { + let dimensions = TypedSize2D::new(size.width as u32, size.height as u32); + self.event_queue.borrow_mut().push(WindowEvent::Resize(dimensions)); + } } } From bafdbbd5737580200488b070df90bba1674a04cd Mon Sep 17 00:00:00 2001 From: Alan Hoffmeister Date: Sat, 4 Mar 2017 12:48:59 -0300 Subject: [PATCH 2/3] Implement WPT tests for windows.onresize --- tests/wpt/mozilla/meta/MANIFEST.json | 10 ++++++++++ tests/wpt/mozilla/tests/mozilla/resizeTo.html | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/wpt/mozilla/tests/mozilla/resizeTo.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 8fdbc6e596e0..750f7f022660 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -19540,6 +19540,12 @@ {} ] ], + "mozilla/resizeTo.html": [ + [ + "/_mozilla/mozilla/resizeTo.html", + {} + ] + ], "mozilla/response-data-brotli.htm": [ [ "/_mozilla/mozilla/response-data-brotli.htm", @@ -30923,6 +30929,10 @@ "df273cf90396cc2d3d3159ce72176122ab9518e5", "support" ], + "mozilla/resizeTo.html": [ + "d5e1649c88102f27da5fe1ac16715cfee7f70f84", + "testharness" + ], "mozilla/resources/background-green.css": [ "bb230110dd1cf4647e020d7172bc375e972c7b41", "support" diff --git a/tests/wpt/mozilla/tests/mozilla/resizeTo.html b/tests/wpt/mozilla/tests/mozilla/resizeTo.html new file mode 100644 index 000000000000..18cd6f77d4ab --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/resizeTo.html @@ -0,0 +1,14 @@ + + + + + + From 3bf1ede3aab14e470100653171a533533aa8d0a4 Mon Sep 17 00:00:00 2001 From: Alan Hoffmeister Date: Sun, 5 Mar 2017 02:48:05 -0300 Subject: [PATCH 3/3] Ensure innerWidth and innerHeight equals new dimensions --- tests/wpt/mozilla/meta/MANIFEST.json | 2 +- tests/wpt/mozilla/tests/mozilla/resizeTo.html | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 750f7f022660..f6b53a5a8ed9 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -30930,7 +30930,7 @@ "support" ], "mozilla/resizeTo.html": [ - "d5e1649c88102f27da5fe1ac16715cfee7f70f84", + "7baa224e1fefd5c288e5bf3a671bfdda13281e18", "testharness" ], "mozilla/resources/background-green.css": [ diff --git a/tests/wpt/mozilla/tests/mozilla/resizeTo.html b/tests/wpt/mozilla/tests/mozilla/resizeTo.html index 18cd6f77d4ab..104f6c92468b 100644 --- a/tests/wpt/mozilla/tests/mozilla/resizeTo.html +++ b/tests/wpt/mozilla/tests/mozilla/resizeTo.html @@ -6,6 +6,8 @@