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

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

Issue 440463002: Fix display:none issue for <webview>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
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 f36662b81327925ad0cb063b4a188fbae295d967..64f3b381026c54a048679736b47a028973c4babb 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -106,7 +106,7 @@ function WebViewInternal(webviewNode) {
this.browserPluginNode = this.createBrowserPluginNode();
var shadowRoot = this.webviewNode.createShadowRoot();
- shadowRoot.appendChild(this.browserPluginNode);
+ this.partition = new Partition();
this.setupWebviewNodeAttributes();
this.setupFocusPropagation();
@@ -114,10 +114,9 @@ function WebViewInternal(webviewNode) {
this.viewInstanceId = IdGenerator.GetNextId();
- this.partition = new Partition();
- this.parseAttributes();
-
new WebViewEvents(this, this.viewInstanceId);
+
+ shadowRoot.appendChild(this.browserPluginNode);
}
/**
@@ -563,17 +562,20 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation =
if (name == 'internalinstanceid' && !oldValue && !!newValue) {
this.browserPluginNode.removeAttribute('internalinstanceid');
this.internalInstanceId = parseInt(newValue);
- if (this.deferredAttachState && !!this.guestInstanceId &&
- this.guestInstanceId != 0) {
- window.setTimeout(function() {
- var isNewWindow = this.deferredAttachState ?
- this.deferredAttachState.isNewWindow : false;
- var params = this.buildAttachParams(isNewWindow);
- guestViewInternalNatives.AttachGuest(
- this.internalInstanceId,
- this.guestInstanceId,
- params);
- }.bind(this), 0);
+ if (this.deferredAttachState) {
+ if (!!this.guestInstanceId && this.guestInstanceId != 0) {
+ window.setTimeout(function() {
+ var isNewWindow = this.deferredAttachState ?
+ this.deferredAttachState.isNewWindow : false;
+ var params = this.buildAttachParams(isNewWindow);
+ guestViewInternalNatives.AttachGuest(
+ this.internalInstanceId,
+ this.guestInstanceId,
+ params);
+ }.bind(this), 0);
+ }
+ } else {
+ this.parseAttributes();
Fady Samuel 2014/08/25 18:55:34 Early exit preferred for readability: if (!this.d
lazyboy 2014/08/25 19:16:44 Done.
}
return;
}
@@ -737,6 +739,10 @@ WebViewInternal.prototype.onFrameNameChanged = function(name) {
}
};
+WebViewInternal.prototype.onPluginDestroyed = function() {
+ this.reset();
+};
+
WebViewInternal.prototype.dispatchEvent = function(webViewEvent) {
return this.webviewNode.dispatchEvent(webViewEvent);
};

Powered by Google App Engine
This is Rietveld 408576698