2010-10-06 Balazs Kelemen <kbalazs@webkit.org>
authorabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Oct 2010 23:00:44 +0000 (23:00 +0000)
committerabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Oct 2010 23:00:44 +0000 (23:00 +0000)
        Reviewed by Kenneth Rohde Christiansen.

        [Qt] PlatformWebView implementation for WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=47276

        The implementation follows the way how
        we use the API in MiniBrowser.
        * WebKitTestRunner/PlatformWebView.h:
        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
        (WTR::WebView::wkView):
        (WTR::WebView::~WebView):
        (WTR::WebView::WebView):
        (WTR::PlatformWebView::PlatformWebView):
        (WTR::PlatformWebView::~PlatformWebView):
        (WTR::PlatformWebView::resizeTo):
        (WTR::PlatformWebView::page):
        (WTR::PlatformWebView::focus):
        * WebKitTestRunner/qt/WebKitTestRunner.pro:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/PlatformWebView.h
WebKitTools/WebKitTestRunner/qt/PlatformWebViewQt.cpp
WebKitTools/WebKitTestRunner/qt/WebKitTestRunner.pro

index 9f0f112..964b346 100644 (file)
@@ -2,6 +2,27 @@
 
         Reviewed by Kenneth Rohde Christiansen.
 
+        [Qt] PlatformWebView implementation for WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=47276
+
+        The implementation follows the way how
+        we use the API in MiniBrowser.
+        * WebKitTestRunner/PlatformWebView.h:
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+        (WTR::WebView::wkView):
+        (WTR::WebView::~WebView):
+        (WTR::WebView::WebView):
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::~PlatformWebView):
+        (WTR::PlatformWebView::resizeTo):
+        (WTR::PlatformWebView::page):
+        (WTR::PlatformWebView::focus):
+        * WebKitTestRunner/qt/WebKitTestRunner.pro:
+
+2010-10-06  Balazs Kelemen  <kbalazs@webkit.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
         [Qt] Add WebKitTestRunner's build files
         https://bugs.webkit.org/show_bug.cgi?id=44155
 
index 83c34b4..d586d1b 100644 (file)
@@ -40,8 +40,12 @@ typedef NSWindow* PlatformWindow;
 typedef WKViewRef PlatformWKView;
 typedef HWND PlatformWindow;
 #elif defined(BUILDING_QT__)
-typedef void* PlatformWKView;
-typedef void* PlatformWindow;
+namespace WTR {
+class WebView;
+}
+typedef WTR::WebView* PlatformWKView;
+class QMainWindow;
+typedef QMainWindow* PlatformWindow;
 #endif
 
 namespace WTR {
index de9389a..4aafceb 100644 (file)
  */
 
 #include "PlatformWebView.h"
-#include "NotImplemented.h"
+#include "qgraphicswkview.h"
+#include <QtGui>
 
 namespace WTR {
 
+class WebView : public QGraphicsView {
+public:
+    WebView(WKPageNamespaceRef);
+
+    QGraphicsWKView* wkView() const { return m_item; }
+
+    virtual ~WebView() { delete m_item; }
+
+private:
+    QGraphicsWKView* m_item;
+};
+
+WebView::WebView(WKPageNamespaceRef namespaceRef)
+    : QGraphicsView()
+    , m_item(new QGraphicsWKView(namespaceRef))
+{
+    setScene(new QGraphicsScene(this));
+    scene()->addItem(m_item);
+}
+
 PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
+    : m_view(new WebView(namespaceRef))
+    , m_window(new QMainWindow())
 {
-    notImplemented();
+    m_view->setParent(m_window);
+    m_window->setCentralWidget(m_view);
+    m_window->setGeometry(0, 0, 800, 600);
 }
 
 PlatformWebView::~PlatformWebView()
 {
+    delete m_window;
 }
 
 void PlatformWebView::resizeTo(unsigned width, unsigned height)
 {
-    notImplemented();
+    m_window->resize(width, height);
 }
 
 WKPageRef PlatformWebView::page()
 {
-    notImplemented();
-    return 0;
+    return m_view->wkView()->page()->pageRef();
 }
 
 void PlatformWebView::focus()
 {
-    notImplemented();
+    m_view->setFocus(Qt::OtherFocusReason);
 }
 
 } // namespace WTR
index 6404b86..b1ac70e 100644 (file)
@@ -19,6 +19,7 @@ INCLUDEPATH += \
     $$BASEDIR/../../JavaScriptCore \
     $$BASEDIR/../../WebKit2 \
     $$BASEDIR/../../WebKit2/Shared \
+    $$BASEDIR/../../WebKit2/UIProcess/API/qt \
 
 INCLUDEPATH += \
     $$OUTPUT_DIR/include \