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

Unified Diff: Source/devtools/front_end/InspectedPagePlaceholder.js

Issue 197823010: [DevTools] Add minimum size to WebInspector.View. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@splitdip2
Patch Set: Created 6 years, 9 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: Source/devtools/front_end/InspectedPagePlaceholder.js
diff --git a/Source/devtools/front_end/InspectedPagePlaceholder.js b/Source/devtools/front_end/InspectedPagePlaceholder.js
index 0251747b475d88a5e49c7e43ceb94658b75c24c0..cd52809e3fd9469cee63eba615ba67de2455f39c 100644
--- a/Source/devtools/front_end/InspectedPagePlaceholder.js
+++ b/Source/devtools/front_end/InspectedPagePlaceholder.js
@@ -11,6 +11,7 @@ WebInspector.InspectedPagePlaceholder = function()
WebInspector.View.call(this);
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
this._margins = { top: false, right: false, bottom: false, left: false };
+ this.setMinimumSize(new Size(WebInspector.InspectedPagePlaceholder.Constraints.Width, WebInspector.InspectedPagePlaceholder.Constraints.Height));
};
WebInspector.InspectedPagePlaceholder.Constraints = {
@@ -82,25 +83,20 @@ WebInspector.InspectedPagePlaceholder.prototype = {
delete this._updateId;
var zoomFactor = WebInspector.zoomManager.zoomFactor();
+ var totalWidth = document.body.offsetWidth;
pfeldman 2014/03/14 06:23:10 You change this code in every CL :)
dgozman 2014/03/14 15:55:15 Now we have improved system on Mac, and I have mor
+ var totalHeight = document.body.offsetHeight;
+ var boundingRect = this.element.getBoundingClientRect();
- var marginValue = Math.round(WebInspector.InspectedPagePlaceholder.MarginValue / zoomFactor);
var insets = {
- top: this._margins.top ? marginValue : 0,
- left: this._margins.left ? marginValue : 0,
- right: this._margins.right ? marginValue : 0,
- bottom: this._margins.bottom ? marginValue : 0};
+ top: Math.round(boundingRect.top * zoomFactor),
+ left: Math.round(boundingRect.left * zoomFactor),
+ bottom: Math.round((totalHeight - boundingRect.bottom) * zoomFactor),
+ right: Math.round((totalWidth - boundingRect.right) * zoomFactor)};
+ var marginValue = Math.round(WebInspector.InspectedPagePlaceholder.MarginValue / zoomFactor);
var minSize = {
- width: WebInspector.InspectedPagePlaceholder.Constraints.Width - Math.round(insets.left * zoomFactor) - Math.round(insets.right * zoomFactor),
- height: WebInspector.InspectedPagePlaceholder.Constraints.Height - Math.round(insets.top * zoomFactor) - Math.round(insets.bottom * zoomFactor)};
-
- // This view assumes it's always inside the main split view element, not a sidebar.
- var view = this;
- while (view) {
- if ((view instanceof WebInspector.SplitView) && view.sidebarSide())
- insets[view.sidebarSide()] += view.preferredSidebarSize();
- view = view.parentView();
- }
+ width: WebInspector.InspectedPagePlaceholder.Constraints.Width - (this._margins.left ? marginValue : 0) - (this._margins.right ? marginValue : 0),
+ height: WebInspector.InspectedPagePlaceholder.Constraints.Height - (this._margins.top ? marginValue : 0) - (this._margins.bottom ? marginValue : 0)};
InspectorFrontendHost.setContentsResizingStrategy(insets, minSize);
},

Powered by Google App Engine
This is Rietveld 408576698