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 // This module implements the shared functionality for different guestview | 5 // This module implements the shared functionality for different guestview |
| 6 // containers, such as web_view, app_view, etc. | 6 // containers, such as web_view, app_view, etc. |
| 7 | 7 |
| 8 var DocumentNatives = requireNative('document_natives'); | 8 var DocumentNatives = requireNative('document_natives'); |
| 9 var GuestView = require('guestView').GuestView; | 9 var GuestView = require('guestView').GuestView; |
| 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 this.dispatchEvent(resizeEvent); | 150 this.dispatchEvent(resizeEvent); |
| 151 | 151 |
| 152 if (!this.guest.getId()) | 152 if (!this.guest.getId()) |
| 153 return; | 153 return; |
| 154 this.guest.setSize({normal: {width: newWidth, height: newHeight}}); | 154 this.guest.setSize({normal: {width: newWidth, height: newHeight}}); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 GuestViewContainer.prototype.buildParams = function() { | 157 GuestViewContainer.prototype.buildParams = function() { |
| 158 var params = this.buildContainerParams(); | 158 var params = this.buildContainerParams(); |
| 159 params['instanceId'] = this.viewInstanceId; | 159 params['instanceId'] = this.viewInstanceId; |
| 160 var css = window.getComputedStyle(this.element, null); | |
|
paulmeyer
2015/03/24 20:57:00
I think it would be useful to add a comment here a
Fady Samuel
2015/03/26 17:50:38
Done.
| |
| 160 var elementRect = this.element.getBoundingClientRect(); | 161 var elementRect = this.element.getBoundingClientRect(); |
| 161 params['elementWidth'] = parseInt(elementRect.width); | 162 params['elementWidth'] = parseInt(elementRect.width) || |
| 162 params['elementHeight'] = parseInt(elementRect.height); | 163 parseInt(css.getPropertyValue('width')); |
| 164 params['elementHeight'] = parseInt(elementRect.height) || | |
| 165 parseInt(css.getPropertyValue('height')); | |
| 163 return params; | 166 return params; |
| 164 }; | 167 }; |
| 165 | 168 |
| 166 GuestViewContainer.prototype.dispatchEvent = function(event) { | 169 GuestViewContainer.prototype.dispatchEvent = function(event) { |
| 167 return this.element.dispatchEvent(event); | 170 return this.element.dispatchEvent(event); |
| 168 } | 171 } |
| 169 | 172 |
| 170 // Implemented by the specific view type, if needed. | 173 // Implemented by the specific view type, if needed. |
| 171 GuestViewContainer.prototype.buildContainerParams = function() { return {}; }; | 174 GuestViewContainer.prototype.buildContainerParams = function() { return {}; }; |
| 172 GuestViewContainer.prototype.onElementAttached = function() {}; | 175 GuestViewContainer.prototype.onElementAttached = function() {}; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 // Delete the callbacks so developers cannot call them and produce unexpected | 265 // Delete the callbacks so developers cannot call them and produce unexpected |
| 263 // behavior. | 266 // behavior. |
| 264 delete proto.createdCallback; | 267 delete proto.createdCallback; |
| 265 delete proto.attachedCallback; | 268 delete proto.attachedCallback; |
| 266 delete proto.detachedCallback; | 269 delete proto.detachedCallback; |
| 267 delete proto.attributeChangedCallback; | 270 delete proto.attributeChangedCallback; |
| 268 } | 271 } |
| 269 | 272 |
| 270 // Exports. | 273 // Exports. |
| 271 exports.GuestViewContainer = GuestViewContainer; | 274 exports.GuestViewContainer = GuestViewContainer; |
| OLD | NEW |