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

Unified Diff: chrome/browser/devtools/devtools_contents_resizing_strategy.cc

Issue 137483007: [DevTools] Use special resizing strategy instead of insets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
Index: chrome/browser/devtools/devtools_contents_resizing_strategy.cc
diff --git a/chrome/browser/devtools/devtools_contents_resizing_strategy.cc b/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6b093c2b537e675909010db480d648f7a9bdd7eb
--- /dev/null
+++ b/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
@@ -0,0 +1,31 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
+
+DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy() {
+}
+
+DevToolsContentsResizingStrategy::~DevToolsContentsResizingStrategy() {
+}
+
+void DevToolsContentsResizingStrategy::Apply(
pfeldman 2014/01/31 11:28:30 This looks more like a static utility method
dgozman 2014/01/31 13:33:13 Made this a class.
+ const gfx::Size& container_size,
+ const gfx::Rect& old_devtools_bounds,
+ const gfx::Rect& old_contents_bounds,
+ gfx::Rect* new_devtools_bounds,
+ gfx::Rect* new_contents_bounds) {
+ new_devtools_bounds->SetRect(
+ 0, 0, container_size.width(), container_size.height());
+
+ int width = std::min(container_size.width(), std::max(min_size.width(),
+ container_size.width() - insets.width()));
+ int left = std::max(0, std::min(container_size.width(), insets.left()));
+
+ int height = std::min(container_size.height(), std::max(min_size.height(),
+ container_size.height() - insets.height()));
+ int top = std::max(0, std::min(container_size.height(), insets.top()));
+
+ new_contents_bounds->SetRect(left, top, width, height);
+}

Powered by Google App Engine
This is Rietveld 408576698