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 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 AutosizeDimensionAttribute.prototype.getValue = function() { | 102 AutosizeDimensionAttribute.prototype.getValue = function() { |
103 return parseInt(this.webViewImpl.element.getAttribute(this.name)) || 0; | 103 return parseInt(this.webViewImpl.element.getAttribute(this.name)) || 0; |
104 }; | 104 }; |
105 | 105 |
106 AutosizeDimensionAttribute.prototype.handleMutation = function( | 106 AutosizeDimensionAttribute.prototype.handleMutation = function( |
107 oldValue, newValue) { | 107 oldValue, newValue) { |
108 if (!this.webViewImpl.guest.getId()) { | 108 if (!this.webViewImpl.guest.getId()) { |
109 return; | 109 return; |
110 } | 110 } |
111 this.webViewImpl.guest.setAutoSize({ | 111 this.webViewImpl.guest.setSize({ |
112 'enableAutoSize': this.webViewImpl.attributes[ | 112 'enableAutoSize': this.webViewImpl.attributes[ |
113 WebViewConstants.ATTRIBUTE_AUTOSIZE].getValue(), | 113 WebViewConstants.ATTRIBUTE_AUTOSIZE].getValue(), |
114 'min': { | 114 'min': { |
115 'width': this.webViewImpl.attributes[ | 115 'width': this.webViewImpl.attributes[ |
116 WebViewConstants.ATTRIBUTE_MINWIDTH].getValue(), | 116 WebViewConstants.ATTRIBUTE_MINWIDTH].getValue(), |
117 'height': this.webViewImpl.attributes[ | 117 'height': this.webViewImpl.attributes[ |
118 WebViewConstants.ATTRIBUTE_MINHEIGHT].getValue() | 118 WebViewConstants.ATTRIBUTE_MINHEIGHT].getValue() |
119 }, | 119 }, |
120 'max': { | 120 'max': { |
121 'width': this.webViewImpl.attributes[ | 121 'width': this.webViewImpl.attributes[ |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, | 276 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, |
277 WebViewConstants.ATTRIBUTE_MAXWIDTH, | 277 WebViewConstants.ATTRIBUTE_MAXWIDTH, |
278 WebViewConstants.ATTRIBUTE_MINHEIGHT, | 278 WebViewConstants.ATTRIBUTE_MINHEIGHT, |
279 WebViewConstants.ATTRIBUTE_MINWIDTH]; | 279 WebViewConstants.ATTRIBUTE_MINWIDTH]; |
280 for (var i = 0; autosizeAttributes[i]; ++i) { | 280 for (var i = 0; autosizeAttributes[i]; ++i) { |
281 this.attributes[autosizeAttributes[i]] = | 281 this.attributes[autosizeAttributes[i]] = |
282 new AutosizeDimensionAttribute(autosizeAttributes[i], this); | 282 new AutosizeDimensionAttribute(autosizeAttributes[i], this); |
283 } | 283 } |
284 }; | 284 }; |
OLD | NEW |