Title: [113715] trunk
Revision
113715
Author
[email protected]
Date
2012-04-10 08:25:53 -0700 (Tue, 10 Apr 2012)

Log Message

[Qt][WK2] Title in MiniBrowser is not updated for a page with no title
https://bugs.webkit.org/show_bug.cgi?id=82483

Patch by Dinu Jacob <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (113714 => 113715)


--- trunk/Source/WebKit2/ChangeLog	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-10 15:25:53 UTC (rev 113715)
@@ -1,3 +1,19 @@
+2012-04-10  Dinu Jacob  <[email protected]>
+
+        [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  <[email protected]>
 
         [Qt][WK2] Implement PageClient::isViewWindowActive()

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html (113714 => 113715)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html	2012-04-10 15:25:53 UTC (rev 113715)
@@ -1 +1,6 @@
+<html>
+<head>
+<title> Basic Page </title>
+</head>
 <h1>Basic page</h1>
+</html>

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp (113714 => 113715)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-04-10 15:25:53 UTC (rev 113715)
@@ -55,6 +55,7 @@
     void removeFromCanvas();
     void multipleWebViewWindows();
     void multipleWebViews();
+    void titleUpdate();
     void transparentWebViews();
 
 private:
@@ -344,6 +345,24 @@
     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();

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp (113714 => 113715)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2012-04-10 15:25:53 UTC (rev 113715)
@@ -60,6 +60,7 @@
 {
     emit m_webView->navigationHistoryChanged();
     emit m_webView->urlChanged();
+    emit m_webView->titleChanged();
     m_webView->d_func()->loadDidCommit();
 }
 

Modified: trunk/Tools/ChangeLog (113714 => 113715)


--- trunk/Tools/ChangeLog	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Tools/ChangeLog	2012-04-10 15:25:53 UTC (rev 113715)
@@ -1,3 +1,18 @@
+2012-04-10  Dinu Jacob  <[email protected]>
+
+        [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  <[email protected]>
 
         [Qt][WK2] Implement PageClient::isViewWindowActive()

Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp (113714 => 113715)


--- trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp	2012-04-10 15:25:53 UTC (rev 113715)
@@ -52,7 +52,7 @@
     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 @@
 BrowserWindow::~BrowserWindow()
 {
 }
+
+void BrowserWindow::onTitleChanged(QString title)
+{
+    if (title.isEmpty())
+        title = QLatin1String("MiniBrowser");
+    setWindowTitle(title);
+}

Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.h (113714 => 113715)


--- trunk/Tools/MiniBrowser/qt/BrowserWindow.h	2012-04-10 15:14:55 UTC (rev 113714)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.h	2012-04-10 15:25:53 UTC (rev 113715)
@@ -56,6 +56,9 @@
 protected slots:
     void screenshot();
 
+private slots:
+    void onTitleChanged(QString);
+
 private:
     WindowOptions* m_windowOptions;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to