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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index ffdb38b..0885acd 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -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.