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

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

Issue 221283009: [DevTools] Pass inspected page bounds from frontend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test on mac Created 6 years, 7 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 519278b6590c7a4e870b3b5daa36bd14733bdab7..64490e9269b830f312750f4e186629c67b80f10d 100644
--- a/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
+++ b/chrome/browser/devtools/devtools_contents_resizing_strategy.cc
@@ -15,15 +15,23 @@ DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy(
min_size_(min_size) {
}
+DevToolsContentsResizingStrategy::DevToolsContentsResizingStrategy(
+ const gfx::Rect& bounds)
+ : bounds_(bounds) {
+}
+
+
void DevToolsContentsResizingStrategy::CopyFrom(
const DevToolsContentsResizingStrategy& strategy) {
insets_ = strategy.insets();
min_size_ = strategy.min_size();
+ bounds_ = strategy.bounds();
}
bool DevToolsContentsResizingStrategy::Equals(
const DevToolsContentsResizingStrategy& strategy) {
- return insets_ == strategy.insets() && min_size_ == strategy.min_size();
+ return insets_ == strategy.insets() && min_size_ == strategy.min_size() &&
+ bounds_ == strategy.bounds();
}
void ApplyDevToolsContentsResizingStrategy(
@@ -38,6 +46,16 @@ void ApplyDevToolsContentsResizingStrategy(
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);
+ return;
+ }
int width = std::max(0, container_size.width() - insets.width());
int left = insets.left();

Powered by Google App Engine
This is Rietveld 408576698