Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: extensions/renderer/resources/guest_view/web_view_attributes.js

Issue 916363003: Enable pinch-zoom on the new login page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 attributes of the <webview> tag. 5 // This module implements the attributes of the <webview> tag.
6 6
7 var GuestViewInternal = 7 var GuestViewInternal =
8 require('binding').Binding.create('guestViewInternal').generate(); 8 require('binding').Binding.create('guestViewInternal').generate();
9 var WebViewImpl = require('webView').WebViewImpl; 9 var WebViewImpl = require('webView').WebViewImpl;
10 var WebViewConstants = require('webViewConstants').WebViewConstants; 10 var WebViewConstants = require('webViewConstants').WebViewConstants;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 AllowTransparencyAttribute.prototype.handleMutation = function(oldValue, 85 AllowTransparencyAttribute.prototype.handleMutation = function(oldValue,
86 newValue) { 86 newValue) {
87 if (!this.webViewImpl.guest.getId()) { 87 if (!this.webViewImpl.guest.getId()) {
88 return; 88 return;
89 } 89 }
90 90
91 WebViewInternal.setAllowTransparency(this.webViewImpl.guest.getId(), 91 WebViewInternal.setAllowTransparency(this.webViewImpl.guest.getId(),
92 this.getValue()); 92 this.getValue());
93 }; 93 };
94 94
95 // Attribute that specifies whether transparency is allowed in the webview.
96 function AllowScalingAttribute(webViewImpl) {
97 BooleanAttribute.call(
98 this, WebViewConstants.ATTRIBUTE_ALLOWSCALING, webViewImpl);
99 }
100
101 AllowScalingAttribute.prototype.__proto__ = BooleanAttribute.prototype;
102
103 AllowScalingAttribute.prototype.handleMutation = function(oldValue,
104 newValue) {
Fady Samuel 2015/02/12 21:27:09 nit: alignment.
wjmaclean 2015/02/12 21:41:25 Done.
105 if (!this.webViewImpl.guest.getId()) {
106 return;
107 }
108
109 WebViewInternal.setAllowScaling(this.webViewImpl.guest.getId(),
110 this.getValue());
111 };
112
95 // Attribute used to define the demension limits of autosizing. 113 // Attribute used to define the demension limits of autosizing.
96 function AutosizeDimensionAttribute(name, webViewImpl) { 114 function AutosizeDimensionAttribute(name, webViewImpl) {
97 WebViewAttribute.call(this, name, webViewImpl); 115 WebViewAttribute.call(this, name, webViewImpl);
98 } 116 }
99 117
100 AutosizeDimensionAttribute.prototype.__proto__ = WebViewAttribute.prototype; 118 AutosizeDimensionAttribute.prototype.__proto__ = WebViewAttribute.prototype;
101 119
102 AutosizeDimensionAttribute.prototype.getValue = function() { 120 AutosizeDimensionAttribute.prototype.getValue = function() {
103 return parseInt(this.webViewImpl.element.getAttribute(this.name)) || 0; 121 return parseInt(this.webViewImpl.element.getAttribute(this.name)) || 0;
104 }; 122 };
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 }; 275 };
258 276
259 // ----------------------------------------------------------------------------- 277 // -----------------------------------------------------------------------------
260 278
261 // Sets up all of the webview attributes. 279 // Sets up all of the webview attributes.
262 WebViewImpl.prototype.setupWebViewAttributes = function() { 280 WebViewImpl.prototype.setupWebViewAttributes = function() {
263 this.attributes = {}; 281 this.attributes = {};
264 282
265 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] = 283 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] =
266 new AllowTransparencyAttribute(this); 284 new AllowTransparencyAttribute(this);
285 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWSCALING] =
286 new AllowScalingAttribute(this);
267 this.attributes[WebViewConstants.ATTRIBUTE_AUTOSIZE] = 287 this.attributes[WebViewConstants.ATTRIBUTE_AUTOSIZE] =
268 new AutosizeAttribute(this); 288 new AutosizeAttribute(this);
269 this.attributes[WebViewConstants.ATTRIBUTE_NAME] = 289 this.attributes[WebViewConstants.ATTRIBUTE_NAME] =
270 new NameAttribute(this); 290 new NameAttribute(this);
271 this.attributes[WebViewConstants.ATTRIBUTE_PARTITION] = 291 this.attributes[WebViewConstants.ATTRIBUTE_PARTITION] =
272 new PartitionAttribute(this); 292 new PartitionAttribute(this);
273 this.attributes[WebViewConstants.ATTRIBUTE_SRC] = 293 this.attributes[WebViewConstants.ATTRIBUTE_SRC] =
274 new SrcAttribute(this); 294 new SrcAttribute(this);
275 295
276 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, 296 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT,
277 WebViewConstants.ATTRIBUTE_MAXWIDTH, 297 WebViewConstants.ATTRIBUTE_MAXWIDTH,
278 WebViewConstants.ATTRIBUTE_MINHEIGHT, 298 WebViewConstants.ATTRIBUTE_MINHEIGHT,
279 WebViewConstants.ATTRIBUTE_MINWIDTH]; 299 WebViewConstants.ATTRIBUTE_MINWIDTH];
280 for (var i = 0; autosizeAttributes[i]; ++i) { 300 for (var i = 0; autosizeAttributes[i]; ++i) {
281 this.attributes[autosizeAttributes[i]] = 301 this.attributes[autosizeAttributes[i]] =
282 new AutosizeDimensionAttribute(autosizeAttributes[i], this); 302 new AutosizeDimensionAttribute(autosizeAttributes[i], this);
283 } 303 }
284 }; 304 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698