OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WebView (<webview>) as a custom element that wraps a | 5 // This module implements WebView (<webview>) as a custom element that wraps a |
6 // BrowserPlugin object element. The object element is hidden within | 6 // BrowserPlugin object element. The object element is hidden within |
7 // the shadow DOM of the WebView element. | 7 // the shadow DOM of the WebView element. |
8 | 8 |
9 var DocumentNatives = requireNative('document_natives'); | 9 var DocumentNatives = requireNative('document_natives'); |
10 var GuestView = require('guestView').GuestView; | 10 var GuestView = require('guestView').GuestView; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 WebViewConstants.ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE); | 100 WebViewConstants.ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE); |
101 }.bind(this), | 101 }.bind(this), |
102 // No setter. | 102 // No setter. |
103 enumerable: true | 103 enumerable: true |
104 }); | 104 }); |
105 }; | 105 }; |
106 | 106 |
107 // This observer monitors mutations to attributes of the <webview>. | 107 // This observer monitors mutations to attributes of the <webview>. |
108 WebViewImpl.prototype.handleAttributeMutation = function( | 108 WebViewImpl.prototype.handleAttributeMutation = function( |
109 attributeName, oldValue, newValue) { | 109 attributeName, oldValue, newValue) { |
110 if (!this.attributes[attributeName] || | 110 if (!this.attributes[attributeName]) { |
111 this.attributes[attributeName].ignoreMutation) { | |
112 return; | 111 return; |
113 } | 112 } |
114 | 113 |
115 // Let the changed attribute handle its own mutation; | 114 // Let the changed attribute handle its own mutation; |
116 this.attributes[attributeName].handleMutation(oldValue, newValue); | 115 this.attributes[attributeName].maybeHandleMutation(oldValue, newValue); |
117 }; | 116 }; |
118 | 117 |
119 WebViewImpl.prototype.onSizeChanged = function(webViewEvent) { | 118 WebViewImpl.prototype.onSizeChanged = function(webViewEvent) { |
120 var newWidth = webViewEvent.newWidth; | 119 var newWidth = webViewEvent.newWidth; |
121 var newHeight = webViewEvent.newHeight; | 120 var newHeight = webViewEvent.newHeight; |
122 | 121 |
123 var element = this.element; | 122 var element = this.element; |
124 | 123 |
125 var width = element.offsetWidth; | 124 var width = element.offsetWidth; |
126 var height = element.offsetHeight; | 125 var height = element.offsetHeight; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; | 261 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; |
263 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = | 262 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = |
264 function(request) { | 263 function(request) { |
265 return request; | 264 return request; |
266 }; | 265 }; |
267 | 266 |
268 GuestViewContainer.registerElement(WebViewImpl); | 267 GuestViewContainer.registerElement(WebViewImpl); |
269 | 268 |
270 // Exports. | 269 // Exports. |
271 exports.WebViewImpl = WebViewImpl; | 270 exports.WebViewImpl = WebViewImpl; |
OLD | NEW |