Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" | |
| 6 | |
| 7 DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy() { | |
| 8 } | |
| 9 | |
| 10 DevToolsContentsResizingStrategy::~DevToolsContentsResizingStrategy() { | |
| 11 } | |
| 12 | |
| 13 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.
| |
| 14 const gfx::Size& container_size, | |
| 15 const gfx::Rect& old_devtools_bounds, | |
| 16 const gfx::Rect& old_contents_bounds, | |
| 17 gfx::Rect* new_devtools_bounds, | |
| 18 gfx::Rect* new_contents_bounds) { | |
| 19 new_devtools_bounds->SetRect( | |
| 20 0, 0, container_size.width(), container_size.height()); | |
| 21 | |
| 22 int width = std::min(container_size.width(), std::max(min_size.width(), | |
| 23 container_size.width() - insets.width())); | |
| 24 int left = std::max(0, std::min(container_size.width(), insets.left())); | |
| 25 | |
| 26 int height = std::min(container_size.height(), std::max(min_size.height(), | |
| 27 container_size.height() - insets.height())); | |
| 28 int top = std::max(0, std::min(container_size.height(), insets.top())); | |
| 29 | |
| 30 new_contents_bounds->SetRect(left, top, width, height); | |
| 31 } | |
| OLD | NEW |