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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return this.getValue(); | 46 return this.getValue(); |
47 }.bind(this), | 47 }.bind(this), |
48 set: function(value) { | 48 set: function(value) { |
49 this.setValue(value); | 49 this.setValue(value); |
50 }.bind(this), | 50 }.bind(this), |
51 enumerable: true | 51 enumerable: true |
52 }); | 52 }); |
53 }; | 53 }; |
54 | 54 |
55 // Called when the attribute's value changes. | 55 // Called when the attribute's value changes. |
| 56 WebViewAttribute.prototype.maybeHandleMutation = function(oldValue, newValue) { |
| 57 if (this.ignoreMutation) { |
| 58 return; |
| 59 } |
| 60 |
| 61 this.handleMutation(oldValue, newValue); |
| 62 }; |
| 63 |
| 64 // Called when a change that isn't ignored occurs to the attribute's value. |
56 WebViewAttribute.prototype.handleMutation = function(oldValue, newValue) {}; | 65 WebViewAttribute.prototype.handleMutation = function(oldValue, newValue) {}; |
57 | 66 |
58 // An attribute that is treated as a Boolean. | 67 // An attribute that is treated as a Boolean. |
59 function BooleanAttribute(name, webViewImpl) { | 68 function BooleanAttribute(name, webViewImpl) { |
60 WebViewAttribute.call(this, name, webViewImpl); | 69 WebViewAttribute.call(this, name, webViewImpl); |
61 } | 70 } |
62 | 71 |
63 BooleanAttribute.prototype.__proto__ = WebViewAttribute.prototype; | 72 BooleanAttribute.prototype.__proto__ = WebViewAttribute.prototype; |
64 | 73 |
65 BooleanAttribute.prototype.getValue = function() { | 74 BooleanAttribute.prototype.getValue = function() { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 284 |
276 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, | 285 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, |
277 WebViewConstants.ATTRIBUTE_MAXWIDTH, | 286 WebViewConstants.ATTRIBUTE_MAXWIDTH, |
278 WebViewConstants.ATTRIBUTE_MINHEIGHT, | 287 WebViewConstants.ATTRIBUTE_MINHEIGHT, |
279 WebViewConstants.ATTRIBUTE_MINWIDTH]; | 288 WebViewConstants.ATTRIBUTE_MINWIDTH]; |
280 for (var i = 0; autosizeAttributes[i]; ++i) { | 289 for (var i = 0; autosizeAttributes[i]; ++i) { |
281 this.attributes[autosizeAttributes[i]] = | 290 this.attributes[autosizeAttributes[i]] = |
282 new AutosizeDimensionAttribute(autosizeAttributes[i], this); | 291 new AutosizeDimensionAttribute(autosizeAttributes[i], this); |
283 } | 292 } |
284 }; | 293 }; |
OLD | NEW |