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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master Created 5 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 | Annotate | Revision Log
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 { 133 {
134 if (Widget* widget = existingPluginWidget()) 134 if (Widget* widget = existingPluginWidget())
135 return widget->isPluginView() && toPluginView(widget)->canProcessDrag(); 135 return widget->isPluginView() && toPluginView(widget)->canProcessDrag();
136 return false; 136 return false;
137 } 137 }
138 138
139 bool HTMLPlugInElement::willRespondToMouseClickEvents() 139 bool HTMLPlugInElement::willRespondToMouseClickEvents()
140 { 140 {
141 if (isDisabledFormControl()) 141 if (isDisabledFormControl())
142 return false; 142 return false;
143 LayoutObject* r = renderer(); 143 LayoutObject* r = layoutObject();
144 return r && (r->isEmbeddedObject() || r->isLayoutPart()); 144 return r && (r->isEmbeddedObject() || r->isLayoutPart());
145 } 145 }
146 146
147 void HTMLPlugInElement::removeAllEventListeners() 147 void HTMLPlugInElement::removeAllEventListeners()
148 { 148 {
149 HTMLFrameOwnerElement::removeAllEventListeners(); 149 HTMLFrameOwnerElement::removeAllEventListeners();
150 if (LayoutPart* renderer = existingLayoutPart()) { 150 if (LayoutPart* renderer = existingLayoutPart()) {
151 if (Widget* widget = renderer->widget()) 151 if (Widget* widget = renderer->widget())
152 widget->eventListenersRemoved(); 152 widget->eventListenersRemoved();
153 } 153 }
154 } 154 }
155 155
156 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) 156 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument)
157 { 157 {
158 if (m_imageLoader) 158 if (m_imageLoader)
159 m_imageLoader->elementDidMoveToNewDocument(); 159 m_imageLoader->elementDidMoveToNewDocument();
160 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); 160 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument);
161 } 161 }
162 162
163 void HTMLPlugInElement::attach(const AttachContext& context) 163 void HTMLPlugInElement::attach(const AttachContext& context)
164 { 164 {
165 HTMLFrameOwnerElement::attach(context); 165 HTMLFrameOwnerElement::attach(context);
166 166
167 if (!renderer() || useFallbackContent()) 167 if (!layoutObject() || useFallbackContent())
168 return; 168 return;
169 169
170 if (isImageType()) { 170 if (isImageType()) {
171 if (!m_imageLoader) 171 if (!m_imageLoader)
172 m_imageLoader = HTMLImageLoader::create(this); 172 m_imageLoader = HTMLImageLoader::create(this);
173 m_imageLoader->updateFromElement(); 173 m_imageLoader->updateFromElement();
174 } else if (needsWidgetUpdate() 174 } else if (needsWidgetUpdate()
175 && layoutEmbeddedObject() 175 && layoutEmbeddedObject()
176 && !layoutEmbeddedObject()->showsUnavailablePluginIndicator() 176 && !layoutEmbeddedObject()->showsUnavailablePluginIndicator()
177 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType) 177 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType)
(...skipping 16 matching lines...) Expand all
194 194
195 void HTMLPlugInElement::requestPluginCreationWithoutRendererIfPossible() 195 void HTMLPlugInElement::requestPluginCreationWithoutRendererIfPossible()
196 { 196 {
197 if (m_serviceType.isEmpty()) 197 if (m_serviceType.isEmpty())
198 return; 198 return;
199 199
200 if (!document().frame() 200 if (!document().frame()
201 || !document().frame()->loader().client()->canCreatePluginWithoutRendere r(m_serviceType)) 201 || !document().frame()->loader().client()->canCreatePluginWithoutRendere r(m_serviceType))
202 return; 202 return;
203 203
204 if (renderer() && renderer()->isLayoutPart()) 204 if (layoutObject() && layoutObject()->isLayoutPart())
205 return; 205 return;
206 206
207 createPluginWithoutRenderer(); 207 createPluginWithoutRenderer();
208 } 208 }
209 209
210 void HTMLPlugInElement::createPluginWithoutRenderer() 210 void HTMLPlugInElement::createPluginWithoutRenderer()
211 { 211 {
212 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer (m_serviceType)); 212 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer (m_serviceType));
213 213
214 KURL url; 214 KURL url;
(...skipping 11 matching lines...) Expand all
226 { 226 {
227 if (Widget* widget = ownedWidget()) 227 if (Widget* widget = ownedWidget())
228 return widget->isPluginView() && toPluginView(widget)->platformLayer(); 228 return widget->isPluginView() && toPluginView(widget)->platformLayer();
229 return false; 229 return false;
230 } 230 }
231 231
232 void HTMLPlugInElement::detach(const AttachContext& context) 232 void HTMLPlugInElement::detach(const AttachContext& context)
233 { 233 {
234 // Update the widget the next time we attach (detaching destroys the plugin) . 234 // Update the widget the next time we attach (detaching destroys the plugin) .
235 // FIXME: None of this "needsWidgetUpdate" related code looks right. 235 // FIXME: None of this "needsWidgetUpdate" related code looks right.
236 if (renderer() && !useFallbackContent()) 236 if (layoutObject() && !useFallbackContent())
237 setNeedsWidgetUpdate(true); 237 setNeedsWidgetUpdate(true);
238 if (m_isDelayingLoadEvent) { 238 if (m_isDelayingLoadEvent) {
239 m_isDelayingLoadEvent = false; 239 m_isDelayingLoadEvent = false;
240 document().decrementLoadEventDelayCount(); 240 document().decrementLoadEventDelayCount();
241 } 241 }
242 242
243 // Only try to persist a plugin widget we actually own. 243 // Only try to persist a plugin widget we actually own.
244 Widget* plugin = ownedWidget(); 244 Widget* plugin = ownedWidget();
245 if (plugin && plugin->pluginShouldPersist()) 245 if (plugin && plugin->pluginShouldPersist())
246 setPersistedPluginWidget(plugin); 246 setPersistedPluginWidget(plugin);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Firefox seems to use a fake event listener to dispatch events to plug-in 367 // Firefox seems to use a fake event listener to dispatch events to plug-in
368 // (tested with mouse events only). This is observable via different order 368 // (tested with mouse events only). This is observable via different order
369 // of events - in Firefox, event listeners specified in HTML attributes 369 // of events - in Firefox, event listeners specified in HTML attributes
370 // fires first, then an event gets dispatched to plug-in, and only then 370 // fires first, then an event gets dispatched to plug-in, and only then
371 // other event listeners fire. Hopefully, this difference does not matter in 371 // other event listeners fire. Hopefully, this difference does not matter in
372 // practice. 372 // practice.
373 373
374 // FIXME: Mouse down and scroll events are passed down to plug-in via custom 374 // FIXME: Mouse down and scroll events are passed down to plug-in via custom
375 // code in EventHandler; these code paths should be united. 375 // code in EventHandler; these code paths should be united.
376 376
377 LayoutObject* r = renderer(); 377 LayoutObject* r = layoutObject();
Julien - ping for review 2015/03/05 16:19:16 Note that s/renderer/layoutObject/ applies to |r|
378 if (!r || !r->isLayoutPart()) 378 if (!r || !r->isLayoutPart())
379 return; 379 return;
380 if (r->isEmbeddedObject()) { 380 if (r->isEmbeddedObject()) {
381 if (toLayoutEmbeddedObject(r)->showsUnavailablePluginIndicator()) 381 if (toLayoutEmbeddedObject(r)->showsUnavailablePluginIndicator())
382 return; 382 return;
383 } 383 }
384 RefPtrWillBeRawPtr<Widget> widget = toLayoutPart(r)->widget(); 384 RefPtrWillBeRawPtr<Widget> widget = toLayoutPart(r)->widget();
385 if (!widget) 385 if (!widget)
386 return; 386 return;
387 widget->handleEvent(event); 387 widget->handleEvent(event);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 bool HTMLPlugInElement::isPluginElement() const 421 bool HTMLPlugInElement::isPluginElement() const
422 { 422 {
423 return true; 423 return true;
424 } 424 }
425 425
426 bool HTMLPlugInElement::rendererIsFocusable() const 426 bool HTMLPlugInElement::rendererIsFocusable() const
427 { 427 {
428 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable()) 428 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable())
429 return true; 429 return true;
430 430
431 if (useFallbackContent() || !renderer() || !renderer()->isEmbeddedObject()) 431 if (useFallbackContent() || !layoutObject() || !layoutObject()->isEmbeddedOb ject())
432 return false; 432 return false;
433 return !toLayoutEmbeddedObject(renderer())->showsUnavailablePluginIndicator( ); 433 return !toLayoutEmbeddedObject(layoutObject())->showsUnavailablePluginIndica tor();
434 } 434 }
435 435
436 NPObject* HTMLPlugInElement::getNPObject() 436 NPObject* HTMLPlugInElement::getNPObject()
437 { 437 {
438 ASSERT(document().frame()); 438 ASSERT(document().frame());
439 if (!m_NPObject) 439 if (!m_NPObject)
440 m_NPObject = document().frame()->script().createScriptObjectForPluginEle ment(this); 440 m_NPObject = document().frame()->script().createScriptObjectForPluginEle ment(this);
441 return m_NPObject; 441 return m_NPObject;
442 } 442 }
443 443
(...skipping 15 matching lines...) Expand all
459 return frame->loader().client()->objectContentType(completedURL, m_servi ceType, shouldPreferPlugInsForImages()) == ObjectContentImage; 459 return frame->loader().client()->objectContentType(completedURL, m_servi ceType, shouldPreferPlugInsForImages()) == ObjectContentImage;
460 } 460 }
461 461
462 return Image::supportsType(m_serviceType); 462 return Image::supportsType(m_serviceType);
463 } 463 }
464 464
465 LayoutEmbeddedObject* HTMLPlugInElement::layoutEmbeddedObject() const 465 LayoutEmbeddedObject* HTMLPlugInElement::layoutEmbeddedObject() const
466 { 466 {
467 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers 467 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers
468 // when using fallback content. 468 // when using fallback content.
469 if (!renderer() || !renderer()->isEmbeddedObject()) 469 if (!layoutObject() || !layoutObject()->isEmbeddedObject())
470 return nullptr; 470 return nullptr;
471 return toLayoutEmbeddedObject(renderer()); 471 return toLayoutEmbeddedObject(layoutObject());
472 } 472 }
473 473
474 // We don't use m_url, as it may not be the final URL that the object loads, 474 // We don't use m_url, as it may not be the final URL that the object loads,
475 // depending on <param> values. 475 // depending on <param> values.
476 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url) 476 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url)
477 { 477 {
478 KURL completeURL = document().completeURL(url); 478 KURL completeURL = document().completeURL(url);
479 if (contentFrame() && protocolIsJavaScript(completeURL) 479 if (contentFrame() && protocolIsJavaScript(completeURL)
480 && !document().securityOrigin()->canAccess(contentDocument()->securityOr igin())) 480 && !document().securityOrigin()->canAccess(contentDocument()->securityOr igin()))
481 return false; 481 return false;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return false; 667 return false;
668 } 668 }
669 669
670 bool HTMLPlugInElement::useFallbackContent() const 670 bool HTMLPlugInElement::useFallbackContent() const
671 { 671 {
672 return hasOpenShadowRoot(); 672 return hasOpenShadowRoot();
673 } 673 }
674 674
675 void HTMLPlugInElement::lazyReattachIfNeeded() 675 void HTMLPlugInElement::lazyReattachIfNeeded()
676 { 676 {
677 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) 677 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && layoutObject() && !isImageType())
678 lazyReattachIfAttached(); 678 lazyReattachIfAttached();
679 } 679 }
680 680
681 } 681 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698