Changeset 96416 in webkit
- Timestamp:
- Sep 30, 2011 1:04:57 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r96414 r96416 1 2011-09-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 3 [Qt] Make sure WTR sizes the window and item correctly 4 5 Revision 96345 changed the logic for how the view and 6 window was created, but missed a vital part, setting 7 the size. 8 9 We now use a QSGView for the window, that has a simple 10 item as its root object that is always resized to fit 11 within the window. The webview is then parented to the 12 root object and set to anchors.fill: parent. That way 13 any window geometry changes will propagate to the web 14 view. 15 16 https://bugs.webkit.org/show_bug.cgi?id=69134 17 18 Reviewed by Andreas Kling. 19 20 * WebKitTestRunner/PlatformWebView.h: 21 * WebKitTestRunner/qt/PlatformWebViewQt.cpp: 22 1 23 2011-09-30 Raphael Kubo da Costa <kubo@profusion.mobi> 2 24 -
trunk/Tools/WebKitTestRunner/PlatformWebView.h
r96345 r96416 30 30 class QDesktopWebView; 31 31 typedef QDesktopWebView* PlatformWKView; 32 class QSG Canvas;33 typedef QSG Canvas* PlatformWindow;32 class QSGView; 33 typedef QSGView* PlatformWindow; 34 34 #elif defined(__APPLE__) && __APPLE__ 35 35 #if __OBJC__ -
trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp
r96345 r96416 31 31 32 32 #include <QApplication> 33 #include <QtDeclarative/qsgcanvas.h> 33 #include <QDeclarativeProperty> 34 #include <QSGView> 34 35 35 36 namespace WTR { 36 37 38 class WrapperWindow : public QSGView { 39 Q_OBJECT 40 public: 41 WrapperWindow(QSGItem* view) 42 : QSGView(QUrl("data:text/plain,import QtQuick 2.0\nItem { objectName: 'root' }")) 43 , m_view(view) 44 { 45 connect(this, SIGNAL(statusChanged(QSGView::Status)), SLOT(handleStatusChanged(QSGView::Status))); 46 } 47 48 private slots: 49 void handleStatusChanged(QSGView::Status status) 50 { 51 if (status != QSGView::Ready) 52 return; 53 54 setGeometry(0, 0, 800, 600); 55 setResizeMode(QSGView::SizeRootObjectToView); 56 57 m_view->setParentItem(rootObject()); 58 QDeclarativeProperty::write(m_view, "anchors.fill", qVariantFromValue(rootObject())); 59 60 QFocusEvent ev(QEvent::WindowActivate); 61 QApplication::sendEvent(m_view, &ev); 62 m_view->setFocus(Qt::OtherFocusReason); 63 } 64 65 private: 66 QSGItem* m_view; 67 }; 68 37 69 PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef) 38 70 : m_view(new QDesktopWebView(contextRef, pageGroupRef)) 39 , m_window(new QSGCanvas)71 , m_window(new WrapperWindow(m_view)) 40 72 { 41 m_view->setParent(m_window->rootItem());42 m_window->setGeometry(0, 0, 800, 600);43 44 QFocusEvent ev(QEvent::WindowActivate);45 QApplication::sendEvent(m_view, &ev);46 m_view->setFocus(Qt::OtherFocusReason);47 73 } 48 74 … … 94 120 95 121 } // namespace WTR 122 123 #include "PlatformWebViewQt.moc"
Note: See TracChangeset
for help on using the changeset viewer.