* SubClass QWebPage to handle hide and close events.
authorzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2007 18:01:56 +0000 (18:01 +0000)
committerzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2007 18:01:56 +0000 (18:01 +0000)
* Forward these events to the InspectorController
* The other options would have been using an eventFilter
  on the webpage and making InspectorClient a QObject or
  creating a QObject Observer.
* Provide a simple QWebPage* createWindow implementation. This is needed
  to make FrameLoaderClientQt::dispatchCreatePage stop crashing in the case
  of the inspector client.

Signed-off-by: Simon
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28351 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/InspectorClientQt.cpp

index 5ef1300a39dfdc358ff0a5ee1fbda63489f8a522..4ada9fb9111efc34fe84f457b3f2a127a16ce920 100644 (file)
@@ -1,3 +1,24 @@
+2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * SubClass QWebPage to handle hide and close events.
+        * Forward these events to the InspectorController
+        * The other options would have been using an eventFilter
+        on the webpage and making InspectorClient a QObject or
+        creating a QObject Observer.
+        * Provide a simple QWebPage* createWindow implementation. This is needed
+        to make FrameLoaderClientQt::dispatchCreatePage stop crashing in the case
+        of the inspector client.
+        
+
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore::InspectorClientWebPage::InspectorClientWebPage):
+        (WebCore::InspectorClientWebPage::createWindow):
+        (WebCore::InspectorClientWebPage::hideEvent):
+        (WebCore::InspectorClientWebPage::closeEvent):
+        (WebCore::InspectorClientQt::createPage):
+
 2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Simon.
index 813ce299511d018002450df210b8a041ff815618..58a25bf6a9424273b731e046f8e85868f73d7225 100644 (file)
 
 namespace WebCore {
 
+class InspectorClientWebPage : public QWebPage {
+public:
+    InspectorClientWebPage(InspectorController* controller)
+        : QWebPage(0)
+        , m_controller(controller)
+    {}
+
+    QWebPage* createWindow()
+    {
+        return new QWebPage(0);
+    }
+
+protected:
+    void hideEvent(QHideEvent* ev)
+    {
+        QWebPage::hideEvent(ev);
+        m_controller->setWindowVisible(false);
+    }
+
+    void closeEvent(QCloseEvent* ev)
+    {
+        QWebPage::closeEvent(ev);
+        m_controller->setWindowVisible(false);
+    }
+
+private:
+    InspectorController* m_controller;
+};
+
 InspectorClientQt::InspectorClientQt(QWebPage* page)
     : m_inspectedWebPage(page)
     , m_attached(false)
@@ -56,7 +85,7 @@ Page* InspectorClientQt::createPage()
     if (m_webPage)
         return m_webPage->d->page;
 
-    m_webPage.set(new QWebPage(0));
+    m_webPage.set(new InspectorClientWebPage(m_inspectedWebPage->d->page->inspectorController()));
     m_webPage->open(QString::fromLatin1("qrc:/webkit/inspector/inspector.html"));
     m_webPage->setMinimumSize(400,300);
     return m_webPage->d->page;