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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp

Issue 2586633002: Dispose a persisted plugin widget if the content frame is detached. (Closed)
Patch Set: Fix typos Created 4 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 unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (m_isDelayingLoadEvent) { 202 if (m_isDelayingLoadEvent) {
203 m_isDelayingLoadEvent = false; 203 m_isDelayingLoadEvent = false;
204 document().decrementLoadEventDelayCount(); 204 document().decrementLoadEventDelayCount();
205 } 205 }
206 } 206 }
207 207
208 void HTMLPlugInElement::removedFrom(ContainerNode* insertionPoint) { 208 void HTMLPlugInElement::removedFrom(ContainerNode* insertionPoint) {
209 // If we've persisted the plugin and we're removed from the tree then 209 // If we've persisted the plugin and we're removed from the tree then
210 // make sure we cleanup the persistance pointer. 210 // make sure we cleanup the persistance pointer.
211 if (m_persistedPluginWidget) { 211 if (m_persistedPluginWidget) {
212 // TODO(dcheng): This UpdateSuspendScope doesn't seem to provide much;
sof 2016/12/17 15:01:53 Given that the persisted-widget detach happens sli
dcheng 2016/12/17 20:20:02 For now, yes. If I understand this correctly, Plug
sof 2016/12/17 21:47:28 WebPluginContainerImpl won't separately call remov
dcheng 2016/12/18 06:40:38 WebPluginContainerImpl won't, but things like Cont
213 // investigate removing it.
212 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 214 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
213 setPersistedPluginWidget(nullptr); 215 setPersistedPluginWidget(nullptr);
214 } 216 }
215 HTMLFrameOwnerElement::removedFrom(insertionPoint); 217 HTMLFrameOwnerElement::removedFrom(insertionPoint);
216 } 218 }
217 219
218 void HTMLPlugInElement::requestPluginCreationWithoutLayoutObjectIfPossible() { 220 void HTMLPlugInElement::requestPluginCreationWithoutLayoutObjectIfPossible() {
219 if (m_serviceType.isEmpty()) 221 if (m_serviceType.isEmpty())
220 return; 222 return;
221 223
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 417 }
416 418
417 bool HTMLPlugInElement::hasCustomFocusLogic() const { 419 bool HTMLPlugInElement::hasCustomFocusLogic() const {
418 return !useFallbackContent(); 420 return !useFallbackContent();
419 } 421 }
420 422
421 bool HTMLPlugInElement::isPluginElement() const { 423 bool HTMLPlugInElement::isPluginElement() const {
422 return true; 424 return true;
423 } 425 }
424 426
427 void HTMLPlugInElement::disconnectContentFrame() {
428 HTMLFrameOwnerElement::disconnectContentFrame();
429 setPersistedPluginWidget(nullptr);
sof 2016/12/17 15:01:53 If there is a reason for this (unexpected) orderin
dcheng 2016/12/17 20:20:02 I /think/ that removedFrom() isn't allowed to run
430 }
431
425 bool HTMLPlugInElement::layoutObjectIsFocusable() const { 432 bool HTMLPlugInElement::layoutObjectIsFocusable() const {
426 if (HTMLFrameOwnerElement::supportsFocus() && 433 if (HTMLFrameOwnerElement::supportsFocus() &&
427 HTMLFrameOwnerElement::layoutObjectIsFocusable()) 434 HTMLFrameOwnerElement::layoutObjectIsFocusable())
428 return true; 435 return true;
429 436
430 if (useFallbackContent() || !HTMLFrameOwnerElement::layoutObjectIsFocusable()) 437 if (useFallbackContent() || !HTMLFrameOwnerElement::layoutObjectIsFocusable())
431 return false; 438 return false;
432 return m_pluginIsAvailable; 439 return m_pluginIsAvailable;
433 } 440 }
434 441
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 648
642 void HTMLPlugInElement::lazyReattachIfNeeded() { 649 void HTMLPlugInElement::lazyReattachIfNeeded() {
643 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && 650 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() &&
644 !isImageType()) { 651 !isImageType()) {
645 lazyReattachIfAttached(); 652 lazyReattachIfAttached();
646 setPersistedPluginWidget(nullptr); 653 setPersistedPluginWidget(nullptr);
647 } 654 }
648 } 655 }
649 656
650 } // namespace blink 657 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698