2009-03-27 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2009 21:38:14 +0000 (21:38 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2009 21:38:14 +0000 (21:38 +0000)
        Reviewed by Simon Hausmann.

        Update the page actions when a finishing loading even if the frame is
        not the top frame such as when browsing inside of a website with frames.
        https://bugs.webkit.org/show_bug.cgi?id=24890

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
        * tests/qwebpage/frametest/frame_a.html: Added.
        * tests/qwebpage/frametest/index.html: Added.
        * tests/qwebpage/tst_qwebpage.cpp:
        (tst_QWebPage::backActionUpdate):

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

WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKit/qt/tests/qwebpage/frametest/frame_a.html [new file with mode: 0644]
WebKit/qt/tests/qwebpage/frametest/index.html [new file with mode: 0644]
WebKit/qt/tests/qwebpage/qwebpage.pro
WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
WebKit/qt/tests/qwebpage/tst_qwebpage.qrc [new file with mode: 0644]

index d688b12..6a15b51 100644 (file)
@@ -1,3 +1,18 @@
+2009-03-27  Benjamin C Meyer  <benjamin.meyer@torchmobile.com>
+
+        Reviewed by Simon Hausmann.
+
+        Update the page actions when a finishing loading even if the frame is
+        not the top frame such as when browsing inside of a website with frames.
+        https://bugs.webkit.org/show_bug.cgi?id=24890
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
+        * tests/qwebpage/frametest/frame_a.html: Added.
+        * tests/qwebpage/frametest/index.html: Added.
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::backActionUpdate):
+
 2009-04-29  Ariya Hidayat  <ariya.hidayat@nokia.com>
 
         Reviewed by Simon Hausmann.
index cbe9696..71dc59d 100644 (file)
@@ -387,7 +387,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
 
     m_loadSucceeded = true;
 
-    if (m_frame->tree()->parent() || !m_webFrame)
+    if (!m_webFrame)
         return;
     m_webFrame->page()->d->updateNavigationActions();
 }
diff --git a/WebKit/qt/tests/qwebpage/frametest/frame_a.html b/WebKit/qt/tests/qwebpage/frametest/frame_a.html
new file mode 100644 (file)
index 0000000..9ff68f1
--- /dev/null
@@ -0,0 +1,2 @@
+<a href="http://google.com" target="frame_b"><img src="" width=100 height=100 alt="Google"></a>
+<a href="http://yahoo.com" target="frame_b"><img src="" width=100 height=100 alt="Yahoo"></a>
diff --git a/WebKit/qt/tests/qwebpage/frametest/index.html b/WebKit/qt/tests/qwebpage/frametest/index.html
new file mode 100644 (file)
index 0000000..c53ad09
--- /dev/null
@@ -0,0 +1,4 @@
+<frameset cols="25%,75%">
+   <frame src="frame_a.html" name="frame_a">
+   <frame src="frame_b.html" name="frame_b">
+</frameset>
index bbd98c6..2f3a108 100644 (file)
@@ -2,5 +2,6 @@ TEMPLATE = app
 TARGET = tst_qwebpage
 include(../../../../WebKit.pri)
 SOURCES  += tst_qwebpage.cpp
+RESOURCES  += tst_qwebpage.qrc
 QT += testlib network
 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
index fcfabf4..1d6a48e 100644 (file)
@@ -105,6 +105,7 @@ private slots:
     void cursorMovements();
     void textSelection();
     void textEditing();
+    void backActionUpdate();
 
     void requestCache();
 
@@ -1098,5 +1099,22 @@ void tst_QWebPage::requestCache()
              (int)QNetworkRequest::PreferCache);
 }
 
+void tst_QWebPage::backActionUpdate()
+{
+    QWebView view;
+    QWebPage *page = view.page();
+    QAction *action = page->action(QWebPage::Back);
+    QVERIFY(!action->isEnabled());
+    QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool)));
+    QUrl url = QUrl("qrc:///frametest/index.html");
+    page->mainFrame()->load(url);
+    QTRY_COMPARE(loadSpy.count(), 1);
+    QVERIFY(!action->isEnabled());
+    QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(10, 10));
+    QTRY_COMPARE(loadSpy.count(), 2);
+
+    QVERIFY(action->isEnabled());
+}
+
 QTEST_MAIN(tst_QWebPage)
 #include "tst_qwebpage.moc"
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
new file mode 100644 (file)
index 0000000..38c5232
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>frametest/index.html</file>
+    <file>frametest/frame_a.html</file>
+</qresource>
+</RCC>
+