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

Unified Diff: chrome/renderer/resources/extensions/web_view.js

Issue 11418261: Browser Plugin: Update DOM Node attributes when properties are updated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/web_view.js
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js
index 1617e5c4108ed464472bd9812dba6365dcb925f7..0d46f217d60e0f92bb64eb8f8776912f4e57d38a 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -90,6 +90,14 @@ function WebView(node) {
this.node_,
{attributes: true, attributeFilter: WEB_VIEW_ATTRIBUTES});
+ var handleObjectMutation = this.handleObjectMutation_.bind(this);
+ var objectObserver = new WebKitMutationObserver(function(mutations) {
+ mutations.forEach(handleObjectMutation);
+ });
+ objectObserver.observe(
+ this.objectNode_,
+ {attributes: true, attributeFilter: WEB_VIEW_ATTRIBUTES});
+
var objectNode = this.objectNode_;
// Expose getters and setters for the attributes.
WEB_VIEW_ATTRIBUTES.forEach(function(attributeName) {
@@ -126,13 +134,21 @@ function WebView(node) {
* @private
*/
WebView.prototype.handleMutation_ = function(mutation) {
- this.node_[mutation.attributeName] =
+ this.objectNode_[mutation.attributeName] =
this.node_.getAttribute(mutation.attributeName);
};
/**
* @private
*/
+WebView.prototype.handleObjectMutation_ = function(mutation) {
+ this.node_.setAttribute(mutation.attributeName,
+ this.objectNode_.getAttribute(mutation.attributeName));
+};
+
+/**
+ * @private
+ */
WebView.prototype.setupEvent_ = function(eventname, attribs) {
var node = this.node_;
this.objectNode_.addEventListener('-internal-' + eventname, function(e) {
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698