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

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

Issue 2737713002: Rename updateWidgets to updatePlugins (Closed)
Patch Set: Rename updateWidgets to updatePlugins Created 3 years, 9 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 | « third_party/WebKit/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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 } // anonymous namespace 71 } // anonymous namespace
72 72
73 HTMLPlugInElement::HTMLPlugInElement( 73 HTMLPlugInElement::HTMLPlugInElement(
74 const QualifiedName& tagName, 74 const QualifiedName& tagName,
75 Document& doc, 75 Document& doc,
76 bool createdByParser, 76 bool createdByParser,
77 PreferPlugInsForImagesOption preferPlugInsForImagesOption) 77 PreferPlugInsForImagesOption preferPlugInsForImagesOption)
78 : HTMLFrameOwnerElement(tagName, doc), 78 : HTMLFrameOwnerElement(tagName, doc),
79 m_isDelayingLoadEvent(false), 79 m_isDelayingLoadEvent(false),
80 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay 80 // m_needsPluginUpdate(!createdByParser) allows HTMLObjectElement to delay
81 // FrameViewBase updates until after all children are parsed. For 81 // FrameViewBase updates until after all children are parsed. For
82 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make 82 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make
83 // both classes share the same codepath in this class. 83 // both classes share the same codepath in this class.
84 m_needsWidgetUpdate(!createdByParser), 84 m_needsPluginUpdate(!createdByParser),
85 m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == 85 m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption ==
86 ShouldPreferPlugInsForImages) {} 86 ShouldPreferPlugInsForImages) {}
87 87
88 HTMLPlugInElement::~HTMLPlugInElement() { 88 HTMLPlugInElement::~HTMLPlugInElement() {
89 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree() 89 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree()
90 DCHECK(!m_isDelayingLoadEvent); 90 DCHECK(!m_isDelayingLoadEvent);
91 } 91 }
92 92
93 DEFINE_TRACE(HTMLPlugInElement) { 93 DEFINE_TRACE(HTMLPlugInElement) {
94 visitor->trace(m_imageLoader); 94 visitor->trace(m_imageLoader);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 180 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
181 setPersistedPluginWidget(nullptr); 181 setPersistedPluginWidget(nullptr);
182 } 182 }
183 return; 183 return;
184 } 184 }
185 185
186 if (isImageType()) { 186 if (isImageType()) {
187 if (!m_imageLoader) 187 if (!m_imageLoader)
188 m_imageLoader = HTMLImageLoader::create(this); 188 m_imageLoader = HTMLImageLoader::create(this);
189 m_imageLoader->updateFromElement(); 189 m_imageLoader->updateFromElement();
190 } else if (needsWidgetUpdate() && !layoutEmbeddedItem().isNull() && 190 } else if (needsPluginUpdate() && !layoutEmbeddedItem().isNull() &&
191 !layoutEmbeddedItem().showsUnavailablePluginIndicator() && 191 !layoutEmbeddedItem().showsUnavailablePluginIndicator() &&
192 !wouldLoadAsNetscapePlugin(m_url, m_serviceType) && 192 !wouldLoadAsNetscapePlugin(m_url, m_serviceType) &&
193 !m_isDelayingLoadEvent) { 193 !m_isDelayingLoadEvent) {
194 m_isDelayingLoadEvent = true; 194 m_isDelayingLoadEvent = true;
195 document().incrementLoadEventDelayCount(); 195 document().incrementLoadEventDelayCount();
196 document().loadPluginsSoon(); 196 document().loadPluginsSoon();
197 } 197 }
198 } 198 }
199 199
200 void HTMLPlugInElement::updateWidget() { 200 void HTMLPlugInElement::updatePlugin() {
201 updateWidgetInternal(); 201 updatePluginInternal();
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) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (FrameViewBase* frameViewBase = ownedWidget()) { 255 if (FrameViewBase* frameViewBase = ownedWidget()) {
256 return frameViewBase->isPluginView() && 256 return frameViewBase->isPluginView() &&
257 toPluginView(frameViewBase)->platformLayer(); 257 toPluginView(frameViewBase)->platformLayer();
258 } 258 }
259 return false; 259 return false;
260 } 260 }
261 261
262 void HTMLPlugInElement::detachLayoutTree(const AttachContext& context) { 262 void HTMLPlugInElement::detachLayoutTree(const AttachContext& context) {
263 // Update the FrameViewBase the next time we attach (detaching destroys the 263 // Update the FrameViewBase the next time we attach (detaching destroys the
264 // plugin). 264 // plugin).
265 // FIXME: None of this "needsWidgetUpdate" related code looks right. 265 // FIXME: None of this "needsPluginUpdate" related code looks right.
266 if (layoutObject() && !useFallbackContent()) 266 if (layoutObject() && !useFallbackContent())
267 setNeedsWidgetUpdate(true); 267 setNeedsPluginUpdate(true);
268
268 if (m_isDelayingLoadEvent) { 269 if (m_isDelayingLoadEvent) {
269 m_isDelayingLoadEvent = false; 270 m_isDelayingLoadEvent = false;
270 document().decrementLoadEventDelayCount(); 271 document().decrementLoadEventDelayCount();
271 } 272 }
272 273
273 // Only try to persist a plugin FrameViewBase we actually own. 274 // Only try to persist a plugin FrameViewBase we actually own.
274 FrameViewBase* plugin = ownedWidget(); 275 FrameViewBase* plugin = ownedWidget();
275 if (plugin && context.performingReattach) { 276 if (plugin && context.performingReattach) {
276 setPersistedPluginWidget(releaseWidget()); 277 setPersistedPluginWidget(releaseWidget());
277 } else { 278 } else {
(...skipping 22 matching lines...) Expand all
300 301
301 m_pluginIsAvailable = true; 302 m_pluginIsAvailable = true;
302 return new LayoutEmbeddedObject(this); 303 return new LayoutEmbeddedObject(this);
303 } 304 }
304 305
305 void HTMLPlugInElement::finishParsingChildren() { 306 void HTMLPlugInElement::finishParsingChildren() {
306 HTMLFrameOwnerElement::finishParsingChildren(); 307 HTMLFrameOwnerElement::finishParsingChildren();
307 if (useFallbackContent()) 308 if (useFallbackContent())
308 return; 309 return;
309 310
310 setNeedsWidgetUpdate(true); 311 setNeedsPluginUpdate(true);
311 if (isConnected()) 312 if (isConnected())
312 lazyReattachIfNeeded(); 313 lazyReattachIfNeeded();
313 } 314 }
314 315
315 void HTMLPlugInElement::resetInstance() { 316 void HTMLPlugInElement::resetInstance() {
316 m_pluginWrapper.clear(); 317 m_pluginWrapper.clear();
317 } 318 }
318 319
319 SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper() { 320 SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper() {
320 LocalFrame* frame = document().frame(); 321 LocalFrame* frame = document().frame();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 642
642 bool HTMLPlugInElement::hasFallbackContent() const { 643 bool HTMLPlugInElement::hasFallbackContent() const {
643 return false; 644 return false;
644 } 645 }
645 646
646 bool HTMLPlugInElement::useFallbackContent() const { 647 bool HTMLPlugInElement::useFallbackContent() const {
647 return false; 648 return false;
648 } 649 }
649 650
650 void HTMLPlugInElement::lazyReattachIfNeeded() { 651 void HTMLPlugInElement::lazyReattachIfNeeded() {
651 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && 652 if (!useFallbackContent() && needsPluginUpdate() && layoutObject() &&
652 !isImageType()) { 653 !isImageType()) {
653 lazyReattachIfAttached(); 654 lazyReattachIfAttached();
654 setPersistedPluginWidget(nullptr); 655 setPersistedPluginWidget(nullptr);
655 } 656 }
656 } 657 }
657 658
658 } // namespace blink 659 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698