[Qt] window.open passes height and width parameters even if not defined in a page

https://bugs.webkit.org/show_bug.cgi?id=107705

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Do not override width or height of 0, as that indicates default size, and not minimum size.

Tested by tst_qwebpage.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):

Source/WebKit/efl:

Do not resize window when default size is requested.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::setWindowRect):

Source/WebKit/gtk:

Do not resize window when default size is requested.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::setWindowRect):

Source/WebKit/qt:

Test that minimum size is applied only when the requested size is too small,
not when default is requested.

* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage):
(TestPage):
(TestPage::TestPage):
(TestPage::createWindow):
(TestPage::slotGeometryChangeRequested):
(tst_QWebPage::openWindowDefaultSize):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142755 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 34ffc56f
2013-02-13 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] window.open passes height and width parameters even if not defined in a page
https://bugs.webkit.org/show_bug.cgi?id=107705
Reviewed by Kenneth Rohde Christiansen.
Do not override width or height of 0, as that indicates default size, and not minimum size.
Tested by tst_qwebpage.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):
2013-02-13 Rashmi Shyamasundar <rashmi.s2@samsung.com>
The 2D Canvas functions fillText()/strokeText() should display nothing when maxWidth is less then or equal to zero
......@@ -341,8 +341,11 @@ FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
window.setHeight(pendingChanges.height());
FloatSize minimumSize = page->chrome()->client()->minimumWindowSize();
window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
// 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()));
// Constrain the window position within the valid screen area.
window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
......
2013-02-13 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] window.open passes height and width parameters even if not defined in a page
https://bugs.webkit.org/show_bug.cgi?id=107705
Reviewed by Kenneth Rohde Christiansen.
Do not resize window when default size is requested.
* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::setWindowRect):
2013-02-12 Huang Dongsung <luxtella@company100.net>
[TexMap] Apply frames-per-second debug counter to WK1.
......
......@@ -128,7 +128,7 @@ FloatRect ChromeClientEfl::windowRect()
void ChromeClientEfl::setWindowRect(const FloatRect& rect)
{
if (!ewk_view_setting_enable_auto_resize_window_get(m_view))
if (!ewk_view_setting_enable_auto_resize_window_get(m_view) || rect.isEmpty())
return;
Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_view));
......
2013-02-13 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] window.open passes height and width parameters even if not defined in a page
https://bugs.webkit.org/show_bug.cgi?id=107705
Reviewed by Kenneth Rohde Christiansen.
Do not resize window when default size is requested.
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::setWindowRect):
2013-02-13 Andrew Wilson <atwilson@chromium.org>
Unreviewed Chromium gyp-file cleanup after glib backend removal.
......
......@@ -142,7 +142,8 @@ void ChromeClient::setWindowRect(const FloatRect& rect)
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
if (widgetIsOnscreenToplevelWindow(window)) {
gtk_window_move(GTK_WINDOW(window), intrect.x(), intrect.y());
gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height());
if (!intrect.isEmpty())
gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height());
}
}
......
2013-02-13 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] window.open passes height and width parameters even if not defined in a page
https://bugs.webkit.org/show_bug.cgi?id=107705
Reviewed by Kenneth Rohde Christiansen.
Test that minimum size is applied only when the requested size is too small,
not when default is requested.
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage):
(TestPage):
(TestPage::TestPage):
(TestPage::createWindow):
(TestPage::slotGeometryChangeRequested):
(tst_QWebPage::openWindowDefaultSize):
2013-02-12 Huang Dongsung <luxtella@company100.net>
[TexMap] Apply frames-per-second debug counter to WK1.
......
......@@ -186,6 +186,7 @@ private Q_SLOTS:
void renderOnRepaintRequestedShouldNotRecurse();
void loadSignalsOrder_data();
void loadSignalsOrder();
void openWindowDefaultSize();
#ifdef Q_OS_MAC
void macCopyUnicodeToClipboard();
......@@ -410,10 +411,13 @@ void tst_QWebPage::consoleOutput()
QCOMPARE(page.lineNumbers.at(0), 1);
}
class TestPage : public QWebPage
{
class TestPage : public QWebPage {
Q_OBJECT
public:
TestPage(QObject* parent = 0) : QWebPage(parent) {}
TestPage(QObject* parent = 0) : QWebPage(parent)
{
connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
}
struct Navigation {
QPointer<QWebFrame> frame;
......@@ -422,7 +426,8 @@ public:
};
QList<Navigation> navigations;
QList<QWebPage*> createdWindows;
QList<TestPage*> createdWindows;
QRect requestedGeometry;
virtual bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type) {
Navigation n;
......@@ -434,10 +439,15 @@ public:
}
virtual QWebPage* createWindow(WebWindowType) {
QWebPage* page = new TestPage(this);
TestPage* page = new TestPage(this);
createdWindows.append(page);
return page;
}
private Q_SLOTS:
void slotGeometryChangeRequested(const QRect& geom) {
requestedGeometry = geom;
}
};
void tst_QWebPage::popupFormSubmission()
......@@ -3252,5 +3262,29 @@ void tst_QWebPage::undoActionHaveCustomText()
QVERIFY(typingActionText != alignActionText);
}
void tst_QWebPage::openWindowDefaultSize()
{
TestPage page;
page.settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
// Open a default window.
page.mainFrame()->evaluateJavaScript("window.open()");
// Open a too small window.
page.mainFrame()->evaluateJavaScript("window.open('', '', 'width=10,height=10')");
QTest::qWait(500);
// The number of popups created should be two.
QVERIFY(page.createdWindows.size() == 2);
QRect requestedGeometry = page.createdWindows[0]->requestedGeometry;
// Check default size has been requested.
QVERIFY(requestedGeometry.width() == 0);
QVERIFY(requestedGeometry.height() == 0);
requestedGeometry = page.createdWindows[1]->requestedGeometry;
// Check minimum size has been requested.
QVERIFY(requestedGeometry.width() == 100);
QVERIFY(requestedGeometry.height() == 100);
}
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment