Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Emulation.InspectedPagePlaceholder = class extends UI.Widget { | 7 Emulation.InspectedPagePlaceholder = class extends UI.Widget { |
| 8 constructor() { | 8 constructor() { |
| 9 super(true); | 9 super(true); |
| 10 this.registerRequiredCSS('emulation/inspectedPagePlaceholder.css'); | 10 this.registerRequiredCSS('emulation/inspectedPagePlaceholder.css'); |
| 11 UI.zoomManager.addEventListener(UI.ZoomManager.Events.ZoomChanged, this._sch eduleUpdate, this); | 11 UI.zoomManager.addEventListener(UI.ZoomManager.Events.ZoomChanged, this._sch eduleUpdate, this); |
| 12 this._margins = {top: 0, right: 0, bottom: 0, left: 0}; | 12 this._margins = {top: 0, right: 0, bottom: 0, left: 0}; |
| 13 this.restoreMinimumSizeAndMargins(); | 13 this.restoreMinimumSizeAndMargins(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 _findMargins() { | 16 _findMargins() { |
| 17 var margins = {top: 0, right: 0, bottom: 0, left: 0}; | 17 var margins = {top: 0, right: 0, bottom: 0, left: 0}; |
| 18 | 18 |
| 19 if (this._useMargins) { | 19 if (this._useMargins) { |
| 20 var adjacent = {top: true, right: true, bottom: true, left: true}; | 20 var adjacent = {top: true, right: true, bottom: true, left: true}; |
| 21 var widget = this; | 21 var widget = this; |
| 22 while (widget.parentWidget()) { | 22 while (widget.parentWidget()) { |
| 23 var parent = widget.parentWidget(); | 23 var parent = widget.parentWidget(); |
| 24 // This view assumes it's always inside the main split widget element, n ot a sidebar. | 24 // This view assumes it's always inside the main split widget element, n ot a sidebar. |
| 25 // Every parent which is not a split widget, must be of the same size as this widget. | 25 // Every parent which is not a split widget, must be of the same size as this widget. |
| 26 if (parent instanceof UI.SplitWidget) { | 26 if (parent instanceof UI.SplitWidget) { |
| 27 var side = parent.sidebarSide(); | 27 var side = parent.sidebarSide(); |
| 28 if (adjacent[side] && !parent.hasCustomResizer() && parent.isResizable ()) | |
| 29 margins[side] = Emulation.InspectedPagePlaceholder.MarginValue; | |
|
dgozman
2017/01/04 18:11:22
Remove everything about margins from this file now
einbinder
2017/01/05 20:41:00
Done.
| |
| 30 adjacent[side] = false; | 28 adjacent[side] = false; |
| 31 } | 29 } |
| 32 widget = parent; | 30 widget = parent; |
| 33 } | 31 } |
| 34 } | 32 } |
| 35 | 33 |
| 36 if (this._margins.top !== margins.top || this._margins.left !== margins.left || | 34 if (this._margins.top !== margins.top || this._margins.left !== margins.left || |
| 37 this._margins.right !== margins.right || this._margins.bottom !== margin s.bottom) { | 35 this._margins.right !== margins.right || this._margins.bottom !== margin s.bottom) { |
| 38 this._margins = margins; | 36 this._margins = margins; |
| 39 this._scheduleUpdate(); | 37 this._scheduleUpdate(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 width: Math.max(1, Math.round(rect.width)) | 87 width: Math.max(1, Math.round(rect.width)) |
| 90 }; | 88 }; |
| 91 this.dispatchEventToListeners(Emulation.InspectedPagePlaceholder.Events.Upda te, bounds); | 89 this.dispatchEventToListeners(Emulation.InspectedPagePlaceholder.Events.Upda te, bounds); |
| 92 } | 90 } |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 /** @enum {symbol} */ | 93 /** @enum {symbol} */ |
| 96 Emulation.InspectedPagePlaceholder.Events = { | 94 Emulation.InspectedPagePlaceholder.Events = { |
| 97 Update: Symbol('Update') | 95 Update: Symbol('Update') |
| 98 }; | 96 }; |
| 99 | |
| 100 Emulation.InspectedPagePlaceholder.MarginValue = 3; | |
| OLD | NEW |