[Qt][WK2] Title in MiniBrowser is not updated for a page with no title
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 15:25:53 +0000 (15:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 15:25:53 +0000 (15:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82483

Patch by Dinu Jacob <dinu.jacob@nokia.com> on 2012-04-10
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

titleChanged signal is not emitted on comitting a new load.

* UIProcess/API/qt/tests/html/basic_page.html:
* UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
(tst_QQuickWebView):
(tst_QQuickWebView::titleUpdate):
* UIProcess/qt/QtWebPageLoadClient.cpp:
(QtWebPageLoadClient::didCommitLoadForFrame):

Tools:

Set window title to default if there is no page title.

* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::onTitleChanged):
* MiniBrowser/qt/BrowserWindow.h:
(BrowserWindow):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html
Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
Tools/ChangeLog
Tools/MiniBrowser/qt/BrowserWindow.cpp
Tools/MiniBrowser/qt/BrowserWindow.h

index 14c8d2d..dd6a34d 100644 (file)
@@ -1,3 +1,19 @@
+2012-04-10  Dinu Jacob  <dinu.jacob@nokia.com>
+
+        [Qt][WK2] Title in MiniBrowser is not updated for a page with no title
+        https://bugs.webkit.org/show_bug.cgi?id=82483
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        titleChanged signal is not emitted on comitting a new load.
+
+        * UIProcess/API/qt/tests/html/basic_page.html:
+        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+        (tst_QQuickWebView):
+        (tst_QQuickWebView::titleUpdate):
+        * UIProcess/qt/QtWebPageLoadClient.cpp:
+        (QtWebPageLoadClient::didCommitLoadForFrame):
+
 2012-04-10  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
         [Qt][WK2] Implement PageClient::isViewWindowActive()
index 4ae3f5b..b0c19fc 100644 (file)
@@ -55,6 +55,7 @@ private slots:
     void removeFromCanvas();
     void multipleWebViewWindows();
     void multipleWebViews();
+    void titleUpdate();
     void transparentWebViews();
 
 private:
@@ -344,6 +345,24 @@ void tst_QQuickWebView::multipleWebViews()
     QTest::qWait(200);
 }
 
+void tst_QQuickWebView::titleUpdate()
+{    
+    QSignalSpy titleSpy(webView(), SIGNAL(titleChanged()));
+
+    // Load page with no title
+    webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html")));
+    QVERIFY(waitForLoadSucceeded(webView()));
+    QCOMPARE(titleSpy.size(), 1);
+
+    titleSpy.clear();
+
+    // No titleChanged signal for failed load
+    webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html")));
+    QVERIFY(waitForLoadFailed(webView()));
+    QCOMPARE(titleSpy.size(), 0);
+
+}
+
 void tst_QQuickWebView::transparentWebViews()
 {
     showWebView();
index de22a9f..0373ef4 100644 (file)
@@ -60,6 +60,7 @@ void QtWebPageLoadClient::didCommitLoadForFrame()
 {
     emit m_webView->navigationHistoryChanged();
     emit m_webView->urlChanged();
+    emit m_webView->titleChanged();
     m_webView->d_func()->loadDidCommit();
 }
 
index 612cb1b..5e0f167 100644 (file)
@@ -1,3 +1,18 @@
+2012-04-10  Dinu Jacob  <dinu.jacob@nokia.com>
+
+        [Qt][WK2] Title in MiniBrowser is not updated for a page with no title
+        https://bugs.webkit.org/show_bug.cgi?id=82483
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Set window title to default if there is no page title.
+
+        * MiniBrowser/qt/BrowserWindow.cpp:
+        (BrowserWindow::BrowserWindow):
+        (BrowserWindow::onTitleChanged):
+        * MiniBrowser/qt/BrowserWindow.h:
+        (BrowserWindow):
+
 2012-03-23  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
         [Qt][WK2] Implement PageClient::isViewWindowActive()
index e03271e..27bac45 100644 (file)
@@ -52,7 +52,7 @@ BrowserWindow::BrowserWindow(WindowOptions* options)
     engine()->rootContext()->setContextProperty("utils", utils);
     engine()->rootContext()->setContextProperty("options", options);
     setSource(QUrl("qrc:/qml/BrowserWindow.qml"));
-    connect(rootObject(), SIGNAL(pageTitleChanged(QString)), this, SLOT(setWindowTitle(QString)));
+    connect(rootObject(), SIGNAL(pageTitleChanged(QString)), this, SLOT(onTitleChanged(QString)));
     connect(rootObject(), SIGNAL(newWindow(QString)), this, SLOT(newWindow(QString)));
     if (options->startFullScreen())
         showFullScreen();
@@ -132,3 +132,10 @@ void BrowserWindow::screenshot()
 BrowserWindow::~BrowserWindow()
 {
 }
+
+void BrowserWindow::onTitleChanged(QString title)
+{
+    if (title.isEmpty())
+        title = QLatin1String("MiniBrowser");
+    setWindowTitle(title);
+}
index 1681dfb..9f0a656 100644 (file)
@@ -56,6 +56,9 @@ public slots:
 protected slots:
     void screenshot();
 
+private slots:
+    void onTitleChanged(QString);
+
 private:
     WindowOptions* m_windowOptions;
 };