Title: [153913] trunk
Revision
153913
Author
a...@apple.com
Date
2013-08-09 16:25:11 -0700 (Fri, 09 Aug 2013)

Log Message

REGRESSION (r142755): window.open creates an invisible window when width and height are 0
https://bugs.webkit.org/show_bug.cgi?id=119633

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/dom/Window/open-zero-size-as-default.html

Relying on each WebKit to refuse setting size to zero was fragile - because this
required each one to have the check, and because by the time the client was called,
the initially zero size was not necessarily zero.

* loader/FrameLoader.cpp: (WebCore::createWindow): When sizes are zero, keep the
size the window was created with, because that's the default one by definition.

* page/DOMWindow.cpp: (WebCore::DOMWindow::adjustWindowRect): It's too late to
check for zero size now, it's been mangled to adjust for the difference between
window and viewport size.

Source/WebKit/efl:

* WebCoreSupport/ChromeClientEfl.cpp: (WebCore::ChromeClientEfl::setWindowRect):
Once again, the passed rect cannot be empty.

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp: (WebKit::ChromeClient::setWindowRect):
Once again, the passed rect cannot be empty.

LayoutTests:

* fast/dom/Window/open-zero-size-as-default-expected.txt: Added.
* fast/dom/Window/open-zero-size-as-default.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153912 => 153913)


--- trunk/LayoutTests/ChangeLog	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/LayoutTests/ChangeLog	2013-08-09 23:25:11 UTC (rev 153913)
@@ -1,5 +1,15 @@
 2013-08-09  Alexey Proskuryakov  <a...@apple.com>
 
+        REGRESSION (r142755): window.open creates an invisible window when width and height are 0
+        https://bugs.webkit.org/show_bug.cgi?id=119633
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/Window/open-zero-size-as-default-expected.txt: Added.
+        * fast/dom/Window/open-zero-size-as-default.html: Added.
+
+2013-08-09  Alexey Proskuryakov  <a...@apple.com>
+
         http/tests/navigation/back-twice-without-commit.html times out
         https://bugs.webkit.org/show_bug.cgi?id=82980
 

Added: trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default-expected.txt (0 => 153913)


--- trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default-expected.txt	2013-08-09 23:25:11 UTC (rev 153913)
@@ -0,0 +1,3 @@
+Test that passing "height=0,width=0" to window.open() results in default window size.
+
+PASS

Added: trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default.html (0 => 153913)


--- trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/open-zero-size-as-default.html	2013-08-09 23:25:11 UTC (rev 153913)
@@ -0,0 +1,32 @@
+<html>
+<body>
+<p>Test that passing "height=0,width=0" to window.open() results in default window size.</p>
+<div id=result></div>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+}
+
+var result = document.getElementById("result");
+
+window.addEventListener("message", function (e) {
+    try {
+        var dimensions = JSON.parse(e.data);
+        if (dimensions[0] > 100 && dimensions[1] > 100)
+            result.innerHTML = "PASS";
+        else
+            result.innerHTML = "FAIL: " + e.data;
+    } catch (ex) {
+        alert("FAIL: " + ex + " (" + e.data + ")");
+    }
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+
+window.open("data:text/html,<script>opener.postMessage('[' + window.innerWidth + ',' + window.innerHeight + ']', '*'); window.close();<" + "/script>", "", "height=0,width=0");
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (153912 => 153913)


--- trunk/Source/WebCore/ChangeLog	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebCore/ChangeLog	2013-08-09 23:25:11 UTC (rev 153913)
@@ -1,3 +1,23 @@
+2013-08-09  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r142755): window.open creates an invisible window when width and height are 0
+        https://bugs.webkit.org/show_bug.cgi?id=119633
+
+        Reviewed by Darin Adler.
+
+        Test: fast/dom/Window/open-zero-size-as-default.html
+
+        Relying on each WebKit to refuse setting size to zero was fragile - because this
+        required each one to have the check, and because by the time the client was called,
+        the initially zero size was not necessarily zero.
+
+        * loader/FrameLoader.cpp: (WebCore::createWindow): When sizes are zero, keep the
+        size the window was created with, because that's the default one by definition.
+
+        * page/DOMWindow.cpp: (WebCore::DOMWindow::adjustWindowRect): It's too late to
+        check for zero size now, it's been mangled to adjust for the difference between
+        window and viewport size.
+
 2013-08-09  Eric Carlson  <eric.carl...@apple.com>
 
         [Mac] some track language tags are not recognized

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (153912 => 153913)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-08-09 23:25:11 UTC (rev 153913)
@@ -3452,9 +3452,10 @@
         windowRect.setX(features.x);
     if (features.ySet)
         windowRect.setY(features.y);
-    if (features.widthSet)
+    // Zero width and height mean using default size, not minumum one.
+    if (features.widthSet && features.width)
         windowRect.setWidth(features.width + (windowRect.width() - viewportSize.width()));
-    if (features.heightSet)
+    if (features.heightSet && features.height)
         windowRect.setHeight(features.height + (windowRect.height() - viewportSize.height()));
 
     // Ensure non-NaN values, minimum size as well as being within valid screen area.

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (153912 => 153913)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2013-08-09 23:25:11 UTC (rev 153913)
@@ -340,11 +340,8 @@
         window.setHeight(pendingChanges.height());
 
     FloatSize minimumSize = page->chrome().client()->minimumWindowSize();
-    // Let size 0 pass through, since that indicates default size, not minimum size.
-    if (window.width())
-        window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
-    if (window.height())
-        window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
+    window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
+    window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
 
     // Constrain the window position within the valid screen area.
     window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));

Modified: trunk/Source/WebKit/efl/ChangeLog (153912 => 153913)


--- trunk/Source/WebKit/efl/ChangeLog	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebKit/efl/ChangeLog	2013-08-09 23:25:11 UTC (rev 153913)
@@ -1,3 +1,13 @@
+2013-08-09  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r142755): window.open creates an invisible window when width and height are 0
+        https://bugs.webkit.org/show_bug.cgi?id=119633
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/ChromeClientEfl.cpp: (WebCore::ChromeClientEfl::setWindowRect):
+        Once again, the passed rect cannot be empty.
+
 2013-07-27  Mark Rowe  <mr...@apple.com>
 
         Logging should be configurable using human-readable channel names rather than crazy bitmasks

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (153912 => 153913)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2013-08-09 23:25:11 UTC (rev 153913)
@@ -128,7 +128,7 @@
 
 void ChromeClientEfl::setWindowRect(const FloatRect& rect)
 {
-    if (!ewk_view_setting_enable_auto_resize_window_get(m_view) || rect.isEmpty())
+    if (!ewk_view_setting_enable_auto_resize_window_get(m_view))
         return;
 
     Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_view));

Modified: trunk/Source/WebKit/gtk/ChangeLog (153912 => 153913)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-08-09 23:25:11 UTC (rev 153913)
@@ -1,3 +1,13 @@
+2013-08-09  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r142755): window.open creates an invisible window when width and height are 0
+        https://bugs.webkit.org/show_bug.cgi?id=119633
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/ChromeClientGtk.cpp: (WebKit::ChromeClient::setWindowRect):
+        Once again, the passed rect cannot be empty.
+
 2013-07-27  Mark Rowe  <mr...@apple.com>
 
         Logging should be configurable using human-readable channel names rather than crazy bitmasks

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (153912 => 153913)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2013-08-09 23:09:10 UTC (rev 153912)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2013-08-09 23:25:11 UTC (rev 153913)
@@ -171,8 +171,7 @@
     GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
     if (widgetIsOnscreenToplevelWindow(window)) {
         gtk_window_move(GTK_WINDOW(window), intrect.x(), intrect.y());
-        if (!intrect.isEmpty())
-            gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height());
+        gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height());
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to