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 ?
// Represents the internal state of <webview>.
function WebViewImpl(webviewElement) {
$Function.call(GuestViewContainer, this, webviewElement, 'webview');
this.cachedZoom = 1;
this.pendingZoomFactor_ = null;
this.userAgentOverride = null;
this.setupElementProperties();
new WebViewEvents(this, this.viewInstanceId);
}
......@@ -162,8 +163,10 @@ WebViewImpl.prototype.onAttach = function(storagePartitionId) {
};
WebViewImpl.prototype.buildContainerParams = function() {
var params = { 'initialZoomFactor': this.cachedZoomFactor,
'userAgentOverride': this.userAgentOverride };
var params = {
'initialZoomFactor': this.pendingZoomFactor_,
'userAgentOverride': this.userAgentOverride
};
for (var i in this.attributes) {
var value = this.attributes[i].getValueIfDirty();
if (value)
......@@ -234,10 +237,10 @@ WebViewImpl.prototype.loadDataWithBaseUrl = function(
WebViewImpl.prototype.setZoom = function(zoomFactor, callback) {
if (!this.guest.getId()) {
this.cachedZoomFactor = zoomFactor;
this.pendingZoomFactor_ = zoomFactor;
return false;
}
this.cachedZoomFactor = 1;
this.pendingZoomFactor_ = null;
WebViewInternal.setZoom(this.guest.getId(), zoomFactor, callback);
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