Title: [96416] trunk/Tools
- Revision
- 96416
- Author
- [email protected]
- Date
- 2011-09-30 13:04:57 -0700 (Fri, 30 Sep 2011)
Log Message
[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.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (96415 => 96416)
--- trunk/Tools/ChangeLog 2011-09-30 20:01:38 UTC (rev 96415)
+++ trunk/Tools/ChangeLog 2011-09-30 20:04:57 UTC (rev 96416)
@@ -1,3 +1,25 @@
+2011-09-30 Tor Arne Vestbø <[email protected]>
+
+ [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 <[email protected]>
[EFL] Only save the current viewport in PixelDumpSupportEfl.
Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (96415 => 96416)
--- trunk/Tools/WebKitTestRunner/PlatformWebView.h 2011-09-30 20:01:38 UTC (rev 96415)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h 2011-09-30 20:04:57 UTC (rev 96416)
@@ -29,8 +29,8 @@
#if defined(BUILDING_QT__)
class QDesktopWebView;
typedef QDesktopWebView* PlatformWKView;
-class QSGCanvas;
-typedef QSGCanvas* PlatformWindow;
+class QSGView;
+typedef QSGView* PlatformWindow;
#elif defined(__APPLE__) && __APPLE__
#if __OBJC__
@class WKView;
Modified: trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp (96415 => 96416)
--- trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp 2011-09-30 20:01:38 UTC (rev 96415)
+++ trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp 2011-09-30 20:04:57 UTC (rev 96416)
@@ -30,20 +30,46 @@
#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()
@@ -93,3 +119,5 @@
}
} // namespace WTR
+
+#include "PlatformWebViewQt.moc"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes