Changeset 160435 in webkit
- Timestamp:
- Dec 11, 2013 8:40:43 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160434 r160435 1 2013-12-11 Gustavo Noronha Silva <gns@gnome.org> 2 3 [GTK] Support right-side attachment of the inspector 4 https://bugs.webkit.org/show_bug.cgi?id=124126 5 6 Reviewed by Carlos Garcia Campos. 7 8 * UIProcess/API/C/gtk/WKInspectorClientGtk.h: add changed attached width callback. 9 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 10 (webkitWebViewBaseAddWebInspector): take attachment side parameter into account when adding the 11 inspector view. 12 (webkitWebViewBaseContainerRemove): renamed inspectorViewHeight to inspectorViewSize. 13 (resizeWebKitWebViewBaseFromAllocation): take attachment side into account when allocating the 14 sizes for the inspector view and the inspected view. 15 (webkitWebViewBaseSetInspectorViewSize): renamed from webkitWebViewBaseSetInspectorViewHeight. 16 * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 17 * UIProcess/gtk/WebInspectorClientGtk.cpp: 18 (WebKit::WebInspectorClientGtk::didChangeAttachedWidth): notify client that view width has changed. 19 * UIProcess/gtk/WebInspectorClientGtk.h: 20 * UIProcess/gtk/WebInspectorProxyGtk.cpp: 21 (WebKit::WebInspectorProxy::platformAttach): use attachment side for setting the default size 22 for the inspector view. 23 (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): use the new generic SetInspectorViewSize. 24 (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth): allow setting the inspector view width. 25 1 26 2013-12-11 Brendan Long <b.long@cablelabs.com> 2 27 -
trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h
r160075 r160435 37 37 typedef void (*WKInspectorClientGtkInspectedURLChangedCallback)(WKInspectorRef inspector, WKStringRef url, const void* clientInfo); 38 38 typedef void (*WKInspectorClientGtkDidChangeAttachedHeightCallback)(WKInspectorRef inspector, unsigned height, const void* clientInfo); 39 typedef void (*WKInspectorClientGtkDidChangeAttachedWidthCallback)(WKInspectorRef inspector, unsigned width, const void* clientInfo); 39 40 40 41 typedef struct WKInspectorClientGtkBase { … … 53 54 WKInspectorClientGtkInspectorCallback detach; 54 55 WKInspectorClientGtkDidChangeAttachedHeightCallback didChangeAttachedHeight; 56 WKInspectorClientGtkDidChangeAttachedWidthCallback didChangeAttachedWidth; 55 57 } WKInspectorClientGtkV0; 56 58 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r160303 r160435 3 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 4 4 * Copyright (C) 2011 Igalia S.L. 5 * Copyright (C) 2013 Gustavo Noronha Silva <gns@gnome.org>. 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 106 107 GtkWidget* authenticationDialog; 107 108 GtkWidget* inspectorView; 108 unsigned inspectorViewHeight; 109 AttachmentSide inspectorAttachmentSide; 110 unsigned inspectorViewSize; 109 111 GOwnPtr<GdkEvent> contextMenuEvent; 110 112 WebContextMenuProxyGtk* activeContextMenuProxy; … … 321 323 } 322 324 323 void webkitWebViewBaseAddWebInspector(WebKitWebViewBase* webViewBase, GtkWidget* inspector) 324 { 325 void webkitWebViewBaseAddWebInspector(WebKitWebViewBase* webViewBase, GtkWidget* inspector, AttachmentSide attachmentSide) 326 { 327 if (webViewBase->priv->inspectorView == inspector && webViewBase->priv->inspectorAttachmentSide == attachmentSide) 328 return; 329 330 webViewBase->priv->inspectorAttachmentSide = attachmentSide; 331 332 if (webViewBase->priv->inspectorView == inspector) { 333 gtk_widget_queue_resize(GTK_WIDGET(webViewBase)); 334 return; 335 } 336 325 337 webViewBase->priv->inspectorView = inspector; 326 338 gtk_container_add(GTK_CONTAINER(webViewBase), inspector); … … 338 350 if (priv->inspectorView == widget) { 339 351 priv->inspectorView = 0; 340 priv->inspectorView Height= 0;352 priv->inspectorViewSize = 0; 341 353 } else if (priv->authenticationDialog == widget) { 342 354 priv->authenticationDialog = 0; … … 481 493 WebKitWebViewBasePrivate* priv = webViewBase->priv; 482 494 if (priv->inspectorView) { 483 int inspectorViewHeight = std::min(static_cast<int>(priv->inspectorViewHeight), allocation->height);484 495 GtkAllocation childAllocation = viewRect; 485 childAllocation.y = allocation->height - inspectorViewHeight; 486 childAllocation.height = inspectorViewHeight; 496 497 if (priv->inspectorAttachmentSide == AttachmentSideBottom) { 498 int inspectorViewHeight = std::min(static_cast<int>(priv->inspectorViewSize), allocation->height); 499 childAllocation.x = 0; 500 childAllocation.y = allocation->height - inspectorViewHeight; 501 childAllocation.height = inspectorViewHeight; 502 viewRect.setHeight(std::max(allocation->height - inspectorViewHeight, 1)); 503 } else { 504 int inspectorViewWidth = std::min(static_cast<int>(priv->inspectorViewSize), allocation->width); 505 childAllocation.y = 0; 506 childAllocation.x = allocation->width - inspectorViewWidth; 507 childAllocation.width = inspectorViewWidth; 508 viewRect.setWidth(std::max(allocation->width - inspectorViewWidth, 1)); 509 } 510 487 511 gtk_widget_size_allocate(priv->inspectorView, &childAllocation); 488 489 viewRect.setHeight(std::max(allocation->height - inspectorViewHeight, 1));490 512 } 491 513 … … 1047 1069 } 1048 1070 1049 void webkitWebViewBaseSetInspectorView Height(WebKitWebViewBase* webkitWebViewBase, unsigned height)1050 { 1051 if (webkitWebViewBase->priv->inspectorView Height == height)1052 return; 1053 webkitWebViewBase->priv->inspectorView Height = height;1071 void webkitWebViewBaseSetInspectorViewSize(WebKitWebViewBase* webkitWebViewBase, unsigned size) 1072 { 1073 if (webkitWebViewBase->priv->inspectorViewSize == size) 1074 return; 1075 webkitWebViewBase->priv->inspectorViewSize = size; 1054 1076 if (webkitWebViewBase->priv->inspectorView) 1055 1077 gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase)); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
r160075 r160435 30 30 31 31 #include "WebContextMenuProxyGtk.h" 32 #include "WebInspectorProxy.h" 32 33 #include "WebKitPrivate.h" 33 34 #include "WebKitWebViewBase.h" … … 46 47 void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*); 47 48 void webkitWebViewBaseInitializeFullScreenClient(WebKitWebViewBase*, const WKFullScreenClientGtkBase*); 48 void webkitWebViewBaseSetInspectorView Height(WebKitWebViewBase*, unsigned height);49 void webkitWebViewBaseSetInspectorViewSize(WebKitWebViewBase*, unsigned size); 49 50 void webkitWebViewBaseSetActiveContextMenuProxy(WebKitWebViewBase*, WebKit::WebContextMenuProxyGtk*); 50 51 WebKit::WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebViewBase*); … … 71 72 void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase*, GtkWidget* authDialog); 72 73 void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase*); 73 void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector );74 void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector, WebKit::AttachmentSide); 74 75 75 76 #endif // WebKitWebViewBasePrivate_h -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp
r160075 r160435 82 82 } 83 83 84 void WebInspectorClientGtk::didChangeAttachedWidth(WebInspectorProxy* inspector, unsigned width) 85 { 86 if (!m_client.didChangeAttachedWidth) 87 return; 88 m_client.didChangeAttachedWidth(toAPI(inspector), width, m_client.base.clientInfo); 89 } 90 84 91 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h
r160075 r160435 53 53 bool detach(WebInspectorProxy*); 54 54 void didChangeAttachedHeight(WebInspectorProxy*, unsigned height); 55 void didChangeAttachedWidth(WebInspectorProxy*, unsigned width); 55 56 }; 56 57 -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
r160075 r160435 3 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 4 4 * Copyright (C) 2012 Igalia S.L. 5 * Copyright (C) 2013 Gustavo Noronha Silva <gns@gnome.org>. 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 177 178 } 178 179 179 // Set a default attached height based on InspectorFrontendClientLocal. 180 static const unsigned defaultAttachedHeight = 300; 181 unsigned maximumAttachedHeight = platformInspectedWindowHeight() * 3 / 4; 182 platformSetAttachedWindowHeight(std::max(minimumAttachedHeight, std::min(defaultAttachedHeight, maximumAttachedHeight))); 180 // Set a default attached size based on InspectorFrontendClientLocal. 181 static const unsigned defaultAttachedSize = 300; 182 if (m_attachmentSide == AttachmentSideBottom) { 183 unsigned maximumAttachedHeight = platformInspectedWindowHeight() * 3 / 4; 184 platformSetAttachedWindowHeight(std::max(minimumAttachedHeight, std::min(defaultAttachedSize, maximumAttachedHeight))); 185 } else { 186 unsigned maximumAttachedWidth = platformInspectedWindowWidth() * 3 / 4; 187 platformSetAttachedWindowWidth(std::max(minimumAttachedWidth, std::min(defaultAttachedSize, maximumAttachedWidth))); 188 } 183 189 184 190 if (m_client.attach(this)) 185 191 return; 186 192 187 webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_page->viewWidget()), m_inspectorView );193 webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_page->viewWidget()), m_inspectorView, m_attachmentSide); 188 194 gtk_widget_show(m_inspectorView); 189 195 } … … 213 219 214 220 m_client.didChangeAttachedHeight(this, height); 215 webkitWebViewBaseSetInspectorViewHeight(WEBKIT_WEB_VIEW_BASE(m_page->viewWidget()), height); 216 } 217 218 void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned) 219 { 220 notImplemented(); 221 webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(m_page->viewWidget()), height); 222 } 223 224 void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned width) 225 { 226 if (!m_isAttached) 227 return; 228 229 m_client.didChangeAttachedWidth(this, width); 230 webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(m_page->viewWidget()), width); 221 231 } 222 232
Note: See TracChangeset
for help on using the changeset viewer.