Added the start of a public API to the Qt build
authorlars <lars@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jan 2007 15:03:44 +0000 (15:03 +0000)
committerlars <lars@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jan 2007 15:03:44 +0000 (15:03 +0000)
        of WebKit. Currently we have QWebPage and QWebFrame
        with a few small methods.

        Converted the QtLauncher and DumpRenderTree
        to use the new public API.

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

32 files changed:
ChangeLog
WebCore/ChangeLog
WebCore/WebCore.pro
WebCore/platform/ScrollView.h
WebCore/platform/Widget.h
WebCore/platform/network/qt/ResourceHandleManagerQt.cpp
WebCore/platform/qt/ScrollViewCanvasQt.cpp
WebCore/platform/qt/ScrollViewCanvasQt.h
WebCore/platform/qt/ScrollViewQt.cpp
WebCore/platform/qt/WidgetQt.cpp
WebKit.pri
WebKitQt/Api/qwebframe.cpp [new file with mode: 0644]
WebKitQt/Api/qwebframe.h [new file with mode: 0644]
WebKitQt/Api/qwebframe_p.h [new file with mode: 0644]
WebKitQt/Api/qwebpage.cpp [new file with mode: 0644]
WebKitQt/Api/qwebpage.h [new file with mode: 0644]
WebKitQt/Api/qwebpage_p.h [new file with mode: 0644]
WebKitQt/ChangeLog
WebKitQt/QtLauncher/main.cpp
WebKitQt/WebCoreSupport/ChromeClientQt.cpp
WebKitQt/WebCoreSupport/ChromeClientQt.h
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitQt/WebCoreSupport/FrameLoaderClientQt.h
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.h
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.pro
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.cpp [deleted file]
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.h [deleted file]
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/jsobjects.cpp
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/main.cpp
WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/tests-skipped.txt

index 32f36cf..ce9837f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-01-16  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Zack
+
+        Remove everything but the new public API from
+        the include path.
+
+        * WebKit.pri:
+
 2007-01-11  George Staikos  <staikos@kde.org>
 
         Fix the Qt build
index 19471e1..a36f1af 100644 (file)
@@ -2,6 +2,35 @@
 
         Reviewed by Zack
 
+        Cleaned up the way we create native widgets. They are
+        now not created in WebCore anymore, but in the new
+        Qt API to WebKit.
+
+        Fix a compile issue in the ResourceHandleManager.
+
+        * WebCore.pro:
+        * platform/ScrollView.h:
+        * platform/Widget.h:
+        (WebCore::ResourceHandleManager::cancel):
+        * platform/qt/ScrollViewCanvasQt.cpp:
+        (WebCore::ScrollViewCanvasQt::ScrollViewCanvasQt):
+        (WebCore::ScrollViewCanvasQt::paintEvent):
+        (WebCore::ScrollViewCanvasQt::mouseMoveEvent):
+        (WebCore::ScrollViewCanvasQt::mousePressEvent):
+        (WebCore::ScrollViewCanvasQt::mouseReleaseEvent):
+        (WebCore::ScrollViewCanvasQt::handleKeyEvent):
+        * platform/qt/ScrollViewCanvasQt.h:
+        * platform/qt/ScrollViewQt.cpp:
+        (WebCore::ScrollView::ScrollView):
+        (WebCore::ScrollView::setScrollArea):
+        (WebCore::ScrollView::addChild):
+        * platform/qt/WidgetQt.cpp:
+        * platform/network/qt/ResourceHandleManagerQt.cpp:
+
+2007-01-16  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Zack
+
         Looks like ResourceHandle _has_ to do everything
         asynchronously if we don't want to run into
         lots of trouble in the loader.
index 78d6c3d..1b7a544 100644 (file)
@@ -67,6 +67,7 @@ INCLUDEPATH +=  $$PWD \
                 $$PWD/ksvg2 $$PWD/ksvg2/css $$PWD/ksvg2/svg $$PWD/ksvg2/misc $$PWD/ksvg2/events \
                 $$PWD/platform/image-decoders \
                 $$PWD/../WebKitQt/WebCoreSupport \
+                $$PWD/../WebKitQt/Api \
                 $$PWD/WebCore+SVG
 QT += network
 !mac:CONFIG += link_pkgconfig
@@ -101,7 +102,9 @@ STYLESHEETS_EMBED = $$PWD/css/html4.css
 MANUALMOC += \
     $$PWD/platform/qt/SharedTimerQt.h \
     $$PWD/platform/qt/ScrollViewCanvasQt.h \
-    $$PWD/platform/network/qt/ResourceHandleManagerQt.h
+    $$PWD/platform/network/qt/ResourceHandleManagerQt.h \
+    $$PWD/../WebKitQt/Api/qwebpage.h \
+    $$PWD/../WebKitQt/Api/qwebframe.h
 
 LUT_FILES += \
     bindings/js/kjs_window.cpp \
@@ -671,7 +674,9 @@ SOURCES += \
     ../WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp \
     ../WebKitQt/WebCoreSupport/EditorClientQt.cpp \
     ../WebKitQt/WebCoreSupport/ChromeClientQt.cpp \
-    ../WebKitQt/WebCoreSupport/ContextMenuClientQt.cpp
+    ../WebKitQt/WebCoreSupport/ContextMenuClientQt.cpp \
+    ../WebKitQt/Api/qwebpage.cpp \
+    ../WebKitQt/Api/qwebframe.cpp
 
 contains(DEFINES, XPATH_SUPPORT=1) {
     FEATURE_DEFINES_JAVASCRIPT += XPATH_SUPPORT
index 43f8d20..b17e10c 100644 (file)
@@ -146,7 +146,7 @@ namespace WebCore {
         ScrollView();
         ~ScrollView();
 
-        virtual void setParentWidget(QWidget*);
+        void setScrollArea(QScrollArea*);
 
     private:
         QScrollArea* m_area;
index e429636..80be871 100644 (file)
@@ -149,9 +149,6 @@ namespace WebCore {
 #endif
 
 #if PLATFORM(QT)
-        QWidget* parentWidget() const;
-        virtual void setParentWidget(QWidget*);
-
         QWidget* qwidget();
         void setQWidget(QWidget*);
 #endif
index 74a8f70..625305a 100644 (file)
@@ -180,6 +180,9 @@ void ResourceHandleManager::cancel(ResourceHandle* resource)
 
     DEBUG() << "ResourceHandleManager::cancel" << resource->url().path();
     
+    RequestQt* request = pendingRequests[resource];
+    if (!request)
+        return;
     request->cancelled = true;
 
     String protocol = request->hostInfo.protocol;
index bf53a31..ab88877 100644 (file)
@@ -47,6 +47,7 @@
 #include <QPainter>
 #include <QPaintEvent>
 #include <QMouseEvent>
+#include <qdebug.h>
 
 
 //this output ms that it takes WebKit to render in each paint event
 
 namespace WebCore {
 
-ScrollViewCanvasQt::ScrollViewCanvasQt(ScrollView* frameView, QWidget* parent)
-    : QWidget(parent),
-      m_scrollView(frameView),
-      m_frameView(0)
+ScrollViewCanvasQt::ScrollViewCanvasQt(FrameView* frameView, QWidget* parent)
+    : QWidget(0),
+      m_frameView(frameView)
 {
     setMouseTracking(true);
     setFocusPolicy(Qt::StrongFocus);
-}
-
-bool ScrollViewCanvasQt::updateFrameView()
-{
-    m_frameView = static_cast<FrameView*>(m_scrollView);
-    if (!m_frameView || !m_frameView->frame())
-        return false;
-    return true;
+    resize(500, 500);
 }
 
 
 void ScrollViewCanvasQt::paintEvent(QPaintEvent* ev)
 {
-    if (!m_frameView) {
-        if (!updateFrameView() ||
-            !m_frameView->frame()->renderer())
-            return;
-    }
+    if (!m_frameView || !m_frameView->frame()->renderer())
+        return;
 
 #ifdef QWEBKIT_TIME_RENDERING
     QTime time;
@@ -109,30 +99,24 @@ void ScrollViewCanvasQt::paintEvent(QPaintEvent* ev)
 
 void ScrollViewCanvasQt::mouseMoveEvent(QMouseEvent* ev)
 {
-    if (!m_frameView) {
-        if (!updateFrameView())
-            return;
-    }
+    if (!m_frameView)
+        return;
 
     m_frameView->handleMouseMoveEvent(PlatformMouseEvent(ev, 0));
 }
 
 void ScrollViewCanvasQt::mousePressEvent(QMouseEvent* ev)
 {
-    if (!m_frameView) {
-        if (!updateFrameView() || !m_frameView->frame()->eventHandler())
-            return;
-    }
+    if (!m_frameView || !m_frameView->frame()->eventHandler())
+        return;
 
     m_frameView->frame()->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 1));
 }
 
 void ScrollViewCanvasQt::mouseReleaseEvent(QMouseEvent* ev)
 {
-    if (!m_frameView) {
-        if (!updateFrameView())
-            return;
-    }
+    if (!m_frameView) 
+        return;
 
     m_frameView->handleMouseReleaseEvent(PlatformMouseEvent(ev, 0));
 }
@@ -151,10 +135,9 @@ void ScrollViewCanvasQt::handleKeyEvent(QKeyEvent* ev, bool isKeyUp)
 {
     PlatformKeyboardEvent kevent(ev, isKeyUp);
 
-    if (!m_frameView) {
-        if (!updateFrameView())
-            return;
-    }
+    if (!m_frameView)
+        return;
+
     FrameQt* frame = static_cast<FrameQt*>(m_frameView->frame());
     if (!frame)
         return;
index fbf83c6..3ca431e 100644 (file)
@@ -46,7 +46,7 @@ class ScrollViewCanvasQt : public QWidget
 {
     Q_OBJECT
 public:
-    ScrollViewCanvasQt(ScrollView*, QWidget* parent = 0);
+    ScrollViewCanvasQt(FrameView*, QWidget* parent = 0);
 
 protected:
     virtual void paintEvent(QPaintEvent*);
@@ -58,9 +58,7 @@ protected:
 
 private:
     void handleKeyEvent(QKeyEvent*, bool isKeyUp);
-    bool updateFrameView();
 
-    ScrollView* m_scrollView;
     FrameView* m_frameView;
 };
 
index 4050acc..2801e26 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "config.h"
 #include "ScrollView.h"
+#include "FrameView.h"
 #include "FloatRect.h"
 #include "IntPoint.h"
 
 namespace WebCore {
 
 ScrollView::ScrollView()
-    : m_area(new QScrollArea(0))
+    : m_area(0)
 {
-    ScrollViewCanvasQt* canvas = new ScrollViewCanvasQt(this, m_area);
-
-    setQWidget(m_area);
-    m_area->setWidget(canvas);
 }
 
 ScrollView::~ScrollView()
 {
 }
 
-void ScrollView::setParentWidget(QWidget* parent)
+void ScrollView::setScrollArea(QScrollArea* area)
 {
-    Widget::setParentWidget(parent);
+    m_area = area;
+    if (isFrameView()) {
+        ScrollViewCanvasQt* canvas = new ScrollViewCanvasQt(static_cast<FrameView*>(this), m_area);
+        m_area->setWidget(canvas);
+    }
+    Widget::setQWidget(area);
 }
 
 void ScrollView::updateContents(const IntRect& updateRect, bool now)
@@ -228,10 +230,11 @@ void ScrollView::setStaticBackground(bool flag)
 
 void ScrollView::addChild(Widget* child)
 {
-    Q_ASSERT(child != 0);
-    Q_ASSERT(m_area && m_area->widget());
+    notImplemented();
+//     Q_ASSERT(child != 0);
+//     Q_ASSERT(m_area && m_area->widget());
 
-    child->setParentWidget(m_area->widget());
+//     child->setParentWidget(m_area->widget());
 }
 
 void ScrollView::removeChild(Widget*)
index d81fd7a..129b08a 100644 (file)
@@ -149,16 +149,6 @@ QWidget* Widget::qwidget()
     return data->m_widget;
 }
 
-void Widget::setParentWidget(QWidget* parent)
-{
-    data->m_parent = parent;
-}
-
-QWidget* Widget::parentWidget() const
-{
-    return data->m_parent;
-}
-
 void Widget::setFrameGeometry(const IntRect& r)
 {
     if (!data->m_widget)
index c8aa797..3360306 100644 (file)
@@ -1,23 +1,6 @@
 # Include file to make it easy to include WebKit into Qt projects
 
-INCLUDEPATH += $$PWD/JavaScriptCore \
-               $$PWD/WebCore \
-               $$PWD/WebCore/platform \
-               $$PWD/WebCore/platform/qt \
-               $$PWD/WebCore/platform/network \
-               $$PWD/WebCore/platform/graphics \
-               $$PWD/WebCore/editing \
-               $$PWD/WebCore/page \
-               $$PWD/WebCore/page/qt \
-               $$PWD/WebCore/dom \
-               $$PWD/WebCore/html \
-               $$PWD/WebCore/history \
-               $$PWD/WebCore/rendering \
-               $$PWD/WebCore/loader \
-               $$PWD/WebCore/loader/qt \
-               $$PWD/WebCore/css \
-               $$PWD/WebCore/bridge \
-               $$PWD/WebKitQt/WebCoreSupport
+INCLUDEPATH += $$PWD/WebKitQt/Api 
 
 DEFINES += BUILDING_QT__=1
 
diff --git a/WebKitQt/Api/qwebframe.cpp b/WebKitQt/Api/qwebframe.cpp
new file mode 100644 (file)
index 0000000..d12be7e
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+#include "qwebframe.h"
+#include "qwebpage.h"
+#include "qwebpage_p.h"
+#include "qwebframe_p.h"
+
+#include <qdebug.h>
+
+#include "FrameLoaderClientQt.h"
+#include "FrameQtClient.h"
+#include "FrameQt.h"
+#include "FrameView.h"
+
+#include "markup.h"
+#include "RenderTreeAsText.h"
+#include "Element.h"
+#include "Document.h"
+
+#include "bindings/runtime.h"
+#include "bindings/runtime_root.h"
+#include "ExecState.h"
+#include "object.h"
+
+
+using namespace WebCore;
+
+QWebFrame::QWebFrame(QWebPage *parent)
+    : QScrollArea(parent)
+    , d(new QWebFramePrivate)
+{
+    d->frameLoaderClient = new FrameLoaderClientQt();
+    d->frame = new FrameQt(parent->d->page, 0, new FrameQtClient(), d->frameLoaderClient);
+    d->frameLoaderClient->setFrame(this, d->frame);
+
+    d->frameView = new FrameView(d->frame);
+    d->frameView->setScrollArea(this);
+    d->frame->setView(d->frameView);
+}
+
+
+QWebFrame::QWebFrame(QWebFrame *parent)
+    : QScrollArea(parent)
+    , d(new QWebFramePrivate)
+{
+//     d->frameLoaderClient = new FrameLoaderClientQt();
+//     d->frame = new FrameQt(page, 0, new FrameQtClient(), frameLoaderClient);
+//     d->frameLoaderClient->setFrame(d->frame);
+
+//     d->frameView = new FrameView(d->frame);
+//     d->frameView->setScrollArea(this);
+//     d->frame->setView(d->frameView);
+}
+
+QWebFrame::~QWebFrame()
+{
+    delete d->frame;
+}
+
+void QWebFrame::addToJSWindowObject(const QByteArray &name, QObject *object)
+{
+    KJS::Bindings::RootObject *root = d->frame->bindingRootObject();
+    KJS::ExecState *exec = root->interpreter()->globalExec();
+    KJS::JSObject *rootObject = root->interpreter()->globalObject();
+    KJS::JSObject *window = rootObject->get(exec, KJS::Identifier("window"))->getObject();
+    if (!window) {
+        qDebug() << "Warning: couldn't get window object";
+        return;
+    }
+            
+    KJS::JSObject *testController =
+        KJS::Bindings::Instance::createRuntimeObject(KJS::Bindings::Instance::QtLanguage,
+                                                     object, root);
+
+    window->put(exec, KJS::Identifier(name.constData()), testController);
+}
+
+
+QString QWebFrame::markup() const
+{
+    return createMarkup(d->frame->document());
+}
+
+QString QWebFrame::innerText() const
+{
+    Element *documentElement = d->frame->document()->documentElement();
+    return documentElement->innerText();
+}
+
+QString QWebFrame::renderTreeDump() const
+{
+    return externalRepresentation(d->frame->renderer());
+}
+
+
+#include "qwebframe.moc"
diff --git a/WebKitQt/Api/qwebframe.h b/WebKitQt/Api/qwebframe.h
new file mode 100644 (file)
index 0000000..7943899
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef QWEBFRAME_H
+#define QWEBFRAME_H
+
+#include <qscrollarea.h>
+
+class QWebFramePrivate;
+class QWebPage;
+
+namespace WebCore {
+    class FrameLoaderClientQt;
+}
+
+class QWebFrame : public QScrollArea
+{
+    Q_OBJECT
+public:
+    QWebFrame(QWebPage *parent);
+    QWebFrame(QWebFrame *parent);
+    ~QWebFrame();
+
+    void addToJSWindowObject(const QByteArray &name, QObject *object);
+    QString markup() const;
+    QString innerText() const;
+    QString renderTreeDump() const;
+
+signals:
+    void cleared();
+    void loadDone();
+    
+private:
+    friend class QWebPage;
+    friend class WebCore::FrameLoaderClientQt;
+    QWebFramePrivate *d;
+};
+
+
+
+#endif
diff --git a/WebKitQt/Api/qwebframe_p.h b/WebKitQt/Api/qwebframe_p.h
new file mode 100644 (file)
index 0000000..92998a7
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+#ifndef QWEBFRAME_P_H
+#define QWEBFRAME_P_H
+
+#include "qwebframe.h"
+#include "qwebpage_p.h"
+
+namespace WebCore
+{
+    class FrameLoaderClientQt;
+    class FrameQt;
+    class FrameView;
+}
+
+class QWebFramePrivate
+{
+public:
+    QWebFramePrivate()
+        : frameLoaderClient(0)
+        , frame(0)
+        , frameView(0)
+        {}
+    WebCore::FrameLoaderClientQt *frameLoaderClient;
+    WebCore::FrameQt *frame;
+    WebCore::FrameView *frameView;
+};
+
+
+#endif
diff --git a/WebKitQt/Api/qwebpage.cpp b/WebKitQt/Api/qwebpage.cpp
new file mode 100644 (file)
index 0000000..4e20cad
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+
+#include "qwebpage.h"
+#include "qwebframe.h"
+#include "qwebpage_p.h"
+#include "qwebframe_p.h"
+
+#include <qurl.h>
+
+#include "FrameQt.h"
+#include "ChromeClientQt.h"
+#include "ContextMenuClientQt.h"
+#include "EditorClientQt.h"
+#include "Page.h"
+#include "FrameLoader.h"
+#include "KURL.h"
+#include "qboxlayout.h"
+
+using namespace WebCore;
+
+QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
+    : q(qq)
+{
+    chromeClient = new ChromeClientQt(q);
+    contextMenuClient = new ContextMenuClientQt();
+    editorClient = new EditorClientQt();
+    page = new Page(chromeClient, contextMenuClient, editorClient);
+
+    mainFrame = 0;
+}
+
+QWebPagePrivate::~QWebPagePrivate()
+{
+    delete page;
+}
+
+void QWebPagePrivate::createMainFrame()
+{
+    if (!mainFrame) {
+        mainFrame = q->createFrame(0);
+        layout->addWidget(mainFrame);
+    }
+}
+
+
+QWebPage::QWebPage(QWidget *parent)
+    : QWidget(parent)
+    , d(new QWebPagePrivate(this))
+{
+    d->layout = new QVBoxLayout(this);
+    d->layout->setMargin(0);
+    d->layout->setSpacing(0);
+}
+
+QWebPage::~QWebPage()
+{
+    delete d;
+}
+
+QWebFrame *QWebPage::createFrame(QWebFrame *parentFrame)
+{
+    if (parentFrame)
+        return new QWebFrame(parentFrame);
+    return new QWebFrame(this);
+}
+
+void QWebPage::open(const QUrl &url)
+{
+    d->createMainFrame();
+
+    d->mainFrame->d->frame->loader()->load(KURL(url.toString()));
+}
+
+QWebFrame *QWebPage::mainFrame() const
+{
+    d->createMainFrame();
+    return d->mainFrame;
+}
+
+
+QSize QWebPage::sizeHint() const
+{
+    return QSize(800, 600);
+}
+
+#include "qwebpage.moc"
+
diff --git a/WebKitQt/Api/qwebpage.h b/WebKitQt/Api/qwebpage.h
new file mode 100644 (file)
index 0000000..4621080
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef QWEBPAGE_H
+#define QWEBPAGE_H
+
+#include <qwidget.h>
+class QWebFrame;
+class QUrl;
+
+class QWebPagePrivate;
+
+class QWebPage : public QWidget
+{
+    Q_OBJECT
+public:
+    QWebPage(QWidget *parent);
+    ~QWebPage();
+
+    virtual QWebFrame *createFrame(QWebFrame *parentFrame);
+    //virtual QWebPage *createPage(...);
+
+    void open(const QUrl &url);
+
+
+    QWebFrame *mainFrame() const;
+    
+    QSize sizeHint() const;
+
+   
+private:
+    friend class QWebFrame;
+    QWebPagePrivate *d;
+};
+
+
+
+#endif
diff --git a/WebKitQt/Api/qwebpage_p.h b/WebKitQt/Api/qwebpage_p.h
new file mode 100644 (file)
index 0000000..0c222ed
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2007 Trolltech ASA
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    This class provides all functionality needed for loading images, style sheets and html
+    pages from the web. It has a memory cache for these objects.
+*/
+#ifndef QWEBPAGE_P_H
+#define QWEBPAGE_P_H
+
+#include "qwebpage.h"
+#include "qwebframe.h"
+
+namespace WebCore
+{
+    class ChromeClientQt;
+    class ContextMenuClientQt;
+    class EditorClientQt;
+    class Page;
+}
+
+class QVBoxLayout;
+
+class QWebPagePrivate
+{
+public:
+    QWebPagePrivate(QWebPage *);
+    ~QWebPagePrivate();
+    void createMainFrame();
+
+    WebCore::ChromeClientQt *chromeClient;
+    WebCore::ContextMenuClientQt *contextMenuClient;
+    WebCore::EditorClientQt *editorClient;
+    WebCore::Page *page;
+
+    QWebFrame *mainFrame;
+    QVBoxLayout *layout;
+
+    QWebPage *q;
+};
+
+#endif
index 3a28898..10ae9f1 100644 (file)
@@ -1,3 +1,62 @@
+2007-01-16  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Zack
+
+        Added the start of a public API to the Qt build
+        of WebKit. Currently we have QWebPage and QWebFrame
+        with a few small methods.
+
+        Converted the QtLauncher to use the new public API.
+
+        * Api/qwebframe.cpp: Added.
+        (QWebFrame::QWebFrame):
+        (QWebFrame::~QWebFrame):
+        (QWebFrame::addToJSWindowObject):
+        (QWebFrame::markup):
+        (QWebFrame::innerText):
+        (QWebFrame::renderTreeDump):
+        * Api/qwebframe.h: Added.
+        * Api/qwebframe_p.h: Added.
+        (QWebFramePrivate::QWebFramePrivate):
+        * Api/qwebpage.cpp: Added.
+        (QWebPagePrivate::QWebPagePrivate):
+        (QWebPagePrivate::~QWebPagePrivate):
+        (QWebPagePrivate::createMainFrame):
+        (QWebPage::QWebPage):
+        (QWebPage::~QWebPage):
+        (QWebPage::createFrame):
+        (QWebPage::open):
+        (QWebPage::mainFrame):
+        (QWebPage::sizeHint):
+        * Api/qwebpage.h: Added.
+        * Api/qwebpage_p.h: Added.
+        * QtLauncher/main.cpp:
+        (main):
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::ChromeClientQt):
+        (WebCore::ChromeClientQt::setWindowRect):
+        (WebCore::ChromeClientQt::windowRect):
+        (WebCore::ChromeClientQt::pageRect):
+        (WebCore::ChromeClientQt::focus):
+        (WebCore::ChromeClientQt::unfocus):
+        (WebCore::ChromeClientQt::canTakeFocus):
+        (WebCore::ChromeClientQt::takeFocus):
+        (WebCore::ChromeClientQt::createWindow):
+        (WebCore::ChromeClientQt::createModalDialog):
+        (WebCore::ChromeClientQt::show):
+        (WebCore::ChromeClientQt::addMessageToConsole):
+        (WebCore::ChromeClientQt::chromeDestroyed):
+        (WebCore::ChromeClientQt::canRunBeforeUnloadConfirmPanel):
+        (WebCore::ChromeClientQt::runBeforeUnloadConfirmPanel):
+        (WebCore::ChromeClientQt::closeWindowSoon):
+        * WebCoreSupport/ChromeClientQt.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::setFrame):
+        (WebCore::FrameLoaderClientQt::detachFrameLoader):
+        (WebCore::FrameLoaderClientQt::dispatchDidHandleOnloadEvents):
+        (WebCore::FrameLoaderClientQt::partClearedInBegin):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2007-01-15  Anders Carlsson  <acarlsson@apple.com>
 
         Fix build.
index 6fbc3e9..86fb9ff 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <wtf/Platform.h>
-
 #include <QApplication>
-#include <QWidget>
-#if PLATFORM(KDE)
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <kdebug.h>
-#endif
-
-#include <Document.h>
-#include <FrameView.h>
-#include <ChromeClientQt.h>
-#include <ContextMenuClientQt.h>
-#include <EditorClientQt.h>
-#include <KURL.h>
-
-#include <FrameQt.h>
-#include <FrameLoaderClientQt.h>
-#include <page/Page.h>
+#include <qwebpage.h>
 
 #include <QVBoxLayout>
 #include <QDir>
-
-using namespace WebCore;
-
-#if PLATFORM(KDE)
-static KCmdLineOptions options[] =
-{
-    { "+file",        "File to load", 0 },
-    KCmdLineLastOption
-};
-#endif
-
+#include <QUrl>
 int main(int argc, char **argv)
 {
     QString url = QString("%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
-#if PLATFORM(KDE)
-    KCmdLineArgs::init(argc, argv, "testunity", "testunity",
-                       "unity testcase app", "0.1");
-    KCmdLineArgs::addCmdLineOptions(options);
-    KApplication app;
-    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-
-    if (args->count() != 0)
-        url = args->arg(0);
-#else
     QApplication app(argc, argv);
 
     const QStringList args = app.arguments();
     if (args.count() > 1)
         url = args.at(1);
-#endif
      
     QWidget topLevel;
     QBoxLayout *l = new QVBoxLayout(&topLevel);
-    // Initialize WebCore in Qt platform mode...
-    Page* page = new Page(new ChromeClientQt(), new ContextMenuClientQt(),
-                          new EditorClientQt());
-    FrameLoaderClientQt *frameLoaderClient = new FrameLoaderClientQt();
-    FrameQt* frame = new FrameQt(page, 0, new FrameQtClient(), frameLoaderClient);
-    frameLoaderClient->setFrame(frame);
-
-    FrameView* frameView = new FrameView(frame);
-    frame->setView(frameView);
-    frameView->setParentWidget(&topLevel);
 
-    l->addWidget(frame->view()->qwidget());
-    l->activate();
-    frame->view()->qwidget()->show();
+    QWebPage *page = new QWebPage(&topLevel);
+    l->addWidget(page);
 
     topLevel.show();
 
-    QtFrame(frame)->client()->openURL(KURL(url.toLatin1()));
+    page->open(url);
     
     app.exec();
-    delete frame;
     return 0;
 }
index 4f68e65..6e49147 100644 (file)
 #include "FrameView.h"
 #include "FrameLoadRequest.h"
 
-#include <QWidget>
+#include "qwebpage.h"
 
 #define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED: %s:%d\n", __FILE__, __LINE__); } while(0)
 
 namespace WebCore
 {
 
-static QWidget* rootWindowForFrame(const Frame* frame)
-{
-    FrameView* frameView = (frame ? frame->view() : 0);
-    if (!frameView)
-        return 0;
-
-    return frameView->qwidget();
-}
     
-ChromeClientQt::ChromeClientQt()
+ChromeClientQt::ChromeClientQt(QWebPage* webPage)
+    : m_webPage(webPage)
 {
     
 }
@@ -69,36 +62,29 @@ void ChromeClientQt::deref()
     Shared<ChromeClientQt>::deref();
 }
 
-void ChromeClientQt::setWindowRect(const FloatRect&)
+void ChromeClientQt::setWindowRect(const FloatRect& rect)
 {
-    notImplemented();
-#if 0
-    QWidget* widget = rootWindowForFrame(mainFrame());
-    if (widget)
-        widget->setGeometry(QRect(qRound(r.x()), qRound(r.y()),
-                                  qRound(r.width()), qRound(r.height())));
-#endif
+    if (!m_webPage)
+        return;
+//     m_webPage->emit setWindowRect(QRect(qRound(r.x()), qRound(r.y()),
+//                                         qRound(r.width()), qRound(r.height())));
 }
 
 
 FloatRect ChromeClientQt::windowRect()
 {
-#if 0
-    QWidget* widget = rootWindowForFrame(mainFrame());
-    if (!widget)
+    if (!m_webPage)
         return FloatRect();
 
-    return IntRect(widget->geometry());
-#endif
-    notImplemented();
-    return IntRect(0, 0, 100, 100);
+    return IntRect(m_webPage->topLevelWidget()->geometry());
 }
 
 
 FloatRect ChromeClientQt::pageRect()
 {
-    notImplemented();
-    return FloatRect(0, 0, 100, 100);
+    if (!m_webPage)
+        return FloatRect();
+    return FloatRect(QRectF(m_webPage->rect()));
 }
 
 
@@ -111,29 +97,37 @@ float ChromeClientQt::scaleFactor()
 
 void ChromeClientQt::focus()
 {
-    notImplemented();
+    if (!m_webPage)
+        return;
+    m_webPage->setFocus();
 }
 
 
 void ChromeClientQt::unfocus()
 {
-    notImplemented();
+    if (!m_webPage)
+        return;
+    m_webPage->clearFocus();
 }
 
 bool ChromeClientQt::canTakeFocus(FocusDirection)
 {
-    notImplemented();
-    return true;
+    if (!m_webPage)
+        return false;
+    return m_webPage->focusPolicy() != Qt::NoFocus;
 }
 
 void ChromeClientQt::takeFocus(FocusDirection)
 {
-    notImplemented();
+    if (!m_webPage)
+        return;
+    m_webPage->clearFocus();
 }
 
 
-Page* ChromeClientQt::createWindow(const FrameLoadRequest&)
+Page* ChromeClientQt::createWindow(const FrameLoadRequest& request)
 {
+    //QWebPage *newPage = m_webPage->createWindow(...);
     notImplemented();
     return 0;
 }
@@ -141,13 +135,16 @@ Page* ChromeClientQt::createWindow(const FrameLoadRequest&)
 
 Page* ChromeClientQt::createModalDialog(const FrameLoadRequest&)
 {
+    notImplemented();
     return 0;
 }
 
 
 void ChromeClientQt::show()
 {
-    notImplemented();
+    if (!m_webPage)
+        return;
+    m_webPage->topLevelWidget()->show();
 }
 
 
@@ -222,22 +219,27 @@ void ChromeClientQt::setResizable(bool)
 void ChromeClientQt::addMessageToConsole(const String& message, unsigned int lineNumber,
                                          const String& sourceID)
 {
+    notImplemented();
 }
 
 void ChromeClientQt::chromeDestroyed()
 {
+    notImplemented();
 }
 
 bool ChromeClientQt::canRunBeforeUnloadConfirmPanel()
 {
+    notImplemented();
 }
 
 bool ChromeClientQt::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
 {
+    notImplemented();
 }
 
 void ChromeClientQt::closeWindowSoon()
 {
+    notImplemented();
 }
 
 }
index 702d2df..7c8e6da 100644 (file)
@@ -32,6 +32,8 @@
 #include "FloatRect.h"
 #include "Shared.h"
 
+class QWebPage;
+
 namespace WebCore {
 
     class FloatRect;
@@ -41,7 +43,7 @@ namespace WebCore {
     class ChromeClientQt : public ChromeClient,
                            public Shared<ChromeClientQt> {
     public:
-        ChromeClientQt();
+        ChromeClientQt(QWebPage* webPage);
         virtual ~ChromeClientQt();
         virtual void chromeDestroyed();
 
@@ -89,6 +91,8 @@ namespace WebCore {
         virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
 
         virtual void closeWindowSoon();
+
+        QWebPage* m_webPage;
     };
 }
 
index dca32e9..d6f2235 100644 (file)
@@ -31,6 +31,7 @@
 #include "DocumentLoader.h"
 #include "ResourceResponse.h"
 #include "qdebug.h"
+#include "qwebframe.h"
 
 #define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED: %s:%d (%s)\n", __FILE__, __LINE__, __FUNCTION__); } while(0)
 
@@ -48,13 +49,15 @@ FrameLoaderClientQt::~FrameLoaderClientQt()
 {
 }
 
-void FrameLoaderClientQt::setFrame(FrameQt *frame)
+void FrameLoaderClientQt::setFrame(QWebFrame *webFrame, FrameQt *frame)
 {
+    m_webFrame = webFrame;
     m_frame = frame;
 }
 
 void FrameLoaderClientQt::detachFrameLoader()
 {
+    m_webFrame = 0;
     m_frame = 0;
 }
 
@@ -248,7 +251,7 @@ void FrameLoaderClientQt::loadedFromPageCache()
 
 void FrameLoaderClientQt::dispatchDidHandleOnloadEvents()
 {
-    //notImplemented();
+    emit m_webFrame->loadDone();
 }
 
 
@@ -532,7 +535,7 @@ bool FrameLoaderClientQt::canHandleRequest(const WebCore::ResourceRequest&) cons
 
 void FrameLoaderClientQt::partClearedInBegin()
 {
-    notImplemented();
+    emit m_webFrame->cleared();
 }
 
 void FrameLoaderClientQt::setDocumentViewFromPageCache(WebCore::PageCache*)
index a4f7a86..afbc797 100644 (file)
@@ -34,6 +34,7 @@
 #include "FrameLoader.h"
 #include "Shared.h"
 #include "ResourceResponse.h"
+class QWebFrame;
 
 namespace WebCore {
 
@@ -51,7 +52,7 @@ namespace WebCore {
     public:
         FrameLoaderClientQt();
         ~FrameLoaderClientQt();
-        void setFrame(FrameQt *frame);
+        void setFrame(QWebFrame *webFrame, FrameQt *frame);
         virtual void detachFrameLoader();
 
         virtual void ref();
@@ -203,6 +204,7 @@ namespace WebCore {
 
     private:
         Frame *m_frame;
+        QWebFrame *m_webFrame;
         ResourceResponse m_response;
         bool m_firstData;
     };
index 1dfc7b8..defb74e 100644 (file)
@@ -1,3 +1,28 @@
+2007-01-16  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Zack
+
+        Use the new public API for the Qt build, and don't rely on
+        WebKit internals anymore.
+
+        * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.cpp:
+        (WebCore::DumpRenderTree::DumpRenderTree):
+        (WebCore::DumpRenderTree::~DumpRenderTree):
+        (WebCore::DumpRenderTree::open):
+        (WebCore::DumpRenderTree::readStdin):
+        (WebCore::DumpRenderTree::initJSObjects):
+        (WebCore::DumpRenderTree::dump):
+        * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.h:
+        * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.pro:
+        * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.cpp: Removed.
+        * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.h: Removed.
+        * DumpRenderTree/DumpRenderTree.qtproj/jsobjects.cpp:
+        (LayoutTestController::notifyDone):
+        (LayoutTestController::timerEvent):
+        * DumpRenderTree/DumpRenderTree.qtproj/main.cpp:
+        (main):
+        * DumpRenderTree/DumpRenderTree.qtproj/tests-skipped.txt:
+
 2007-01-15  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by mjs
index a36b040..f41cc6c 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
 #include "DumpRenderTree.h"
-#include "DumpRenderTreeClient.h"
 #include "jsobjects.h"
 
-#include "Page.h"
-#include "markup.h"
-#include "Document.h"
-#include "FrameView.h"
-#include "KURL.h"
-#include "FrameLoader.h"
-#include "RenderTreeAsText.h"
-#include "ChromeClientQt.h"
-#include "ContextMenuClientQt.h"
-#include "EditorClientQt.h"
-#include "FrameLoaderClientQt.h"
-#include "CString.h"
-
-#include "bindings/runtime.h"
-#include "bindings/runtime_root.h"
-#include "ExecState.h"
-#include "object.h"
-
-#include "Document.h"
-#include "Element.h"
-
 #include <QDir>
 #include <QFile>
 #include <QTimer>
 #include <QBoxLayout>
 #include <QScrollArea>
 #include <QApplication>
+#include <QUrl>
+
+#include <qwebpage.h>
+#include <qwebframe.h>
 
 #include <unistd.h>
 #include <qdebug.h>
@@ -70,35 +51,23 @@ const unsigned int maxViewWidth = 800;
 const unsigned int maxViewHeight = 600;
 
 DumpRenderTree::DumpRenderTree()
-    : m_frame(0)
-    , m_client(new DumpRenderTreeClient(this))
-    , m_stdin(0)
+    : m_stdin(0)
     , m_notifier()
     , m_loading(false)
 {
-    // Initialize WebCore in Qt platform mode...
-    Page* page = new Page(new ChromeClientQt(), new ContextMenuClientQt(), new EditorClientQt());
-    m_frame = new FrameQt(page, 0, new FrameQtClient(), m_client);
-    m_client->setFrame(m_frame);
-
-    FrameView* view = new FrameView(m_frame);
-    view->setScrollbarsMode(ScrollbarAlwaysOff);
-
-    m_frame->setView(view);
-    view->setParentWidget(0 /* no toplevel widget */);
+    page = new QWebPage(0);
+    frame = page->mainFrame();
+    frame->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    frame->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
+    
     m_controller = new LayoutTestController();
     QObject::connect(m_controller, SIGNAL(done()), this, SLOT(dump()), Qt::QueuedConnection);
     QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection);
+    QObject::connect(frame, SIGNAL(cleared()), this, SLOT(initJSObjects()));
+    QObject::connect(frame, SIGNAL(loadDone()), this, SLOT(maybeDump()));
     
-
-    // Reverse calculations in QAbstractScrollArea::maximumViewportSize()
-    QScrollArea* area = qobject_cast<QScrollArea*>(m_frame->view()->qwidget());
-
-    unsigned int viewWidth = maxViewWidth + 2 * area->frameWidth();
-    unsigned int viewHeight = maxViewHeight + 2 * area->frameWidth();
-
-    area->resize(viewWidth, viewHeight);
+    page->resize(800, 800);
 
     // Read file containing to be skipped tests...
     readSkipFile();
@@ -106,7 +75,7 @@ DumpRenderTree::DumpRenderTree()
 
 DumpRenderTree::~DumpRenderTree()
 {
-    delete m_frame;
+    delete page;
 
     delete m_stdin;
     delete m_notifier;
@@ -125,10 +94,9 @@ void DumpRenderTree::open()
     }
 }
 
-void DumpRenderTree::open(const KURL& url)
+void DumpRenderTree::open(const QUrl& url)
 {
     resetJSObjects();
-    Q_ASSERT(url.isLocalFile());
 
     // Ignore skipped tests
     if (m_skipped.indexOf(url.path()) != -1) {
@@ -137,7 +105,7 @@ void DumpRenderTree::open(const KURL& url)
         return;
     }
 
-    m_frame->client()->openURL(url);
+    page->open(url);
 }
 
 void DumpRenderTree::readStdin(int /* socket */)
@@ -150,7 +118,7 @@ void DumpRenderTree::readStdin(int /* socket */)
     if (line.endsWith('\n'))
         line.truncate(line.size()-1);
     if (!line.isEmpty())
-        open(KURL(line));
+        open(QUrl(QString(line)));
 }
 
 void DumpRenderTree::readSkipFile()
@@ -190,21 +158,7 @@ void DumpRenderTree::resetJSObjects()
 
 void DumpRenderTree::initJSObjects()
 {
-    KJS::Bindings::RootObject *root = m_frame->bindingRootObject();
-    KJS::ExecState *exec = root->interpreter()->globalExec();
-    KJS::JSObject *rootObject = root->interpreter()->globalObject();
-    KJS::JSObject *window = rootObject->get(exec, KJS::Identifier("window"))->getObject();
-    if (!window) {
-        qDebug() << "Warning: couldn't get window object";
-        return;
-    }
-            
-    KJS::JSObject *testController =
-        KJS::Bindings::Instance::createRuntimeObject(KJS::Bindings::Instance::QtLanguage,
-                                                     m_controller, root);
-
-    window->put(exec, KJS::Identifier("layoutTestController"), testController);
-    
+    frame->addToJSWindowObject("layoutTestController", m_controller);    
 }
 
 void DumpRenderTree::dump()
@@ -212,23 +166,22 @@ void DumpRenderTree::dump()
     //qDebug() << ">>>>>>>>>>>>>>>>>>>>>> Dumping" << m_frame->loader()->URL().url();
     if (!m_notifier) {
         // Dump markup in single file mode...
-        DeprecatedString markup = createMarkup(m_frame->document());
-        fprintf(stdout, "Source:\n\n%s\n", markup.ascii());
+        QString markup = frame->markup();
+        fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData());
     }
     
     // Dump render text...
-    String renderDump;
+    QString renderDump;
     if (m_controller->shouldDumpAsText()) {
-        Element *documentElement = m_frame->document()->documentElement();
-        renderDump = documentElement->innerText();
+        renderDump = frame->innerText();
         renderDump.append("\n");
     } else {
-        renderDump = externalRepresentation(m_frame->renderer());
+        renderDump = frame->renderTreeDump();
     }
     if (renderDump.isEmpty()) {
         printf("ERROR: nil result from %s", m_controller->shouldDumpAsText() ? "[documentElement innerText]" : "[frame renderTreeAsExternalRepresentation]");
     } else {
-        fprintf(stdout, "%s#EOF\n", renderDump.utf8().data());
+        fprintf(stdout, "%s#EOF\n", renderDump.toUtf8().constData());
     }
     fflush(stdout);
 
@@ -246,10 +199,5 @@ void DumpRenderTree::maybeDump()
         dump();
 }
 
-FrameQt* DumpRenderTree::frame() const
-{
-    return m_frame;
-}
-
 }
 
index aaf3a10..3beafde 100644 (file)
 #include <QObject>
 #include <QTextStream>
 #include <QSocketNotifier>
+class QUrl;
 class QFile;
+class QWebPage;
+class QWebFrame;
 
-#include "DumpRenderTreeClient.h"
 class LayoutTestController;
 
 namespace WebCore {
@@ -51,28 +53,25 @@ public:
     void open();
 
     // Initialize in single-file mode.
-    void open(const KURL& url);
+    void open(const QUrl& url);
 
-    void initJSObjects();
     void resetJSObjects();
    
 public Q_SLOTS:
+    void initJSObjects();
     void readStdin(int);
     void maybeDump();
     void dump();
 
 Q_SIGNALS:
     void quit();
-private:
-    friend class DumpRenderTreeClient;
-
-    FrameQt* frame() const;
 
 private:
     void readSkipFile();
-    FrameQt* m_frame;
-    DumpRenderTreeClient* m_client;
+
+    QWebPage *page;
+    QWebFrame *frame;
+    
     LayoutTestController *m_controller;
 
     QFile *m_stdin;
index 52d97b6..5bb747a 100644 (file)
@@ -7,8 +7,8 @@ INCLUDEPATH += ../../../JavaScriptCore/kjs
 
 QT = core gui
 
-HEADERS = DumpRenderTreeClient.h DumpRenderTree.h jsobjects.h
-SOURCES = DumpRenderTreeClient.cpp DumpRenderTree.cpp main.cpp jsobjects.cpp
+HEADERS = DumpRenderTree.h jsobjects.h
+SOURCES = DumpRenderTree.cpp main.cpp jsobjects.cpp
 
 unix:!mac {
     SOURCES += fontoverload.cpp
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.cpp b/WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.cpp
deleted file mode 100644 (file)
index aadd268..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DumpRenderTreeClient.h"
-
-#include "DumpRenderTree.h"
-
-#include <QDebug>
-
-namespace WebCore {
-
-DumpRenderTreeClient::DumpRenderTreeClient(DumpRenderTree *d)
-    : FrameLoaderClientQt(), dumper(d)
-{
-}
-
-DumpRenderTreeClient::~DumpRenderTreeClient()
-{
-}
-
-void DumpRenderTreeClient::partClearedInBegin()
-{
-    dumper->initJSObjects();
-}
-
-void DumpRenderTreeClient::dispatchDidHandleOnloadEvents()
-{
-    dumper->maybeDump();
-}
-
-}
-
-// vim: ts=4 sw=4 et
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.h b/WebKitTools/DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTreeClient.h
deleted file mode 100644 (file)
index 0bc4fd6..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DumpRenderTreeClient_H
-#define DumpRenderTreeClient_H
-
-#include "FrameLoaderClientQt.h"
-
-namespace WebCore {
-class DumpRenderTree;
-    
-class DumpRenderTreeClient : public FrameLoaderClientQt
-{
-public:
-    DumpRenderTreeClient(DumpRenderTree *d);
-    virtual ~DumpRenderTreeClient();
-
-    virtual void partClearedInBegin();
-    void dispatchDidHandleOnloadEvents();
-
-private:
-    DumpRenderTree *dumper;
-};
-
-}
-
-#endif
-
-// vim: ts=4 sw=4 et
index f3ac629..ad7dd01 100644 (file)
@@ -51,7 +51,10 @@ void LayoutTestController::waitUntilDone()
 
 void LayoutTestController::notifyDone()
 {
-    //qDebug() << ">>>>notifyDone"; emit done();
+    //qDebug() << ">>>>notifyDone";
+    killTimer(timeoutTimer);
+    timeoutTimer = 0;
+    emit done();
 }
 
 void LayoutTestController::dumpEditingCallbacks()
@@ -62,7 +65,5 @@ void LayoutTestController::dumpEditingCallbacks()
 void LayoutTestController::timerEvent(QTimerEvent *)
 {
     qDebug() << ">>>>>>>>>>>>> timeout";
-    killTimer(timeoutTimer);
-    timeoutTimer = 0;
     notifyDone();
 }
index 79f1b3b..b2173af 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
 #include "DumpRenderTree.h"
-#include "KURL.h"
+#include "qurl.h"
+#include "qdir.h"
 
 #include <qstringlist.h>
+#include <qapplication.h>
 
-using namespace WebCore;
-
-#if PLATFORM(KDE)
-#include <kapplication.h>
-#include <kcmdlineargs.h>
 
-static KCmdLineOptions options[] =
-{
-    { "+file", "File to load", 0 },
-    KCmdLineLastOption
-};
-#else
-#include <qapplication.h>
-#endif
 int main(int argc, char* argv[])
 {
-#if PLATFORM(KDE)
-    KCmdLineArgs::init(argc, argv, "DumpRenderTree", "DumpRenderTree", "testing application", "0.1");
-    KCmdLineArgs::addCmdLineOptions(options);
-
-    KApplication app;
-    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-
-    WebCore::DumpRenderTree dumper;
-
-    if (args->count() == 1 && args->arg(0) == QString::fromAscii("-"))
-        dumper.open();
-    else if (args->count() == 1)
-        dumper.open(KURL(args->arg(0)));
-
-    return app.exec();
-#else
     QApplication app(argc, argv);
 
-    const QStringList args = app.arguments();
+    QStringList args = app.arguments();
 
     WebCore::DumpRenderTree dumper;
 
     if (args.count() == 2 && args[1] == QLatin1String("-"))
         dumper.open();
-    else if (args.count() == 2)
-        dumper.open(KURL(args[1]));
-
+    else if (args.count() == 2) {
+        if (!args[1].startsWith("/")
+            && !args[1].startsWith("file:")) {
+            QString path = QDir::currentPath();
+            if (!path.endsWith('/'))
+                path.append('/');
+            args[1].prepend(path);
+        }
+        dumper.open(QUrl(args[1]));
+    }
     return app.exec();
-
-#endif
 }
index 48c6bf4..ac805ba 100644 (file)
@@ -1,6 +1,9 @@
 # These tests hang forever
 editing/selection/extend-by-word-002.html
 
+# tests that currently crash
+fast/borders/border-radius-huge-assert.html
+
 # As kcanvas is in the process of being killed,
 # we didn't even start implementing filtrs / masks
 # on Qt/Linux. Disabling the crashing tests for now.