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

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

Issue 440663003: DevTools: remove unused resizing strategy code paths, make it solely bounds-based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 6 years, 4 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
index 64490e9269b830f312750f4e186629c67b80f10d..b11cd81456cd54f7622afcfb5480a4a00a13b0b1 100644
--- a/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
+++ b/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
@@ -6,80 +6,48 @@
#include <algorithm>
-DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy() {
-}
-
-DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy(
- const gfx::Insets& insets, const gfx::Size& min_size)
- : insets_(insets),
- min_size_(min_size) {
+DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy()
+ : hide_inspected_contents_(false) {
}
DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy(
const gfx::Rect& bounds)
- : bounds_(bounds) {
+ : bounds_(bounds),
+ hide_inspected_contents_(bounds_.IsEmpty() && !bounds_.x() &&
+ !bounds_.y()) {
}
void DevToolsContentsResizingStrategy::CopyFrom(
const DevToolsContentsResizingStrategy& strategy) {
- insets_ = strategy.insets();
- min_size_ = strategy.min_size();
bounds_ = strategy.bounds();
+ hide_inspected_contents_ = strategy.hide_inspected_contents();
}
bool DevToolsContentsResizingStrategy::Equals(
const DevToolsContentsResizingStrategy& strategy) {
- return insets_ == strategy.insets() && min_size_ == strategy.min_size() &&
- bounds_ == strategy.bounds();
+ return bounds_ == strategy.bounds() &&
+ hide_inspected_contents_ == strategy.hide_inspected_contents();
}
void ApplyDevToolsContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy,
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());
- const gfx::Insets& insets = strategy.insets();
- const gfx::Size& min_size = strategy.min_size();
const gfx::Rect& bounds = strategy.bounds();
-
- if (!bounds.size().IsEmpty()) {
- int left = std::min(bounds.x(), container_size.width());
- int top = std::min(bounds.y(), container_size.height());
- int width = std::min(bounds.width(), container_size.width() - left);
- int height = std::min(bounds.height(), container_size.height() - top);
- new_contents_bounds->SetRect(left, top, width, height);
+ if (bounds.size().IsEmpty() && !strategy.hide_inspected_contents()) {
+ new_contents_bounds->SetRect(
+ 0, 0, container_size.width(), container_size.height());
return;
}
- int width = std::max(0, container_size.width() - insets.width());
- int left = insets.left();
- if (width < min_size.width() && insets.width() > 0) {
- int min_width = std::min(min_size.width(), container_size.width());
- int insets_width = container_size.width() - min_width;
- int insets_decrease = insets.width() - insets_width;
- // Decrease both left and right insets proportionally.
- left -= insets_decrease * insets.left() / insets.width();
- width = min_width;
- }
- left = std::max(0, std::min(container_size.width(), left));
-
- int height = std::max(0, container_size.height() - insets.height());
- int top = insets.top();
- if (height < min_size.height() && insets.height() > 0) {
- int min_height = std::min(min_size.height(), container_size.height());
- int insets_height = container_size.height() - min_height;
- int insets_decrease = insets.height() - insets_height;
- // Decrease both top and bottom insets proportionally.
- top -= insets_decrease * insets.top() / insets.height();
- height = min_height;
- }
- top = std::max(0, std::min(container_size.height(), top));
-
+ int left = std::min(bounds.x(), container_size.width());
+ int top = std::min(bounds.y(), container_size.height());
+ int width = std::min(bounds.width(), container_size.width() - left);
+ int height = std::min(bounds.height(), container_size.height() - top);
new_contents_bounds->SetRect(left, top, width, height);
}

Powered by Google App Engine
This is Rietveld 408576698