OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
33 #include "core/events/Event.h" | 33 #include "core/events/Event.h" |
34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
37 #include "core/frame/csp/ContentSecurityPolicy.h" | 37 #include "core/frame/csp/ContentSecurityPolicy.h" |
38 #include "core/html/HTMLContentElement.h" | 38 #include "core/html/HTMLContentElement.h" |
39 #include "core/html/HTMLImageLoader.h" | 39 #include "core/html/HTMLImageLoader.h" |
40 #include "core/html/PluginDocument.h" | 40 #include "core/html/PluginDocument.h" |
41 #include "core/layout/LayoutImage.h" | 41 #include "core/layout/LayoutImage.h" |
| 42 #include "core/layout/LayoutPart.h" |
42 #include "core/loader/FrameLoaderClient.h" | 43 #include "core/loader/FrameLoaderClient.h" |
43 #include "core/loader/MixedContentChecker.h" | 44 #include "core/loader/MixedContentChecker.h" |
44 #include "core/page/EventHandler.h" | 45 #include "core/page/EventHandler.h" |
45 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
46 #include "core/page/scrolling/ScrollingCoordinator.h" | 47 #include "core/page/scrolling/ScrollingCoordinator.h" |
47 #include "core/plugins/PluginPlaceholder.h" | 48 #include "core/plugins/PluginPlaceholder.h" |
48 #include "core/plugins/PluginView.h" | 49 #include "core/plugins/PluginView.h" |
49 #include "core/rendering/RenderBlockFlow.h" | 50 #include "core/rendering/RenderBlockFlow.h" |
50 #include "core/rendering/RenderEmbeddedObject.h" | 51 #include "core/rendering/RenderEmbeddedObject.h" |
51 #include "core/rendering/RenderPart.h" | |
52 #include "platform/Logging.h" | 52 #include "platform/Logging.h" |
53 #include "platform/MIMETypeFromURL.h" | 53 #include "platform/MIMETypeFromURL.h" |
54 #include "platform/MIMETypeRegistry.h" | 54 #include "platform/MIMETypeRegistry.h" |
55 #include "platform/Widget.h" | 55 #include "platform/Widget.h" |
56 #include "platform/plugins/PluginData.h" | 56 #include "platform/plugins/PluginData.h" |
57 #include "public/platform/WebURLRequest.h" | 57 #include "public/platform/WebURLRequest.h" |
58 | 58 |
59 namespace blink { | 59 namespace blink { |
60 | 60 |
61 using namespace HTMLNames; | 61 using namespace HTMLNames; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = renderer(); |
144 return r && (r->isEmbeddedObject() || r->isRenderPart()); | 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 (RenderPart* renderer = existingRenderPart()) { | 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); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()->isRenderPart()) | 204 if (renderer() && renderer()->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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 m_NPObject = 0; | 260 m_NPObject = 0; |
261 } | 261 } |
262 | 262 |
263 HTMLFrameOwnerElement::detach(context); | 263 HTMLFrameOwnerElement::detach(context); |
264 } | 264 } |
265 | 265 |
266 LayoutObject* HTMLPlugInElement::createRenderer(const LayoutStyle& style) | 266 LayoutObject* HTMLPlugInElement::createRenderer(const LayoutStyle& style) |
267 { | 267 { |
268 // Fallback content breaks the DOM->Renderer class relationship of this | 268 // Fallback content breaks the DOM->Renderer class relationship of this |
269 // class and all superclasses because createObject won't necessarily return | 269 // class and all superclasses because createObject won't necessarily return |
270 // a RenderEmbeddedObject or RenderPart. | 270 // a RenderEmbeddedObject or LayoutPart. |
271 if (useFallbackContent()) | 271 if (useFallbackContent()) |
272 return LayoutObject::createObject(this, style); | 272 return LayoutObject::createObject(this, style); |
273 | 273 |
274 if (isImageType()) { | 274 if (isImageType()) { |
275 LayoutImage* image = new LayoutImage(this); | 275 LayoutImage* image = new LayoutImage(this); |
276 image->setImageResource(LayoutImageResource::create()); | 276 image->setImageResource(LayoutImageResource::create()); |
277 return image; | 277 return image; |
278 } | 278 } |
279 | 279 |
280 if (usePlaceholderContent()) | 280 if (usePlaceholderContent()) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 plugin = pluginWidgetForJSBindings(); | 317 plugin = pluginWidgetForJSBindings(); |
318 | 318 |
319 if (plugin) | 319 if (plugin) |
320 m_pluginWrapper = frame->script().createPluginWrapper(plugin); | 320 m_pluginWrapper = frame->script().createPluginWrapper(plugin); |
321 } | 321 } |
322 return m_pluginWrapper.get(); | 322 return m_pluginWrapper.get(); |
323 } | 323 } |
324 | 324 |
325 Widget* HTMLPlugInElement::existingPluginWidget() const | 325 Widget* HTMLPlugInElement::existingPluginWidget() const |
326 { | 326 { |
327 if (RenderPart* renderPart = existingRenderPart()) | 327 if (LayoutPart* layoutPart = existingLayoutPart()) |
328 return renderPart->widget(); | 328 return layoutPart->widget(); |
329 return nullptr; | 329 return nullptr; |
330 } | 330 } |
331 | 331 |
332 Widget* HTMLPlugInElement::pluginWidgetForJSBindings() | 332 Widget* HTMLPlugInElement::pluginWidgetForJSBindings() |
333 { | 333 { |
334 if (RenderPart* renderPart = renderPartForJSBindings()) | 334 if (LayoutPart* layoutPart = layoutPartForJSBindings()) |
335 return renderPart->widget(); | 335 return layoutPart->widget(); |
336 return nullptr; | 336 return nullptr; |
337 } | 337 } |
338 | 338 |
339 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const | 339 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const |
340 { | 340 { |
341 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name ==
hspaceAttr || name == alignAttr) | 341 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name ==
hspaceAttr || name == alignAttr) |
342 return true; | 342 return true; |
343 return HTMLFrameOwnerElement::isPresentationAttribute(name); | 343 return HTMLFrameOwnerElement::isPresentationAttribute(name); |
344 } | 344 } |
345 | 345 |
(...skipping 22 matching lines...) Expand all Loading... |
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 = renderer(); |
378 if (!r || !r->isRenderPart()) | 378 if (!r || !r->isLayoutPart()) |
379 return; | 379 return; |
380 if (r->isEmbeddedObject()) { | 380 if (r->isEmbeddedObject()) { |
381 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) | 381 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) |
382 return; | 382 return; |
383 } | 383 } |
384 RefPtrWillBeRawPtr<Widget> widget = toRenderPart(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); |
388 if (event->defaultHandled()) | 388 if (event->defaultHandled()) |
389 return; | 389 return; |
390 HTMLFrameOwnerElement::defaultEventHandler(event); | 390 HTMLFrameOwnerElement::defaultEventHandler(event); |
391 } | 391 } |
392 | 392 |
393 RenderPart* HTMLPlugInElement::renderPartForJSBindings() const | 393 LayoutPart* HTMLPlugInElement::layoutPartForJSBindings() const |
394 { | 394 { |
395 // Needs to load the plugin immediatedly because this function is called | 395 // Needs to load the plugin immediatedly because this function is called |
396 // when JavaScript code accesses the plugin. | 396 // when JavaScript code accesses the plugin. |
397 // FIXME: Check if dispatching events here is safe. | 397 // FIXME: Check if dispatching events here is safe. |
398 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
Synchronously); | 398 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
Synchronously); |
399 return existingRenderPart(); | 399 return existingLayoutPart(); |
400 } | 400 } |
401 | 401 |
402 bool HTMLPlugInElement::isKeyboardFocusable() const | 402 bool HTMLPlugInElement::isKeyboardFocusable() const |
403 { | 403 { |
404 if (useFallbackContent() || usePlaceholderContent()) | 404 if (useFallbackContent() || usePlaceholderContent()) |
405 return HTMLElement::isKeyboardFocusable(); | 405 return HTMLElement::isKeyboardFocusable(); |
406 | 406 |
407 if (!document().isActive()) | 407 if (!document().isActive()) |
408 return false; | 408 return false; |
409 | 409 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 if (!pluginIsLoadable(completedURL, mimeType)) | 511 if (!pluginIsLoadable(completedURL, mimeType)) |
512 return false; | 512 return false; |
513 | 513 |
514 bool useFallback; | 514 bool useFallback; |
515 bool requireRenderer = true; | 515 bool requireRenderer = true; |
516 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac
k)) | 516 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac
k)) |
517 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa
llback, requireRenderer); | 517 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa
llback, requireRenderer); |
518 | 518 |
519 // If the plug-in element already contains a subframe, | 519 // If the plug-in element already contains a subframe, |
520 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new | 520 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new |
521 // frame and set it as the RenderPart's widget, causing what was previously | 521 // frame and set it as the LayoutPart's widget, causing what was previously |
522 // in the widget to be torn down. | 522 // in the widget to be torn down. |
523 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true, CheckC
ontentSecurityPolicy); | 523 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true, CheckC
ontentSecurityPolicy); |
524 } | 524 } |
525 | 525 |
526 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons
t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac
k, bool requireRenderer) | 526 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons
t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac
k, bool requireRenderer) |
527 { | 527 { |
528 LocalFrame* frame = document().frame(); | 528 LocalFrame* frame = document().frame(); |
529 | 529 |
530 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) | 530 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) |
531 return false; | 531 return false; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 return hasAuthorShadowRoot(); | 672 return hasAuthorShadowRoot(); |
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()
&& renderer() && !isImageType()) |
678 lazyReattachIfAttached(); | 678 lazyReattachIfAttached(); |
679 } | 679 } |
680 | 680 |
681 } | 681 } |
OLD | NEW |