Title: [124479] trunk/Source/WebKit2
Revision
124479
Author
[email protected]
Date
2012-08-02 10:44:28 -0700 (Thu, 02 Aug 2012)

Log Message

[GTK] Inspector should set a default attached height before being attached
https://bugs.webkit.org/show_bug.cgi?id=90767

Reviewed by Xan Lopez.

We are currently using the minimum attached height in
WebKitWebViewBase as the default height for the inspector when
attached. It would be easier for WebKitWebViewBase and embedders
implementing attach() if the inspector already had an attached
height set when it's being attached.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseContainerAdd): Don't initialize
inspectorViewHeight.
(webkitWebViewBaseSetInspectorViewHeight): Allow to set the
inspector view height before having an inpector view, but only
queue a resize when the view already has an inspector view.
* UIProcess/API/gtk/tests/TestInspector.cpp:
(testInspectorDefault):
(testInspectorManualAttachDetach):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformAttach): Set the default
attached height before attach the inspector view.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (124478 => 124479)


--- trunk/Source/WebKit2/ChangeLog	2012-08-02 17:40:27 UTC (rev 124478)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-02 17:44:28 UTC (rev 124479)
@@ -1,3 +1,29 @@
+2012-08-02  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Inspector should set a default attached height before being attached
+        https://bugs.webkit.org/show_bug.cgi?id=90767
+
+        Reviewed by Xan Lopez.
+
+        We are currently using the minimum attached height in
+        WebKitWebViewBase as the default height for the inspector when
+        attached. It would be easier for WebKitWebViewBase and embedders
+        implementing attach() if the inspector already had an attached
+        height set when it's being attached.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseContainerAdd): Don't initialize
+        inspectorViewHeight.
+        (webkitWebViewBaseSetInspectorViewHeight): Allow to set the
+        inspector view height before having an inpector view, but only
+        queue a resize when the view already has an inspector view.
+        * UIProcess/API/gtk/tests/TestInspector.cpp:
+        (testInspectorDefault):
+        (testInspectorManualAttachDetach):
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformAttach): Set the default
+        attached height before attach the inspector view.
+
 2012-08-02  Dinu Jacob  <[email protected]>
 
         WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (124478 => 124479)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-08-02 17:40:27 UTC (rev 124478)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-08-02 17:44:28 UTC (rev 124479)
@@ -101,9 +101,6 @@
 
 G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER)
 
-// Keep this in sync with the value minimumAttachedHeight in WebInspectorProxy.
-static const unsigned gMinimumAttachedInspectorHeight = 250;
-
 static void webkitWebViewBaseNotifyResizerSizeForWindow(WebKitWebViewBase* webViewBase, GtkWindow* window)
 {
     gboolean resizerVisible;
@@ -190,7 +187,6 @@
         && WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) {
         ASSERT(!priv->inspectorView);
         priv->inspectorView = widget;
-        priv->inspectorViewHeight = gMinimumAttachedInspectorHeight;
     } else {
         GtkAllocation childAllocation;
         gtk_widget_get_allocation(widget, &childAllocation);
@@ -773,12 +769,11 @@
 
 void webkitWebViewBaseSetInspectorViewHeight(WebKitWebViewBase* webkitWebViewBase, unsigned height)
 {
-    if (!webkitWebViewBase->priv->inspectorView)
-        return;
     if (webkitWebViewBase->priv->inspectorViewHeight == height)
         return;
     webkitWebViewBase->priv->inspectorViewHeight = height;
-    gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
+    if (webkitWebViewBase->priv->inspectorView)
+        gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
 }
 
 void webkitWebViewBaseSetActiveContextMenuProxy(WebKitWebViewBase* webkitWebViewBase, WebContextMenuProxyGtk* contextMenuProxy)

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestInspector.cpp (124478 => 124479)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestInspector.cpp	2012-08-02 17:40:27 UTC (rev 124478)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestInspector.cpp	2012-08-02 17:44:28 UTC (rev 124479)
@@ -22,8 +22,6 @@
 #include "WebViewTest.h"
 #include <wtf/gobject/GRefPtr.h>
 
-static const unsigned gMinimumAttachedInspectorHeight = 250;
-
 class InspectorTest: public WebViewTest {
 public:
     MAKE_GLIB_TEST_FIXTURE(InspectorTest);
@@ -181,6 +179,7 @@
 
     test->resizeViewAndAttach();
     g_assert(webkit_web_inspector_is_attached(test->m_inspector));
+    g_assert_cmpuint(webkit_web_inspector_get_attached_height(test->m_inspector), >=, InspectorTest::gMinimumAttachedInspectorHeight);
     events = test->m_events;
     g_assert_cmpint(events.size(), ==, 1);
     g_assert_cmpint(events[0], ==, InspectorTest::Attach);
@@ -258,6 +257,7 @@
             gtk_widget_show_all(pane);
         } else
             pane = gtk_bin_get_child(GTK_BIN(m_parentWindow));
+        gtk_paned_set_position(GTK_PANED(pane), webkit_web_inspector_get_attached_height(m_inspector));
         gtk_paned_add2(GTK_PANED(pane), GTK_WIDGET(inspectorView.get()));
 
         return InspectorTest::attach();
@@ -301,6 +301,7 @@
 
     test->resizeViewAndAttach();
     g_assert(webkit_web_inspector_is_attached(test->m_inspector));
+    g_assert_cmpuint(webkit_web_inspector_get_attached_height(test->m_inspector), >=, InspectorTest::gMinimumAttachedInspectorHeight);
     events = test->m_events;
     g_assert_cmpint(events.size(), ==, 1);
     g_assert_cmpint(events[0], ==, InspectorTest::Attach);

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (124478 => 124479)


--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp	2012-08-02 17:40:27 UTC (rev 124478)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp	2012-08-02 17:44:28 UTC (rev 124479)
@@ -182,6 +182,11 @@
         m_inspectorWindow = 0;
     }
 
+    // Set a default attached height based on InspectorFrontendClientLocal.
+    static const unsigned defaultAttachedHeight = 300;
+    unsigned maximumAttachedHeight = platformInspectedWindowHeight() * 3 / 4;
+    platformSetAttachedWindowHeight(std::max(minimumAttachedHeight, std::min(defaultAttachedHeight, maximumAttachedHeight)));
+
     if (m_client.attach(this))
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to