Commit 60497f59 authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Initialize <webview> build params properly

In WebViewImpl, we initialize something called |cachedZoom| which is
never used. This is presumably supposed to be |cachedZoomFactor|.

We give this a more descriptive name and initialize it with the correct
value. We also explicitly initialize |userAgentOverride|.

Bug: None
Change-Id: Id506c12b5b53502b44fcea575b96803a584ac31b
Reviewed-on: https://chromium-review.googlesource.com/1219905Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590448}
parent 5954a8c7
...@@ -19,7 +19,8 @@ var WebViewInternal = getInternalApi ? ...@@ -19,7 +19,8 @@ var WebViewInternal = getInternalApi ?
// Represents the internal state of <webview>. // Represents the internal state of <webview>.
function WebViewImpl(webviewElement) { function WebViewImpl(webviewElement) {
$Function.call(GuestViewContainer, this, webviewElement, 'webview'); $Function.call(GuestViewContainer, this, webviewElement, 'webview');
this.cachedZoom = 1; this.pendingZoomFactor_ = null;
this.userAgentOverride = null;
this.setupElementProperties(); this.setupElementProperties();
new WebViewEvents(this, this.viewInstanceId); new WebViewEvents(this, this.viewInstanceId);
} }
...@@ -162,8 +163,10 @@ WebViewImpl.prototype.onAttach = function(storagePartitionId) { ...@@ -162,8 +163,10 @@ WebViewImpl.prototype.onAttach = function(storagePartitionId) {
}; };
WebViewImpl.prototype.buildContainerParams = function() { WebViewImpl.prototype.buildContainerParams = function() {
var params = { 'initialZoomFactor': this.cachedZoomFactor, var params = {
'userAgentOverride': this.userAgentOverride }; 'initialZoomFactor': this.pendingZoomFactor_,
'userAgentOverride': this.userAgentOverride
};
for (var i in this.attributes) { for (var i in this.attributes) {
var value = this.attributes[i].getValueIfDirty(); var value = this.attributes[i].getValueIfDirty();
if (value) if (value)
...@@ -234,10 +237,10 @@ WebViewImpl.prototype.loadDataWithBaseUrl = function( ...@@ -234,10 +237,10 @@ WebViewImpl.prototype.loadDataWithBaseUrl = function(
WebViewImpl.prototype.setZoom = function(zoomFactor, callback) { WebViewImpl.prototype.setZoom = function(zoomFactor, callback) {
if (!this.guest.getId()) { if (!this.guest.getId()) {
this.cachedZoomFactor = zoomFactor; this.pendingZoomFactor_ = zoomFactor;
return false; return false;
} }
this.cachedZoomFactor = 1; this.pendingZoomFactor_ = null;
WebViewInternal.setZoom(this.guest.getId(), zoomFactor, callback); WebViewInternal.setZoom(this.guest.getId(), zoomFactor, callback);
return true; return true;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment