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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.View} 7 * @extends {WebInspector.View}
8 */ 8 */
9 WebInspector.InspectedPagePlaceholder = function() 9 WebInspector.InspectedPagePlaceholder = function()
10 { 10 {
11 WebInspector.View.call(this); 11 WebInspector.View.call(this);
12 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._onZoomChanged, this); 12 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._onZoomChanged, this);
13 this._margins = { top: false, right: false, bottom: false, left: false }; 13 this._margins = { top: false, right: false, bottom: false, left: false };
14 this.setMinimumSize(new Size(WebInspector.InspectedPagePlaceholder.Constrain ts.Width, WebInspector.InspectedPagePlaceholder.Constraints.Height));
14 }; 15 };
15 16
16 WebInspector.InspectedPagePlaceholder.Constraints = { 17 WebInspector.InspectedPagePlaceholder.Constraints = {
17 Width: 50, 18 Width: 50,
18 Height: 50 19 Height: 50
19 }; 20 };
20 21
21 WebInspector.InspectedPagePlaceholder.MarginValue = 3; 22 WebInspector.InspectedPagePlaceholder.MarginValue = 3;
22 23
23 WebInspector.InspectedPagePlaceholder.prototype = { 24 WebInspector.InspectedPagePlaceholder.prototype = {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 window.cancelAnimationFrame(this._updateId); 76 window.cancelAnimationFrame(this._updateId);
76 this._updateId = window.requestAnimationFrame(this._update.bind(this )); 77 this._updateId = window.requestAnimationFrame(this._update.bind(this ));
77 } 78 }
78 }, 79 },
79 80
80 _update: function() 81 _update: function()
81 { 82 {
82 delete this._updateId; 83 delete this._updateId;
83 84
84 var zoomFactor = WebInspector.zoomManager.zoomFactor(); 85 var zoomFactor = WebInspector.zoomManager.zoomFactor();
86 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
87 var totalHeight = document.body.offsetHeight;
88 var boundingRect = this.element.getBoundingClientRect();
89
90 var insets = {
91 top: Math.round(boundingRect.top * zoomFactor),
92 left: Math.round(boundingRect.left * zoomFactor),
93 bottom: Math.round((totalHeight - boundingRect.bottom) * zoomFactor) ,
94 right: Math.round((totalWidth - boundingRect.right) * zoomFactor)};
85 95
86 var marginValue = Math.round(WebInspector.InspectedPagePlaceholder.Margi nValue / zoomFactor); 96 var marginValue = Math.round(WebInspector.InspectedPagePlaceholder.Margi nValue / zoomFactor);
87 var insets = {
88 top: this._margins.top ? marginValue : 0,
89 left: this._margins.left ? marginValue : 0,
90 right: this._margins.right ? marginValue : 0,
91 bottom: this._margins.bottom ? marginValue : 0};
92
93 var minSize = { 97 var minSize = {
94 width: WebInspector.InspectedPagePlaceholder.Constraints.Width - Mat h.round(insets.left * zoomFactor) - Math.round(insets.right * zoomFactor), 98 width: WebInspector.InspectedPagePlaceholder.Constraints.Width - (th is._margins.left ? marginValue : 0) - (this._margins.right ? marginValue : 0),
95 height: WebInspector.InspectedPagePlaceholder.Constraints.Height - M ath.round(insets.top * zoomFactor) - Math.round(insets.bottom * zoomFactor)}; 99 height: WebInspector.InspectedPagePlaceholder.Constraints.Height - ( this._margins.top ? marginValue : 0) - (this._margins.bottom ? marginValue : 0)} ;
96
97 // This view assumes it's always inside the main split view element, not a sidebar.
98 var view = this;
99 while (view) {
100 if ((view instanceof WebInspector.SplitView) && view.sidebarSide())
101 insets[view.sidebarSide()] += view.preferredSidebarSize();
102 view = view.parentView();
103 }
104 100
105 InspectorFrontendHost.setContentsResizingStrategy(insets, minSize); 101 InspectorFrontendHost.setContentsResizingStrategy(insets, minSize);
106 }, 102 },
107 103
108 __proto__: WebInspector.View.prototype 104 __proto__: WebInspector.View.prototype
109 }; 105 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698