Title: [174105] trunk
Revision
174105
Author
[email protected]
Date
2014-09-30 06:38:03 -0700 (Tue, 30 Sep 2014)

Log Message

REGRESSION(r173929): [GTK] TestInspector fails after r173929
https://bugs.webkit.org/show_bug.cgi?id=137247

Reviewed by Philippe Normand.

Source/WebKit2:

Add WebKitWebInspector:can-attach property to notify when the
inspector attach availability changes.

* UIProcess/API/C/gtk/WKInspectorClientGtk.h:
* UIProcess/API/gtk/WebKitWebInspector.cpp:
(webkit_web_inspector_class_init): Add WebKitWebInspector:can-attach property.
(didChangeAttachAvailability): Emit notify::can-attach.
(webkitWebInspectorCreate): Add implementation for didChangeAttachAvailability.
(webkit_web_inspector_get_can_attach): Return whether the inspector can be attached.
* UIProcess/API/gtk/WebKitWebInspector.h:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add index of new symbols in 2.8.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
* UIProcess/gtk/WebInspectorClientGtk.cpp:
(WebKit::WebInspectorClientGtk::didChangeAttachAvailability):
* UIProcess/gtk/WebInspectorClientGtk.h:
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformAttachAvailabilityChanged): Notify the client.

Tools:

Wait until can-attach property changes before trying to attach the
inspector after resizing the view.

* TestWebKitAPI/Tests/WebKit2Gtk/TestInspector.cpp:
(testInspectorDefault):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (174104 => 174105)


--- trunk/Source/WebKit2/ChangeLog	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/ChangeLog	2014-09-30 13:38:03 UTC (rev 174105)
@@ -1,5 +1,30 @@
 2014-09-30  Carlos Garcia Campos  <[email protected]>
 
+        REGRESSION(r173929): [GTK] TestInspector fails after r173929
+        https://bugs.webkit.org/show_bug.cgi?id=137247
+
+        Reviewed by Philippe Normand.
+
+        Add WebKitWebInspector:can-attach property to notify when the
+        inspector attach availability changes.
+
+        * UIProcess/API/C/gtk/WKInspectorClientGtk.h:
+        * UIProcess/API/gtk/WebKitWebInspector.cpp:
+        (webkit_web_inspector_class_init): Add WebKitWebInspector:can-attach property.
+        (didChangeAttachAvailability): Emit notify::can-attach.
+        (webkitWebInspectorCreate): Add implementation for didChangeAttachAvailability.
+        (webkit_web_inspector_get_can_attach): Return whether the inspector can be attached.
+        * UIProcess/API/gtk/WebKitWebInspector.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add index of new symbols in 2.8.
+        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
+        * UIProcess/gtk/WebInspectorClientGtk.cpp:
+        (WebKit::WebInspectorClientGtk::didChangeAttachAvailability):
+        * UIProcess/gtk/WebInspectorClientGtk.h:
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged): Notify the client.
+
+2014-09-30  Carlos Garcia Campos  <[email protected]>
+
         [GTK] The remote web inspector shows the HTML content as plain text
         https://bugs.webkit.org/show_bug.cgi?id=137250
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h	2014-09-30 13:38:03 UTC (rev 174105)
@@ -37,6 +37,7 @@
 typedef void (*WKInspectorClientGtkInspectedURLChangedCallback)(WKInspectorRef inspector, WKStringRef url, const void* clientInfo);
 typedef void (*WKInspectorClientGtkDidChangeAttachedHeightCallback)(WKInspectorRef inspector, unsigned height, const void* clientInfo);
 typedef void (*WKInspectorClientGtkDidChangeAttachedWidthCallback)(WKInspectorRef inspector, unsigned width, const void* clientInfo);
+typedef void (*WKInspectorClientGtkDidChangeAttachAvailabilityCallback)(WKInspectorRef inspector, bool available, const void* clientInfo);
 
 typedef struct WKInspectorClientGtkBase {
     int                                                 version;
@@ -54,6 +55,7 @@
     WKInspectorClientGtkInspectorCallback               detach;
     WKInspectorClientGtkDidChangeAttachedHeightCallback didChangeAttachedHeight;
     WKInspectorClientGtkDidChangeAttachedWidthCallback  didChangeAttachedWidth;
+    WKInspectorClientGtkDidChangeAttachAvailabilityCallback didChangeAttachAvailability;
 } WKInspectorClientGtkV0;
 
 WK_EXPORT void WKInspectorSetInspectorClientGtk(WKInspectorRef inspectorRef, const WKInspectorClientGtkBase* client);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp	2014-09-30 13:38:03 UTC (rev 174105)
@@ -72,7 +72,8 @@
     PROP_0,
 
     PROP_INSPECTED_URI,
-    PROP_ATTACHED_HEIGHT
+    PROP_ATTACHED_HEIGHT,
+    PROP_CAN_ATTACH
 };
 
 struct _WebKitWebInspectorPrivate {
@@ -84,6 +85,7 @@
     RefPtr<WebInspectorProxy> webInspector;
     CString inspectedURI;
     unsigned attachedHeight;
+    bool canAttach;
 };
 
 WEBKIT_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT)
@@ -101,6 +103,9 @@
     case PROP_ATTACHED_HEIGHT:
         g_value_set_uint(value, webkit_web_inspector_get_attached_height(inspector));
         break;
+    case PROP_CAN_ATTACH:
+        g_value_set_boolean(value, webkit_web_inspector_get_can_attach(inspector));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
     }
@@ -137,6 +142,24 @@
                                                       WEBKIT_PARAM_READABLE));
 
     /**
+     * WebKitWebInspector:can-attach:
+     *
+     * Whether the @inspector can be attached to the same window that contains
+     * the inspected view.
+     *
+     * Since: 2.8
+     */
+    g_object_class_install_property(
+        gObjectClass,
+        PROP_CAN_ATTACH,
+        g_param_spec_boolean(
+            "can-attach",
+            _("Can Attach"),
+            _("Whether the inspector can be attached to the same window that contains the inspected view"),
+            FALSE,
+            WEBKIT_PARAM_READABLE));
+
+    /**
      * WebKitWebInspector::open-window:
      * @inspector: the #WebKitWebInspector on which the signal is emitted
      *
@@ -311,6 +334,15 @@
     g_object_notify(G_OBJECT(inspector), "attached-height");
 }
 
+static void didChangeAttachAvailability(WKInspectorRef, bool available, const void* clientInfo)
+{
+    WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo);
+    if (inspector->priv->canAttach == available)
+        return;
+    inspector->priv->canAttach = available;
+    g_object_notify(G_OBJECT(clientInfo), "can-attach");
+}
+
 WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
 {
     WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL));
@@ -328,7 +360,8 @@
         attach,
         detach,
         didChangeAttachedHeight,
-        nullptr // didChangeAttachedWidth
+        nullptr, // didChangeAttachedWidth
+        didChangeAttachAvailability
     };
     WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk.base);
 
@@ -371,6 +404,25 @@
 }
 
 /**
+ * webkit_web_inspector_get_can_attach:
+ * @inspector: a #WebKitWebInspector
+ *
+ * Whether the @inspector can be attached to the same window that contains
+ * the inspected view.
+ *
+ * Returns: %TRUE if there is enough room for the inspector view inside the
+ *     window that contains the inspected view, or %FALSE otherwise.
+ *
+ * Since: 2.8
+ */
+gboolean webkit_web_inspector_get_can_attach(WebKitWebInspector* inspector)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector), FALSE);
+
+    return inspector->priv->canAttach;
+}
+
+/**
  * webkit_web_inspector_is_attached:
  * @inspector: a #WebKitWebInspector
  *

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h	2014-09-30 13:38:03 UTC (rev 174105)
@@ -83,6 +83,9 @@
 WEBKIT_API guint
 webkit_web_inspector_get_attached_height (WebKitWebInspector *inspector);
 
+WEBKIT_API gboolean
+webkit_web_inspector_get_can_attach      (WebKitWebInspector* inspector);
+
 G_END_DECLS
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml	2014-09-30 13:38:03 UTC (rev 174105)
@@ -79,5 +79,10 @@
     <xi:include href="" /></xi:include>
   </index>
 
+  <index id="api-index-2-8" role="2.8">
+    <title>Index of new symbols in 2.8</title>
+    <xi:include href="" /></xi:include>
+  </index>
+
   <xi:include href="" /></xi:include>
 </book>

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2014-09-30 13:38:03 UTC (rev 174105)
@@ -904,6 +904,7 @@
 WebKitWebInspector
 webkit_web_inspector_get_web_view
 webkit_web_inspector_get_inspected_uri
+webkit_web_inspector_get_can_attach
 webkit_web_inspector_is_attached
 webkit_web_inspector_attach
 webkit_web_inspector_detach

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp	2014-09-30 13:38:03 UTC (rev 174105)
@@ -88,4 +88,11 @@
     m_client.didChangeAttachedWidth(toAPI(inspector), width, m_client.base.clientInfo);
 }
 
+void WebInspectorClientGtk::didChangeAttachAvailability(WebInspectorProxy* inspector, bool available)
+{
+    if (!m_client.didChangeAttachAvailability)
+        return;
+    m_client.didChangeAttachAvailability(toAPI(inspector), available, m_client.base.clientInfo);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h	2014-09-30 13:38:03 UTC (rev 174105)
@@ -53,6 +53,7 @@
     bool detach(WebInspectorProxy*);
     void didChangeAttachedHeight(WebInspectorProxy*, unsigned height);
     void didChangeAttachedWidth(WebInspectorProxy*, unsigned width);
+    void didChangeAttachAvailability(WebInspectorProxy*, bool available);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (174104 => 174105)


--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp	2014-09-30 13:38:03 UTC (rev 174105)
@@ -253,9 +253,9 @@
     notImplemented();
 }
 
-void WebInspectorProxy::platformAttachAvailabilityChanged(bool)
+void WebInspectorProxy::platformAttachAvailabilityChanged(bool available)
 {
-    notImplemented();
+    m_client.didChangeAttachAvailability(this, available);
 }
 
 } // namespace WebKit

Modified: trunk/Tools/ChangeLog (174104 => 174105)


--- trunk/Tools/ChangeLog	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Tools/ChangeLog	2014-09-30 13:38:03 UTC (rev 174105)
@@ -1,3 +1,16 @@
+2014-09-30  Carlos Garcia Campos  <[email protected]>
+
+        REGRESSION(r173929): [GTK] TestInspector fails after r173929
+        https://bugs.webkit.org/show_bug.cgi?id=137247
+
+        Reviewed by Philippe Normand.
+
+        Wait until can-attach property changes before trying to attach the
+        inspector after resizing the view.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestInspector.cpp:
+        (testInspectorDefault):
+
 2014-09-30  Eva Balazsfalvi  <[email protected]>
 
         Require Python 2.7 version

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestInspector.cpp (174104 => 174105)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestInspector.cpp	2014-09-30 13:33:50 UTC (rev 174104)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestInspector.cpp	2014-09-30 13:38:03 UTC (rev 174105)
@@ -125,10 +125,22 @@
         g_main_loop_run(m_mainLoop);
     }
 
+    static void canAttachChanged(InspectorTest* test)
+    {
+        g_main_loop_quit(test->m_mainLoop);
+    }
+
     void resizeViewAndAttach()
     {
         // Resize the view to make room for the inspector.
-        resizeView(gMinimumAttachedInspectorWidth, (gMinimumAttachedInspectorHeight + 1) * 4 / 3);
+        if (!webkit_web_inspector_get_can_attach(m_inspector)) {
+            unsigned long handler = g_signal_connect_swapped(m_inspector, "notify::can-attach", G_CALLBACK(canAttachChanged), this);
+            resizeView(gMinimumAttachedInspectorWidth, (gMinimumAttachedInspectorHeight + 1) * 4 / 3);
+            g_main_loop_run(m_mainLoop);
+            g_signal_handler_disconnect(m_inspector, handler);
+        }
+
+        g_assert(webkit_web_inspector_get_can_attach(m_inspector));
         webkit_web_inspector_attach(m_inspector);
     }
 
@@ -167,6 +179,7 @@
     test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(inspectorView.get()));
     g_assert(!webkit_web_inspector_is_attached(test->m_inspector));
     g_assert_cmpuint(webkit_web_inspector_get_attached_height(test->m_inspector), ==, 0);
+    g_assert(!webkit_web_inspector_get_can_attach(test->m_inspector));
     Vector<InspectorTest::InspectorEvents>& events = test->m_events;
     g_assert_cmpint(events.size(), ==, 1);
     g_assert_cmpint(events[0], ==, InspectorTest::OpenWindow);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to