| Index: extensions/renderer/resources/guest_view/guest_view_container.js
|
| diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
|
| index 35c6991039cec6152b94e483f75a1c3e0cc547fa..5b6a736758ffe04dbec929baf704ec9289618e24 100644
|
| --- a/extensions/renderer/resources/guest_view/guest_view_container.js
|
| +++ b/extensions/renderer/resources/guest_view/guest_view_container.js
|
| @@ -157,9 +157,17 @@ GuestViewContainer.prototype.onElementResize = function(oldWidth, oldHeight,
|
| GuestViewContainer.prototype.buildParams = function() {
|
| var params = this.buildContainerParams();
|
| params['instanceId'] = this.viewInstanceId;
|
| + // When the GuestViewContainer is not participating in layout (display:none)
|
| + // then getBoundingClientRect() would report a width and height of 0.
|
| + // However, in the case where the GuestViewContainer has a fixed size we can
|
| + // use that value to initially size the guest so as to avoid a relayout of the
|
| + // on display:block.
|
| + var css = window.getComputedStyle(this.element, null);
|
| var elementRect = this.element.getBoundingClientRect();
|
| - params['elementWidth'] = parseInt(elementRect.width);
|
| - params['elementHeight'] = parseInt(elementRect.height);
|
| + params['elementWidth'] = parseInt(elementRect.width) ||
|
| + parseInt(css.getPropertyValue('width'));
|
| + params['elementHeight'] = parseInt(elementRect.height) ||
|
| + parseInt(css.getPropertyValue('height'));
|
| return params;
|
| };
|
|
|
|
|