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); |
+} |