Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2995)

Unified Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 137483007: [DevTools] Use special resizing strategy instead of insets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed more comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index c038e11eec3ffac823ac159ed50f8c7da3581b37..90499eea81bddeb075b577072b885c55254e71dc 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -2280,8 +2280,9 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) {
HideDevToolsContainer();
devtools_window_ = new_devtools_window;
- contents_insets_ = devtools_window_ ? devtools_window_->GetContentsInsets() :
- gfx::Insets();
+ contents_resizing_strategy_.CopyFrom(devtools_window_ ?
+ devtools_window_->GetContentsResizingStrategy() :
+ DevToolsContentsResizingStrategy());
if (should_show)
ShowDevToolsContainer();
@@ -2306,22 +2307,31 @@ void BrowserWindowGtk::HideDevToolsContainer() {
void BrowserWindowGtk::OnDevToolsContainerSetFloatingPosition(
GtkFloatingContainer* container, GtkAllocation* allocation,
BrowserWindowGtk* browser_window) {
- gfx::Insets insets = browser_window->contents_insets_;
-
- int contents_width = std::max(0, allocation->width - insets.width());
- int contents_height = std::max(0, allocation->height - insets.height());
- int contents_x = std::min(insets.left(), allocation->width);
- int contents_y = std::min(insets.top(), allocation->height);
+ GtkAllocation contents_allocation;
+ gtk_widget_get_allocation(browser_window->contents_container_->widget(),
+ &contents_allocation);
+
+ gfx::Size container_size(allocation->width, allocation->height);
+ gfx::Rect old_devtools_bounds(0, 0, allocation->width, allocation->height);
+ gfx::Rect old_contents_bounds(contents_allocation.x, contents_allocation.y,
+ contents_allocation.width, contents_allocation.height);
+ gfx::Rect new_devtools_bounds;
+ gfx::Rect new_contents_bounds;
+
+ ApplyDevToolsContentsResizingStrategy(
+ browser_window->contents_resizing_strategy_, container_size,
+ old_devtools_bounds, old_contents_bounds,
+ &new_devtools_bounds, &new_contents_bounds);
gtk_widget_set_size_request(browser_window->contents_container_->widget(),
- contents_width, contents_height);
+ new_contents_bounds.width(), new_contents_bounds.height());
GValue value = { 0, };
g_value_init(&value, G_TYPE_INT);
- g_value_set_int(&value, contents_x);
+ g_value_set_int(&value, new_contents_bounds.x());
gtk_container_child_set_property(GTK_CONTAINER(container),
browser_window->contents_container_->widget(), "x", &value);
- g_value_set_int(&value, contents_y);
+ g_value_set_int(&value, new_contents_bounds.y());
gtk_container_child_set_property(GTK_CONTAINER(container),
browser_window->contents_container_->widget(), "y", &value);
g_value_unset(&value);
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698