Add a QWebPage::frameCreated() signal and fix DRT
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 14:21:48 +0000 (14:21 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 14:21:48 +0000 (14:21 +0000)
The removal of createFrame in QWebPage broke the re-implementation
in DumpRenderTree. Instead emit a frameCreated() signal and
connect to it in DumpRenderTree.

Signed-off-by: Lars Knoll <lars@trolltech.com>
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27527 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/Api/qwebpage.h
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/qt/DumpRenderTree.h

index 8441f2a6a9f6c69f29fa40bb3bace3ea47f9737c..0e6f15252dd1b7a8446a1a62c25f651b0e89726a 100644 (file)
@@ -116,6 +116,8 @@ void QWebPagePrivate::createMainFrame()
                 q, SIGNAL(hoveringOverLink(const QString&, const QString&)));
         
         mainFrame->d->frameView->setFrameGeometry(q->geometry());
+
+        emit q->frameCreated(mainFrame);
     }
 }
 
index 99fc15d57be8b9c06842bbf94f40c32a84fcc699..c0508b1f4550bee5756c7acb55e40d7c6acd77af 100644 (file)
@@ -171,6 +171,8 @@ signals:
 
     void addToHistory(const QUrl&);
 
+    void frameCreated(QWebFrame *frame);
+
 private slots:
     void onLoadProgressChanged(int);
 
index d544b6ac12fc37ede1c7edbe1bdb270720c006dd..d1d7ec830ed0fb7c9cecaf193e7a66cb68866fbd 100644 (file)
@@ -1,3 +1,20 @@
+2007-11-07  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Lars Knoll <lars@trolltech.com>.
+
+        Add a QWebPage::frameCreated() signal and fix DRT
+        
+        The removal of createFrame in QWebPage broke the re-implementation
+        in DumpRenderTree. Instead emit a frameCreated() signal and
+        connect to it in DumpRenderTree.
+        
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::createMainFrame):
+        * Api/qwebpage.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::createFrame):
+
 2007-11-07  Lars Knoll  <lars@trolltech.com>
 
         Reviewed by Simon.
index a8fb3660b71f04d68a04758667bf3f10eebb8853..20aff61b88eab1a7854cb9045cfca279dba2169a 100644 (file)
@@ -834,6 +834,7 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String
     frameData.marginHeight = marginHeight;
 
     QWebFrame* webFrame = new QWebFrame(m_webFrame, &frameData);
+    emit m_webFrame->page()->frameCreated(webFrame);
 
     RefPtr<Frame> childFrame = webFrame->d->frame;
 
index 362a3e58a3b0f2ed1c87dff5f624392424e98fb5..1804c09e34f45d2180504c1ee1d1683009ffff67 100644 (file)
@@ -1,3 +1,20 @@
+2007-11-07  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Lars Knoll <lars@trolltech.com>.
+
+        Add a QWebPage::frameCreated() signal and fix DRT
+        
+        The removal of createFrame in QWebPage broke the re-implementation
+        in DumpRenderTree. Instead emit a frameCreated() signal and
+        connect to it in DumpRenderTree.
+        
+
+        * DumpRenderTree/qt/DumpRenderTree.cpp:
+        (WebCore::WebPage::WebPage):
+        (WebCore::DumpRenderTree::dump):
+        (WebCore::DumpRenderTree::connectFrame):
+        * DumpRenderTree/qt/DumpRenderTree.h:
+
 2007-11-07  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Lars Knoll <lars@trolltech.com>.
index f5be56a25dceddab2cfff1e5d596290ca4fbd4cd..3195c3f77770ccb414a0d549ff3865a6afc87eb7 100644 (file)
@@ -55,19 +55,10 @@ namespace WebCore {
 const unsigned int maxViewWidth = 800;
 const unsigned int maxViewHeight = 600;
 
-class WebFrame : public QWebFrame {
-public:
-    WebFrame(QWebPage *parent, QWebFrameData *frameData)
-        : QWebFrame(parent, frameData) {}
-    WebFrame(QWebFrame *parent, QWebFrameData *frameData)
-        : QWebFrame(parent, frameData) {}
-};
-
 class WebPage : public QWebPage {
 public:
     WebPage(QWidget *parent, DumpRenderTree *drt);
 
-    QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
     QWebPage *createWindow();
 
     void javaScriptAlert(QWebFrame *frame, const QString& message);
@@ -87,26 +78,6 @@ WebPage::WebPage(QWidget *parent, DumpRenderTree *drt)
     setSettings(s);
 }
 
-QWebFrame *WebPage::createFrame(QWebFrame *parentFrame, QWebFrameData *frameData)
-{
-    if (parentFrame) {
-        WebFrame *f = new WebFrame(parentFrame, frameData);
-        connect(f, SIGNAL(cleared()), m_drt, SLOT(initJSObjects()));
-        connect(f, SIGNAL(provisionalLoad()),
-                m_drt->layoutTestController(), SLOT(provisionalLoad()));
-        return f;
-    }
-    WebFrame *f = new WebFrame(this, frameData);
-
-    connect(f, SIGNAL(cleared()), m_drt, SLOT(initJSObjects()));
-    connect(f, SIGNAL(provisionalLoad()),
-            m_drt->layoutTestController(), SLOT(provisionalLoad()));
-    connect(f, SIGNAL(loadDone(bool)),
-            m_drt->layoutTestController(), SLOT(maybeDump(bool)));
-
-    return f;
-}
-
 QWebPage *WebPage::createWindow()
 {
     return m_drt->createWindow();
@@ -143,6 +114,7 @@ DumpRenderTree::DumpRenderTree()
     connect(m_controller, SIGNAL(done()), this, SLOT(dump()), Qt::QueuedConnection);
 
     m_page = new WebPage(0, this);
+    connect(m_page, SIGNAL(frameCreated(QWebFrame *)), this, SLOT(connectFrame(QWebFrame *)));
     m_page->resize(maxViewWidth, maxViewHeight);
     m_page->mainFrame()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     m_page->mainFrame()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -282,6 +254,17 @@ void DumpRenderTree::titleChanged(const QString &s)
         printf("TITLE CHANGED: %s\n", s.toUtf8().data());
 }
 
+void DumpRenderTree::connectFrame(QWebFrame *frame)
+{
+    connect(frame, SIGNAL(cleared()), this, SLOT(initJSObjects()));
+    connect(frame, SIGNAL(provisionalLoad()),
+            layoutTestController(), SLOT(provisionalLoad()));
+
+    if (frame == m_page->mainFrame()) {
+        connect(frame, SIGNAL(loadDone(bool)),
+                layoutTestController(), SLOT(maybeDump(bool)));
+    }
+}
 
 QWebPage *DumpRenderTree::createWindow()
 {
@@ -292,6 +275,7 @@ QWebPage *DumpRenderTree::createWindow()
     container->move(-1, -1);
     container->hide();
     QWebPage *page = new WebPage(container, this);
+    connect(m_page, SIGNAL(frameCreated(QWebFrame *)), this, SLOT(connectFrame(QWebFrame *)));
     windows.append(container);
     return page;
 }
index 4e0f9b7d6ec740379dd109f309fd30239d6bd7f9..b939fad0e79771eaa023e495027771b9a6105913 100644 (file)
@@ -73,6 +73,7 @@ public Q_SLOTS:
     void readStdin(int);
     void dump();
     void titleChanged(const QString &s);
+    void connectFrame(QWebFrame *frame);
 
 Q_SIGNALS:
     void quit();