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

Unified Diff: chrome/browser/ui/views/frame/contents_layout_manager.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/views/frame/contents_layout_manager.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/contents_layout_manager.cc
diff --git a/chrome/browser/ui/views/frame/contents_layout_manager.cc b/chrome/browser/ui/views/frame/contents_layout_manager.cc
index 2d018bd2b3a09cc1d09b0a32f64309190b636948..443d31abe22eefdcb370820b43ac185ddb908e4c 100644
--- a/chrome/browser/ui/views/frame/contents_layout_manager.cc
+++ b/chrome/browser/ui/views/frame/contents_layout_manager.cc
@@ -18,11 +18,12 @@ ContentsLayoutManager::ContentsLayoutManager(
ContentsLayoutManager::~ContentsLayoutManager() {
}
-void ContentsLayoutManager::SetContentsViewInsets(const gfx::Insets& insets) {
- if (insets_ == insets)
+void ContentsLayoutManager::SetContentsResizingStrategy(
+ const DevToolsContentsResizingStrategy& strategy) {
+ if (strategy_.Equals(strategy))
return;
- insets_ = insets;
+ strategy_.CopyFrom(strategy);
if (host_)
host_->InvalidateLayout();
}
@@ -42,15 +43,23 @@ void ContentsLayoutManager::Layout(views::View* contents_container) {
int top = active_top_margin_;
int height = std::max(0, contents_container->height() - top);
int width = contents_container->width();
- devtools_view_->SetBounds(0, top, width, height);
-
- int contents_width = std::max(0, width - insets_.width());
- int contents_height = std::max(0, height - insets_.height());
- contents_view_->SetBounds(
- std::min(insets_.left(), width),
- top + std::min(insets_.top(), height),
- contents_width,
- contents_height);
+
+ gfx::Size container_size(width, height);
+ gfx::Rect old_devtools_bounds(devtools_view_->bounds());
+ gfx::Rect old_contents_bounds(contents_view_->bounds());
+ gfx::Rect new_devtools_bounds;
+ gfx::Rect new_contents_bounds;
+
+ old_devtools_bounds.Offset(0, -top);
+ old_contents_bounds.Offset(0, -top);
+ ApplyDevToolsContentsResizingStrategy(strategy_, container_size,
+ old_devtools_bounds, old_contents_bounds,
+ &new_devtools_bounds, &new_contents_bounds);
+ new_devtools_bounds.Offset(0, top);
+ new_contents_bounds.Offset(0, top);
+
+ devtools_view_->SetBoundsRect(new_devtools_bounds);
+ contents_view_->SetBoundsRect(new_contents_bounds);
}
gfx::Size ContentsLayoutManager::GetPreferredSize(views::View* host) {
« no previous file with comments | « chrome/browser/ui/views/frame/contents_layout_manager.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698