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

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

Issue 596773002: Re-attach plugin renderers in the standard way. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 , m_NPObject(0) 63 , m_NPObject(0)
64 , m_isCapturingMouseEvents(false) 64 , m_isCapturingMouseEvents(false)
65 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay 65 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay
66 // widget updates until after all children are parsed. For HTMLEmbedElement 66 // widget updates until after all children are parsed. For HTMLEmbedElement
67 // this delay is unnecessary, but it is simpler to make both classes share 67 // this delay is unnecessary, but it is simpler to make both classes share
68 // the same codepath in this class. 68 // the same codepath in this class.
69 , m_needsWidgetUpdate(!createdByParser) 69 , m_needsWidgetUpdate(!createdByParser)
70 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages) 70 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages)
71 , m_usePlaceholderContent(false) 71 , m_usePlaceholderContent(false)
72 { 72 {
73 setHasCustomStyleCallbacks();
74 } 73 }
75 74
76 HTMLPlugInElement::~HTMLPlugInElement() 75 HTMLPlugInElement::~HTMLPlugInElement()
77 { 76 {
78 ASSERT(!m_pluginWrapper); // cleared in detach() 77 ASSERT(!m_pluginWrapper); // cleared in detach()
79 ASSERT(!m_isDelayingLoadEvent); 78 ASSERT(!m_isDelayingLoadEvent);
80 79
81 if (m_NPObject) { 80 if (m_NPObject) {
82 _NPN_ReleaseObject(m_NPObject); 81 _NPN_ReleaseObject(m_NPObject);
83 m_NPObject = 0; 82 m_NPObject = 0;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 image->setImageResource(RenderImageResource::create()); 237 image->setImageResource(RenderImageResource::create());
239 return image; 238 return image;
240 } 239 }
241 240
242 if (usePlaceholderContent()) 241 if (usePlaceholderContent())
243 return new RenderBlockFlow(this); 242 return new RenderBlockFlow(this);
244 243
245 return new RenderEmbeddedObject(this); 244 return new RenderEmbeddedObject(this);
246 } 245 }
247 246
248 void HTMLPlugInElement::willRecalcStyle(StyleRecalcChange)
249 {
250 // FIXME: Why is this necessary? Manual re-attach is almost always wrong.
251 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType())
252 reattach();
253 }
254
255 void HTMLPlugInElement::finishParsingChildren() 247 void HTMLPlugInElement::finishParsingChildren()
256 { 248 {
257 HTMLFrameOwnerElement::finishParsingChildren(); 249 HTMLFrameOwnerElement::finishParsingChildren();
258 if (useFallbackContent()) 250 if (useFallbackContent())
259 return; 251 return;
260 252
261 setNeedsWidgetUpdate(true); 253 setNeedsWidgetUpdate(true);
262 if (inDocument()) 254 if (inDocument())
263 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre ate(StyleChangeReason::Plugin)); 255 lazyReattachIfNeeded();
264 } 256 }
265 257
266 void HTMLPlugInElement::resetInstance() 258 void HTMLPlugInElement::resetInstance()
267 { 259 {
268 m_pluginWrapper.clear(); 260 m_pluginWrapper.clear();
269 } 261 }
270 262
271 SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper() 263 SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
272 { 264 {
273 LocalFrame* frame = document().frame(); 265 LocalFrame* frame = document().frame();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 583 }
592 584
593 void HTMLPlugInElement::setUsePlaceholderContent(bool use) 585 void HTMLPlugInElement::setUsePlaceholderContent(bool use)
594 { 586 {
595 if (use != m_usePlaceholderContent) { 587 if (use != m_usePlaceholderContent) {
596 m_usePlaceholderContent = use; 588 m_usePlaceholderContent = use;
597 lazyReattachIfAttached(); 589 lazyReattachIfAttached();
598 } 590 }
599 } 591 }
600 592
593 void HTMLPlugInElement::lazyReattachIfNeeded()
594 {
595 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType())
596 lazyReattachIfAttached();
601 } 597 }
598
599 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698