Commit d786bbdc authored by Dawit Alemayehu's avatar Dawit Alemayehu
Browse files

Workaround QtWebKit 2.3's behavior change when emitting 'QWebPage::geometryChangeRequested'.

For some reason it now sends a default width and height of 100 on new window creation even
when the site did not specify those dimensions.

NOTE: This workaround will cause a regression if a site attempts to create a popup window
using Javascripts with the following parameters: x=0,y=0,width=100,height=100. Under that
circumstance, the window will end up being created as another tab in konqueror instead of
a popup window.

BUG: 313005
FIXED-IN: 1.3 branch
parent 292f32fd
......@@ -944,9 +944,23 @@ bool NewWindowPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequ
return WebPage::acceptNavigationRequest(frame, request, type);
}
/** TODO: Figure out if there is a way for QtWebKit to actually tell
* us whether we should create a popup window (dialog) or a regular
* new window. Right now that is simply broken because the parameter
* passed to QWebPage::createWindow is hard-coded in QtWebKit's code!
*/
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
static bool shouldApplyQtWebKit23Workaround(const QRect &rect)
{
return (rect.x() == 0 &&
rect.y() == 0 &&
rect.width() == 100 &&
rect.height() == 100);
}
#endif
void NewWindowPage::slotGeometryChangeRequested(const QRect & rect)
{
//kDebug() << rect;
if (!rect.isValid())
return;
......@@ -955,6 +969,12 @@ void NewWindowPage::slotGeometryChangeRequested(const QRect & rect)
return;
}
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
else if (shouldApplyQtWebKit23Workaround(rect)) {
return;
}
#endif
m_windowArgs.setX(rect.x());
m_windowArgs.setY(rect.y());
m_windowArgs.setWidth(qMax(rect.width(), 100));
......
Supports Markdown
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