Title: [90837] trunk/Source/WebKit2
Revision
90837
Author
[email protected]
Date
2011-07-12 11:55:41 -0700 (Tue, 12 Jul 2011)

Log Message

[Qt][WK2] Navigation actions should react to web process availability.
https://bugs.webkit.org/show_bug.cgi?id=64375

Reviewed by Benjamin Poulain.

When the web process is unavailable, the reload and stop actions should
behave slightly differently. Stop should always be disabled, and reload
should be enabled if there's a reloadable item in the back/forward list.

* UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
(tst_QDesktopWebView::navigationActionEnabledStatusAtStartup):
* UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp:
(tst_QTouchWebView::navigationActionEnabledStatusAtStartup):
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::updateAction):
(QtWebPageProxy::didRelaunchProcess):
(QtWebPageProxy::processDidCrash):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (90836 => 90837)


--- trunk/Source/WebKit2/ChangeLog	2011-07-12 18:53:52 UTC (rev 90836)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-12 18:55:41 UTC (rev 90837)
@@ -1,5 +1,25 @@
 2011-07-12  Andreas Kling  <[email protected]>
 
+        [Qt][WK2] Navigation actions should react to web process availability.
+        https://bugs.webkit.org/show_bug.cgi?id=64375
+
+        Reviewed by Benjamin Poulain.
+
+        When the web process is unavailable, the reload and stop actions should
+        behave slightly differently. Stop should always be disabled, and reload
+        should be enabled if there's a reloadable item in the back/forward list.
+
+        * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
+        (tst_QDesktopWebView::navigationActionEnabledStatusAtStartup):
+        * UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp:
+        (tst_QTouchWebView::navigationActionEnabledStatusAtStartup):
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::updateAction):
+        (QtWebPageProxy::didRelaunchProcess):
+        (QtWebPageProxy::processDidCrash):
+
+2011-07-12  Andreas Kling  <[email protected]>
+
         [Qt][WK2] QDesktopWebView crashes if resized without web process.
         https://bugs.webkit.org/show_bug.cgi?id=64371
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp (90836 => 90837)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp	2011-07-12 18:53:52 UTC (rev 90836)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp	2011-07-12 18:55:41 UTC (rev 90837)
@@ -17,6 +17,7 @@
     Boston, MA 02110-1301, USA.
 */
 
+#include <QAction>
 #include <QScopedPointer>
 #include <QtTest/QtTest>
 #include <qdesktopwebview.h>
@@ -29,6 +30,8 @@
     void init();
     void cleanup();
 
+    void navigationActionsStatusAtStartup();
+
 private:
     inline QDesktopWebView* webView() const;
     QScopedPointer<TestWindow> m_window;
@@ -49,6 +52,25 @@
     return static_cast<QDesktopWebView*>(m_window->webView.data());
 }
 
+void tst_QDesktopWebView::navigationActionsStatusAtStartup()
+{
+    QAction* backAction = webView()->navigationAction(QtWebKit::Back);
+    QVERIFY(backAction);
+    QCOMPARE(backAction->isEnabled(), false);
+
+    QAction* forwardAction = webView()->navigationAction(QtWebKit::Forward);
+    QVERIFY(forwardAction);
+    QCOMPARE(forwardAction->isEnabled(), false);
+
+    QAction* stopAction = webView()->navigationAction(QtWebKit::Stop);
+    QVERIFY(stopAction);
+    QCOMPARE(stopAction->isEnabled(), false);
+
+    QAction* reloadAction = webView()->navigationAction(QtWebKit::Reload);
+    QVERIFY(reloadAction);
+    QCOMPARE(reloadAction->isEnabled(), false);
+}
+
 QTEST_MAIN(tst_QDesktopWebView)
 
 #include "tst_qdesktopwebview.moc"

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp (90836 => 90837)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp	2011-07-12 18:53:52 UTC (rev 90836)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp	2011-07-12 18:55:41 UTC (rev 90837)
@@ -17,6 +17,7 @@
     Boston, MA 02110-1301, USA.
 */
 
+#include <QAction>
 #include <QtTest/QtTest>
 #include <qtouchwebpage.h>
 #include <qtouchwebview.h>
@@ -33,6 +34,7 @@
     void cleanup();
 
     void accessPage();
+    void navigationActionsStatusAtStartup();
 
 private:
     inline QTouchWebView* webView() const;
@@ -68,6 +70,26 @@
     QCOMPARE(pagePropertyAccess, pageDirectAccess);
 }
 
+void tst_QTouchWebView::navigationActionsStatusAtStartup()
+{
+    QAction* backAction = webView()->page()->navigationAction(QtWebKit::Back);
+    QVERIFY(backAction);
+    QCOMPARE(backAction->isEnabled(), false);
+
+    QAction* forwardAction = webView()->page()->navigationAction(QtWebKit::Forward);
+    QVERIFY(forwardAction);
+    QCOMPARE(forwardAction->isEnabled(), false);
+
+    QAction* stopAction = webView()->page()->navigationAction(QtWebKit::Stop);
+    QVERIFY(stopAction);
+    QCOMPARE(stopAction->isEnabled(), false);
+
+    QAction* reloadAction = webView()->page()->navigationAction(QtWebKit::Reload);
+    QVERIFY(reloadAction);
+    QCOMPARE(reloadAction->isEnabled(), false);
+}
+
+
 QTEST_MAIN(tst_QTouchWebView)
 
 #include "tst_qtouchwebview.moc"

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (90836 => 90837)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-07-12 18:53:52 UTC (rev 90836)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-07-12 18:55:41 UTC (rev 90837)
@@ -33,6 +33,7 @@
 #include "LocalizedStrings.h"
 #include "NativeWebKeyboardEvent.h"
 #include "NotImplemented.h"
+#include "WebBackForwardList.h"
 #include "WebContext.h"
 #include "WebContextMenuProxyQt.h"
 #include "WebEditCommandProxy.h"
@@ -480,11 +481,8 @@
         return;
 
     RefPtr<WebKit::WebFrameProxy> mainFrame = m_webPageProxy->mainFrame();
-    if (!mainFrame)
-        return;
 
     bool enabled = a->isEnabled();
-    bool checked = a->isChecked();
 
     switch (action) {
     case QtWebPageProxy::Back:
@@ -494,19 +492,19 @@
         enabled = m_webPageProxy->canGoForward();
         break;
     case QtWebPageProxy::Stop:
-        enabled = !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
+        enabled = mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
         break;
     case QtWebPageProxy::Reload:
-        enabled = (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
+        if (mainFrame)
+            enabled = (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
+        else
+            enabled = m_webPageProxy->backForwardList()->currentItem();
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     a->setEnabled(enabled);
-
-    if (a->isCheckable())
-        a->setChecked(checked);
 }
 
 void QtWebPageProxy::updateNavigationActions()
@@ -528,12 +526,14 @@
 
 void QtWebPageProxy::didRelaunchProcess()
 {
+    updateNavigationActions();
     m_viewInterface->didRelaunchProcess();
     setDrawingAreaSize(m_viewInterface->drawingAreaSize());
 }
 
 void QtWebPageProxy::processDidCrash()
 {
+    updateNavigationActions();
     m_viewInterface->processDidCrash();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to