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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.Widget} | 7 * @extends {WebInspector.Widget} |
8 */ | 8 */ |
9 WebInspector.InspectedPagePlaceholder = function() | 9 WebInspector.InspectedPagePlaceholder = function() |
10 { | 10 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 | 71 |
72 clearMinimumSizeAndMargins: function() | 72 clearMinimumSizeAndMargins: function() |
73 { | 73 { |
74 this._useMargins = false; | 74 this._useMargins = false; |
75 this.setMinimumSize(1, 1); | 75 this.setMinimumSize(1, 1); |
76 this._findMargins(); | 76 this._findMargins(); |
77 }, | 77 }, |
78 | 78 |
79 _dipPageRect: function() | 79 _dipPageRect: function() |
80 { | 80 { |
81 var zoomFactor = WebInspector.zoomManager.zoomFactor(); | 81 var windowToViewportRatio = 1000 / DevToolsHost.convertLengthForEmbedder (1000); |
dgozman
2016/02/29 20:26:20
Looks like this compensates for similar call to co
oshima
2016/02/29 21:28:03
setInspectedPageBounds is also used by browser, wh
dgozman
2016/02/29 21:38:41
Not sure I'm following you. setInspectedPageBounds
oshima
2016/02/29 22:59:50
Sorry I seem to have wrong memory. I somehow thoug
| |
82 var zoomFactor = WebInspector.zoomManager.zoomFactor() * windowToViewpor tRatio; | |
82 var rect = this.element.getBoundingClientRect(); | 83 var rect = this.element.getBoundingClientRect(); |
83 var bodyRect = this.element.ownerDocument.body.getBoundingClientRect(); | 84 var bodyRect = this.element.ownerDocument.body.getBoundingClientRect(); |
84 | 85 |
85 var left = Math.max(rect.left * zoomFactor + this._margins.left, bodyRec t.left * zoomFactor); | 86 var left = Math.max(rect.left * zoomFactor + this._margins.left, bodyRec t.left * zoomFactor); |
86 var top = Math.max(rect.top * zoomFactor + this._margins.top, bodyRect.t op * zoomFactor); | 87 var top = Math.max(rect.top * zoomFactor + this._margins.top, bodyRect.t op * zoomFactor); |
87 var bottom = Math.min(rect.bottom * zoomFactor - this._margins.bottom, b odyRect.bottom * zoomFactor); | 88 var bottom = Math.min(rect.bottom * zoomFactor - this._margins.bottom, b odyRect.bottom * zoomFactor); |
88 var right = Math.min(rect.right * zoomFactor - this._margins.right, body Rect.right * zoomFactor); | 89 var right = Math.min(rect.right * zoomFactor - this._margins.right, body Rect.right * zoomFactor); |
89 | 90 |
90 return { x: left, y: top, width: right - left, height: bottom - top }; | 91 return { x: left, y: top, width: right - left, height: bottom - top }; |
91 }, | 92 }, |
92 | 93 |
93 update: function() | 94 update: function() |
94 { | 95 { |
95 delete this._updateId; | 96 delete this._updateId; |
96 var rect = this._dipPageRect(); | 97 var rect = this._dipPageRect(); |
97 var bounds = { x: Math.round(rect.x), y: Math.round(rect.y), height: Mat h.max(1, Math.round(rect.height)), width: Math.max(1, Math.round(rect.width)) }; | 98 var bounds = { x: Math.round(rect.x), y: Math.round(rect.y), height: Mat h.max(1, Math.round(rect.height)), width: Math.max(1, Math.round(rect.width)) }; |
98 this.dispatchEventToListeners(WebInspector.InspectedPagePlaceholder.Even ts.Update, bounds); | 99 this.dispatchEventToListeners(WebInspector.InspectedPagePlaceholder.Even ts.Update, bounds); |
99 }, | 100 }, |
100 | 101 |
101 __proto__: WebInspector.Widget.prototype | 102 __proto__: WebInspector.Widget.prototype |
102 }; | 103 }; |
OLD | NEW |