<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[129223] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/129223">129223</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2012-09-21 06:51:35 -0700 (Fri, 21 Sep 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Add WebKitWebView:is-loading property to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=97330

Reviewed by Xan Lopez.

WebKitWebView:is-loading property allows to monitor when the view
is loading something without having to deal with load-changed
signal and all the details of the load status. This also allows to
know when a new load is started before it goes to STARTED status.

* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewGetProperty): Implement getter for is-loading
property.
(webkit_web_view_class_init): Add is-loading property.
(webkitWebViewSetIsLoading): Set whether web view is loading a
page and emit notify signal if the is-loading property has
changed. Also update the active URI when a new load operation has
started.
(webkitWebViewEmitLoadChanged): Set is-loading to FALSE when load
finishes.
(webkitWebViewLoadFailed): Set is-loading to FALSE when load fails.
(webkit_web_view_load_uri): Set is-loading to TRUE.
(webkit_web_view_load_html): Ditto.
(webkit_web_view_load_alternate_html): Ditto.
(webkit_web_view_load_plain_text): Ditto.
(webkit_web_view_load_request): Ditto.
(webkit_web_view_reload): Ditto.
(webkit_web_view_reload_bypass_cache): Ditto.
(webkit_web_view_is_loading): Return whether the view is loading a
page.
(webkit_web_view_go_back): Set is-loading to TRUE.
(webkit_web_view_go_forward): Ditto.
(webkit_web_view_go_to_back_forward_list_item): Ditto.
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
* UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
(loadChangedCallback):
(loadFailedCallback):
* UIProcess/API/gtk/tests/TestLoaderClient.cpp:
(testWebViewIsLoading):
(beforeAll):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsLoadTrackingTestcpp">trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsTestLoaderClientcpp">trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/ChangeLog        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2012-09-21  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add WebKitWebView:is-loading property to WebKit2 GTK+ API
+        https://bugs.webkit.org/show_bug.cgi?id=97330
+
+        Reviewed by Xan Lopez.
+
+        WebKitWebView:is-loading property allows to monitor when the view
+        is loading something without having to deal with load-changed
+        signal and all the details of the load status. This also allows to
+        know when a new load is started before it goes to STARTED status.
+
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkitWebViewGetProperty): Implement getter for is-loading
+        property.
+        (webkit_web_view_class_init): Add is-loading property.
+        (webkitWebViewSetIsLoading): Set whether web view is loading a
+        page and emit notify signal if the is-loading property has
+        changed. Also update the active URI when a new load operation has
+        started.
+        (webkitWebViewEmitLoadChanged): Set is-loading to FALSE when load
+        finishes.
+        (webkitWebViewLoadFailed): Set is-loading to FALSE when load fails.
+        (webkit_web_view_load_uri): Set is-loading to TRUE.
+        (webkit_web_view_load_html): Ditto.
+        (webkit_web_view_load_alternate_html): Ditto.
+        (webkit_web_view_load_plain_text): Ditto.
+        (webkit_web_view_load_request): Ditto.
+        (webkit_web_view_reload): Ditto.
+        (webkit_web_view_reload_bypass_cache): Ditto.
+        (webkit_web_view_is_loading): Return whether the view is loading a
+        page.
+        (webkit_web_view_go_back): Set is-loading to TRUE.
+        (webkit_web_view_go_forward): Ditto.
+        (webkit_web_view_go_to_back_forward_list_item): Ditto.
+        * UIProcess/API/gtk/WebKitWebView.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
+        * UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
+        (loadChangedCallback):
+        (loadFailedCallback):
+        * UIProcess/API/gtk/tests/TestLoaderClient.cpp:
+        (testWebViewIsLoading):
+        (beforeAll):
+
</ins><span class="cx"> 2012-09-20  Eunmi Lee  &lt;eunmi15.lee@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Add API to feed touch event.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -103,7 +103,8 @@
</span><span class="cx">     PROP_TITLE,
</span><span class="cx">     PROP_ESTIMATED_LOAD_PROGRESS,
</span><span class="cx">     PROP_URI,
</span><del>-    PROP_ZOOM_LEVEL
</del><ins>+    PROP_ZOOM_LEVEL,
+    PROP_IS_LOADING
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;uint64_t, GRefPtr&lt;WebKitWebResource&gt; &gt; LoadingResourcesMap;
</span><span class="lines">@@ -115,6 +116,7 @@
</span><span class="cx">     CString customTextEncoding;
</span><span class="cx">     double estimatedLoadProgress;
</span><span class="cx">     CString activeURI;
</span><ins>+    bool isLoading;
</ins><span class="cx"> 
</span><span class="cx">     bool waitingForMainResource;
</span><span class="cx">     gulong mainResourceResponseHandlerID;
</span><span class="lines">@@ -386,6 +388,9 @@
</span><span class="cx">     case PROP_ZOOM_LEVEL:
</span><span class="cx">         g_value_set_double(value, webkit_web_view_get_zoom_level(webView));
</span><span class="cx">         break;
</span><ins>+    case PROP_IS_LOADING:
+        g_value_set_boolean(value, webkit_web_view_is_loading(webView));
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
</span><span class="cx">     }
</span><span class="lines">@@ -506,6 +511,38 @@
</span><span class="cx">                                                         WEBKIT_PARAM_READABLE));
</span><span class="cx"> 
</span><span class="cx">     /**
</span><ins>+     * WebKitWebView:zoom-level:
+     *
+     * The zoom level of the #WebKitWebView content.
+     * See webkit_web_view_set_zoom_level() for more details.
+     */
+    g_object_class_install_property(gObjectClass,
+                                    PROP_ZOOM_LEVEL,
+                                    g_param_spec_double(&quot;zoom-level&quot;,
+                                                        &quot;Zoom level&quot;,
+                                                        _(&quot;The zoom level of the view content&quot;),
+                                                        0, G_MAXDOUBLE, 1,
+                                                        WEBKIT_PARAM_READWRITE));
+
+    /**
+     * WebKitWebView:is-loading:
+     *
+     * Whether the #WebKitWebView is currently loading a page. This property becomes
+     * %TRUE as soon as a new load operation is requested and before the
+     * #WebKitWebView::load-changed signal is emitted with %WEBKIT_LOAD_STARTED and
+     * at that point the active URI is the requested one.
+     * When the load operation finishes the property is set to %FALSE before
+     * #WebKitWebView::load-changed is emitted with %WEBKIT_LOAD_FINISHED.
+     */
+    g_object_class_install_property(gObjectClass,
+                                    PROP_IS_LOADING,
+                                    g_param_spec_boolean(&quot;is-loading&quot;,
+                                                         &quot;Is Loading&quot;,
+                                                         _(&quot;Whether the view is loading a page&quot;),
+                                                         FALSE,
+                                                         WEBKIT_PARAM_READABLE));
+
+    /**
</ins><span class="cx">      * WebKitWebView::load-changed:
</span><span class="cx">      * @web_view: the #WebKitWebView on which the signal is emitted
</span><span class="cx">      * @load_event: the #WebKitLoadEvent
</span><span class="lines">@@ -599,20 +636,6 @@
</span><span class="cx">                      G_TYPE_POINTER);
</span><span class="cx"> 
</span><span class="cx">     /**
</span><del>-     * WebKitWebView:zoom-level:
-     *
-     * The zoom level of the #WebKitWebView content.
-     * See webkit_web_view_set_zoom_level() for more details.
-     */
-    g_object_class_install_property(gObjectClass,
-                                    PROP_ZOOM_LEVEL,
-                                    g_param_spec_double(&quot;zoom-level&quot;,
-                                                        &quot;Zoom level&quot;,
-                                                        &quot;The zoom level of the view content&quot;,
-                                                        0, G_MAXDOUBLE, 1,
-                                                        WEBKIT_PARAM_READWRITE));
-
-    /**
</del><span class="cx">      * WebKitWebView::create:
</span><span class="cx">      * @web_view: the #WebKitWebView on which the signal is emitted
</span><span class="cx">      *
</span><span class="lines">@@ -1106,6 +1129,21 @@
</span><span class="cx">                      WEBKIT_TYPE_FORM_SUBMISSION_REQUEST);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading)
+{
+    if (webView-&gt;priv-&gt;isLoading == isLoading)
+        return;
+
+    webView-&gt;priv-&gt;isLoading = isLoading;
+    g_object_freeze_notify(G_OBJECT(webView));
+    g_object_notify(G_OBJECT(webView), &quot;is-loading&quot;);
+
+    // Update the URI if a new load has started.
+    if (webView-&gt;priv-&gt;isLoading)
+        webkitWebViewUpdateURI(webView);
+    g_object_thaw_notify(G_OBJECT(webView));
+}
+
</ins><span class="cx"> static void setCertificateToMainResource(WebKitWebView* webView)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebViewPrivate* priv = webView-&gt;priv;
</span><span class="lines">@@ -1118,6 +1156,7 @@
</span><span class="cx"> static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
</span><span class="cx"> {
</span><span class="cx">     if (loadEvent == WEBKIT_LOAD_FINISHED) {
</span><ins>+        webkitWebViewSetIsLoading(webView, false);
</ins><span class="cx">         webView-&gt;priv-&gt;waitingForMainResource = false;
</span><span class="cx">         webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView);
</span><span class="cx">     } else
</span><span class="lines">@@ -1167,6 +1206,7 @@
</span><span class="cx"> 
</span><span class="cx"> void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error)
</span><span class="cx"> {
</span><ins>+    webkitWebViewSetIsLoading(webView, false);
</ins><span class="cx">     gboolean returnValue;
</span><span class="cx">     g_signal_emit(webView, signals[LOAD_FAILED], 0, loadEvent, failingURI, error, &amp;returnValue);
</span><span class="cx">     g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
</span><span class="lines">@@ -1521,7 +1561,7 @@
</span><span class="cx">     WKRetainPtr&lt;WKURLRef&gt; url(AdoptWK, WKURLCreateWithUTF8CString(uri));
</span><span class="cx">     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
</span><span class="cx">     WKPageLoadURL(toAPI(page), url.get());
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1549,6 +1589,7 @@
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; contentRef(AdoptWK,  WKStringCreateWithUTF8CString(content));
</span><span class="cx">     WKRetainPtr&lt;WKURLRef&gt; baseURIRef = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0;
</span><span class="cx">     WKPageLoadHTMLString(toAPI(page), contentRef.get(), baseURIRef.get());
</span><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1575,7 +1616,7 @@
</span><span class="cx">     WKRetainPtr&lt;WKURLRef&gt; baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0;
</span><span class="cx">     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
</span><span class="cx">     WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), contentURL.get());
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1595,6 +1636,7 @@
</span><span class="cx">     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText));
</span><span class="cx">     WKPageLoadPlainTextString(toAPI(page), plainTextRef.get());
</span><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1615,7 +1657,7 @@
</span><span class="cx">     WKRetainPtr&lt;WKURLRequestRef&gt; wkRequest(AdoptWK, WKURLRequestCreateWithWKURL(wkURL.get()));
</span><span class="cx">     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
</span><span class="cx">     WKPageLoadURLRequest(toAPI(page), wkRequest.get());
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1647,7 +1689,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><span class="cx"> 
</span><span class="cx">     WKPageReload(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))));
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1662,7 +1704,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><span class="cx"> 
</span><span class="cx">     WKPageReloadFromOrigin(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))));
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1683,6 +1725,26 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_web_view_is_loading:
+ * @web_view: a #WebKitWebView
+ *
+ * Gets the value of the #WebKitWebView:is-loading property.
+ * You can monitor when a #WebKitWebView is loading a page by connecting to
+ * notify::is-loading signal of @web_view. This is useful when you are
+ * interesting in knowing when the view is loding something but not in the
+ * details about the status of the load operation, for example to start a spinner
+ * when the view is loading a page and stop it when it finishes.
+ *
+ * Returns: %TRUE if @web_view is loading a page or %FALSE otherwise.
+ */
+gboolean webkit_web_view_is_loading(WebKitWebView* webView)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
+
+    return webView-&gt;priv-&gt;isLoading;
+}
+
+/**
</ins><span class="cx">  * webkit_web_view_go_back:
</span><span class="cx">  * @web_view: a #WebKitWebView
</span><span class="cx">  *
</span><span class="lines">@@ -1695,7 +1757,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><span class="cx"> 
</span><span class="cx">     WKPageGoBack(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))));
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1726,7 +1788,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><span class="cx"> 
</span><span class="cx">     WKPageGoForward(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))));
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1900,7 +1962,7 @@
</span><span class="cx"> 
</span><span class="cx">     WKPageGoToBackForwardListItem(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))),
</span><span class="cx">                                   webkitBackForwardListItemGetWKItem(listItem));
</span><del>-    webkitWebViewUpdateURI(webView);
</del><ins>+    webkitWebViewSetIsLoading(webView, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -226,6 +226,9 @@
</span><span class="cx"> WEBKIT_API void
</span><span class="cx"> webkit_web_view_stop_loading                       (WebKitWebView             *web_view);
</span><span class="cx"> 
</span><ins>+WEBKIT_API gboolean
+webkit_web_view_is_loading                         (WebKitWebView             *web_view);
+
</ins><span class="cx"> WEBKIT_API const gchar *
</span><span class="cx"> webkit_web_view_get_title                          (WebKitWebView             *web_view);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> webkit_web_view_reload
</span><span class="cx"> webkit_web_view_reload_bypass_cache
</span><span class="cx"> webkit_web_view_stop_loading
</span><ins>+webkit_web_view_is_loading
</ins><span class="cx"> webkit_web_view_get_estimated_load_progress
</span><span class="cx"> webkit_web_view_get_custom_charset
</span><span class="cx"> webkit_web_view_set_custom_charset
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsLoadTrackingTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -26,16 +26,19 @@
</span><span class="cx"> {
</span><span class="cx">     switch (loadEvent) {
</span><span class="cx">     case WEBKIT_LOAD_STARTED:
</span><ins>+        g_assert(webkit_web_view_is_loading(webView));
</ins><span class="cx">         g_assert_cmpstr(test-&gt;m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><span class="cx">         test-&gt;provisionalLoadStarted();
</span><span class="cx">         break;
</span><span class="cx">     case WEBKIT_LOAD_REDIRECTED:
</span><ins>+        g_assert(webkit_web_view_is_loading(webView));
</ins><span class="cx">         test-&gt;m_activeURI = webkit_web_view_get_uri(webView);
</span><span class="cx">         if (!test-&gt;m_redirectURI.isNull())
</span><span class="cx">             g_assert_cmpstr(test-&gt;m_redirectURI.data(), ==, test-&gt;m_activeURI.data());
</span><span class="cx">         test-&gt;provisionalLoadReceivedServerRedirect();
</span><span class="cx">         break;
</span><span class="cx">     case WEBKIT_LOAD_COMMITTED: {
</span><ins>+        g_assert(webkit_web_view_is_loading(webView));
</ins><span class="cx">         g_assert_cmpstr(test-&gt;m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><span class="cx"> 
</span><span class="cx">         // Check that on committed we always have a main resource with a response.
</span><span class="lines">@@ -47,6 +50,7 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case WEBKIT_LOAD_FINISHED:
</span><ins>+        g_assert(!webkit_web_view_is_loading(webView));
</ins><span class="cx">         if (!test-&gt;m_loadFailed)
</span><span class="cx">             g_assert_cmpstr(test-&gt;m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><span class="cx">         test-&gt;loadFinished();
</span><span class="lines">@@ -62,11 +66,13 @@
</span><span class="cx"> 
</span><span class="cx">     switch (loadEvent) {
</span><span class="cx">     case WEBKIT_LOAD_STARTED:
</span><ins>+        g_assert(!webkit_web_view_is_loading(webView));
</ins><span class="cx">         g_assert_cmpstr(test-&gt;m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><span class="cx">         g_assert(error);
</span><span class="cx">         test-&gt;provisionalLoadFailed(failingURI, error);
</span><span class="cx">         break;
</span><span class="cx">     case WEBKIT_LOAD_COMMITTED:
</span><ins>+        g_assert(!webkit_web_view_is_loading(webView));
</ins><span class="cx">         g_assert_cmpstr(test-&gt;m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><span class="cx">         g_assert(error);
</span><span class="cx">         test-&gt;loadFailed(failingURI, error);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsTestLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp (129222 => 129223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp        2012-09-21 13:38:28 UTC (rev 129222)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp        2012-09-21 13:51:35 UTC (rev 129223)
</span><span class="lines">@@ -226,6 +226,62 @@
</span><span class="cx">     test-&gt;waitUntilLoadFinished();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class ViewIsLoadingTest: public LoadTrackingTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(ViewIsLoadingTest);
+
+    static void isLoadingChanged(GObject*, GParamSpec*, ViewIsLoadingTest* test)
+    {
+        if (webkit_web_view_is_loading(test-&gt;m_webView))
+            test-&gt;beginLoad();
+        else
+            test-&gt;endLoad();
+    }
+
+    ViewIsLoadingTest()
+    {
+        g_signal_connect(m_webView, &quot;notify::is-loading&quot;, G_CALLBACK(isLoadingChanged), this);
+    }
+
+    void beginLoad()
+    {
+        // New load, load-started hasn't been emitted yet.
+        g_assert(m_loadEvents.isEmpty());
+        g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+    }
+
+    void endLoad()
+    {
+        // Load finish, load-finished and load-failed haven't been emitted yet.
+        g_assert(!m_loadEvents.isEmpty());
+        g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFinished));
+        g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFailed));
+    }
+};
+
+static void testWebViewIsLoading(ViewIsLoadingTest* test, gconstpointer)
+{
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/normal&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;reload();
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/error&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/normal&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/normal2&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;goBack();
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;goForward();
+    test-&gt;waitUntilLoadFinished();
+}
+
</ins><span class="cx"> static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
</span><span class="cx"> {
</span><span class="cx">     static const char* responseString = &quot;&lt;html&gt;&lt;body&gt;Testing!Testing!Testing!Testing!Testing!Testing!Testing!&quot;
</span><span class="lines">@@ -281,6 +337,8 @@
</span><span class="cx">     // This test checks that web view notify::uri signal is correctly emitted
</span><span class="cx">     // and the uri is already updated when loader client signals are emitted.
</span><span class="cx">     ViewURITrackingTest::add(&quot;WebKitWebView&quot;, &quot;active-uri&quot;, testWebViewActiveURI);
</span><ins>+
+    ViewIsLoadingTest::add(&quot;WebKitWebView&quot;, &quot;is-loading&quot;, testWebViewIsLoading);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span></span></pre>
</div>
</div>

</body>
</html>