+2011-09-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ [Qt] Make sure WTR sizes the window and item correctly
+
+ Revision 96345 changed the logic for how the view and
+ window was created, but missed a vital part, setting
+ the size.
+
+ We now use a QSGView for the window, that has a simple
+ item as its root object that is always resized to fit
+ within the window. The webview is then parented to the
+ root object and set to anchors.fill: parent. That way
+ any window geometry changes will propagate to the web
+ view.
+
+ https://bugs.webkit.org/show_bug.cgi?id=69134
+
+ Reviewed by Andreas Kling.
+
+ * WebKitTestRunner/PlatformWebView.h:
+ * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+
2011-09-30 Raphael Kubo da Costa <kubo@profusion.mobi>
[EFL] Only save the current viewport in PixelDumpSupportEfl.
#include "qdesktopwebview.h"
#include <QApplication>
-#include <QtDeclarative/qsgcanvas.h>
+#include <QDeclarativeProperty>
+#include <QSGView>
namespace WTR {
+class WrapperWindow : public QSGView {
+ Q_OBJECT
+public:
+ WrapperWindow(QSGItem* view)
+ : QSGView(QUrl("data:text/plain,import QtQuick 2.0\nItem { objectName: 'root' }"))
+ , m_view(view)
+ {
+ connect(this, SIGNAL(statusChanged(QSGView::Status)), SLOT(handleStatusChanged(QSGView::Status)));
+ }
+
+private slots:
+ void handleStatusChanged(QSGView::Status status)
+ {
+ if (status != QSGView::Ready)
+ return;
+
+ setGeometry(0, 0, 800, 600);
+ setResizeMode(QSGView::SizeRootObjectToView);
+
+ m_view->setParentItem(rootObject());
+ QDeclarativeProperty::write(m_view, "anchors.fill", qVariantFromValue(rootObject()));
+
+ QFocusEvent ev(QEvent::WindowActivate);
+ QApplication::sendEvent(m_view, &ev);
+ m_view->setFocus(Qt::OtherFocusReason);
+ }
+
+private:
+ QSGItem* m_view;
+};
+
PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
: m_view(new QDesktopWebView(contextRef, pageGroupRef))
- , m_window(new QSGCanvas)
+ , m_window(new WrapperWindow(m_view))
{
- m_view->setParent(m_window->rootItem());
- m_window->setGeometry(0, 0, 800, 600);
-
- QFocusEvent ev(QEvent::WindowActivate);
- QApplication::sendEvent(m_view, &ev);
- m_view->setFocus(Qt::OtherFocusReason);
}
PlatformWebView::~PlatformWebView()
}
} // namespace WTR
+
+#include "PlatformWebViewQt.moc"