[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

darin at chromium.org darin at chromium.org
Thu Feb 4 21:24:56 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit bc1263e94517fc18cd1cff42e0e223a745a15b2d
Author: darin at chromium.org <darin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 22 18:44:51 2010 +0000

    2010-01-21  Darin Fisher  <darin at chromium.org>
    
            Reviewed by David Levin.
    
            [Chromium] spurious WebViewClient::didStopLoading if changing
            location.hash while a subframe is still loading
    
            https://bugs.webkit.org/show_bug.cgi?id=33884
    
            This is a refinement of http://trac.webkit.org/changeset/51548
    
            * src/FrameLoaderClientImpl.cpp:
            (WebKit::FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage):
            (WebKit::FrameLoaderClientImpl::postProgressStartedNotification):
            (WebKit::FrameLoaderClientImpl::postProgressFinishedNotification):
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::WebViewImpl):
            (WebKit::WebViewImpl::didStartLoading):
            (WebKit::WebViewImpl::didStopLoading):
            * src/WebViewImpl.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index d3e6b15..12e50ae 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,24 @@
+2010-01-21  Darin Fisher  <darin at chromium.org>
+
+        Reviewed by David Levin.
+
+        [Chromium] spurious WebViewClient::didStopLoading if changing
+        location.hash while a subframe is still loading
+
+        https://bugs.webkit.org/show_bug.cgi?id=33884
+
+        This is a refinement of http://trac.webkit.org/changeset/51548
+
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage):
+        (WebKit::FrameLoaderClientImpl::postProgressStartedNotification):
+        (WebKit::FrameLoaderClientImpl::postProgressFinishedNotification):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::didStartLoading):
+        (WebKit::WebViewImpl::didStopLoading):
+        * src/WebViewImpl.h:
+
 2010-01-21  Adam Barth  <abarth at webkit.org>
 
         Unreviewed.  Added a blank line requested by the great an powerful
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 4333c5d..27e77d1 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -554,16 +554,10 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
     // some events for our delegate.
     WebViewImpl* webView = m_webFrame->viewImpl();
 
-    // Flag of whether frame loader is completed. Generate didStartLoading and
-    // didStopLoading only when loader is completed so that we don't fire
-    // them for fragment redirection that happens in window.onload handler.
-    // See https://bugs.webkit.org/show_bug.cgi?id=31838
-    bool loaderCompleted =
-        !m_webFrame->frame()->page()->mainFrame()->loader()->isLoading();
-
-    // Generate didStartLoading if loader is completed.
-    if (webView->client() && loaderCompleted)
-        webView->client()->didStartLoading();
+    // It is possible for a fragment redirection to occur after the page has
+    // fully loaded, so we may need to synthesize didStartLoading and
+    // didStopLoading.  See https://bugs.webkit.org/show_bug.cgi?id=31838
+    webView->didStartLoading();
 
     WebDataSourceImpl* ds = m_webFrame->dataSourceImpl();
     ASSERT(ds);  // Should not be null when navigating to a reference fragment!
@@ -608,9 +602,7 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
     if (m_webFrame->client())
         m_webFrame->client()->didChangeLocationWithinPage(m_webFrame, isNewNavigation);
 
-    // Generate didStopLoading if loader is completed.
-    if (webView->client() && loaderCompleted)
-        webView->client()->didStopLoading();
+    webView->didStopLoading();
 }
 
 void FrameLoaderClientImpl::dispatchDidPushStateWithinPage()
@@ -982,9 +974,9 @@ void FrameLoaderClientImpl::setMainDocumentError(DocumentLoader*,
 
 void FrameLoaderClientImpl::postProgressStartedNotification()
 {
-    WebViewImpl* webview = m_webFrame->viewImpl();
-    if (webview && webview->client())
-        webview->client()->didStartLoading();
+    WebViewImpl* webView = m_webFrame->viewImpl();
+    if (webView)
+        webView->didStartLoading();
 }
 
 void FrameLoaderClientImpl::postProgressEstimateChangedNotification()
@@ -995,9 +987,9 @@ void FrameLoaderClientImpl::postProgressEstimateChangedNotification()
 void FrameLoaderClientImpl::postProgressFinishedNotification()
 {
     // FIXME: why might the webview be null?  http://b/1234461
-    WebViewImpl* webview = m_webFrame->viewImpl();
-    if (webview && webview->client())
-        webview->client()->didStopLoading();
+    WebViewImpl* webView = m_webFrame->viewImpl();
+    if (webView)
+        webView->didStopLoading();
 }
 
 void FrameLoaderClientImpl::setMainFrameDocumentReady(bool ready)
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index c64afa7..a1deebd 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -200,6 +200,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
 #ifndef NDEBUG
     , m_newNavigationLoader(0)
 #endif
+    , m_isLoading(0)
     , m_zoomLevel(0)
     , m_contextMenuAllowed(false)
     , m_doingDragAndDrop(false)
@@ -1667,6 +1668,22 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation)
     m_observedNewNavigation = false;
 }
 
+void WebViewImpl::didStartLoading()
+{
+    if (!m_isLoading++) {
+        if (m_client)
+            m_client->didStartLoading();
+    }
+}
+
+void WebViewImpl::didStopLoading()
+{
+    if (!--m_isLoading) {
+        if (m_client)
+            m_client->didStopLoading();
+    }
+}
+
 bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button,
                                                  bool ctrl, bool shift,
                                                  bool alt, bool meta,
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index dd5191e..62ec2ec 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -223,6 +223,13 @@ public:
     // load.
     void didCommitLoad(bool* isNewNavigation);
 
+    // Notifies the WebView that loading started or stopped.  It is okay to
+    // call didStartLoading multiple times before calling didStopLoading.
+    // However, didStopLoading must be called just as many times as
+    // didStartLoading in order for the loading state to return to false.
+    void didStartLoading();
+    void didStopLoading();
+
     bool contextMenuAllowed() const
     {
         return m_contextMenuAllowed;
@@ -323,6 +330,9 @@ private:
     const WebCore::DocumentLoader* m_newNavigationLoader;
 #endif
 
+    // This counter is non-zero if we are loading.
+    int m_isLoading;
+
     // An object that can be used to manipulate m_page->settings() without linking
     // against WebCore.  This is lazily allocated the first time GetWebSettings()
     // is called.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list