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 28 matching lines...) Expand all Loading... |
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/loader/FrameLoaderClient.h" | 41 #include "core/loader/FrameLoaderClient.h" |
42 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
44 #include "core/page/scrolling/ScrollingCoordinator.h" | 44 #include "core/page/scrolling/ScrollingCoordinator.h" |
45 #include "core/plugins/PluginView.h" | 45 #include "core/plugins/PluginView.h" |
46 #include "core/rendering/RenderBlockFlow.h" | 46 #include "core/rendering/RenderBlockFlow.h" |
47 #include "core/rendering/RenderEmbeddedObject.h" | 47 #include "core/rendering/RenderEmbeddedObject.h" |
48 #include "core/rendering/RenderImage.h" | 48 #include "core/rendering/RenderImage.h" |
49 #include "core/rendering/RenderWidget.h" | 49 #include "core/rendering/RenderPart.h" |
50 #include "platform/Logging.h" | 50 #include "platform/Logging.h" |
51 #include "platform/MIMETypeFromURL.h" | 51 #include "platform/MIMETypeFromURL.h" |
52 #include "platform/MIMETypeRegistry.h" | 52 #include "platform/MIMETypeRegistry.h" |
53 #include "platform/Widget.h" | 53 #include "platform/Widget.h" |
54 #include "platform/plugins/PluginData.h" | 54 #include "platform/plugins/PluginData.h" |
55 | 55 |
56 namespace blink { | 56 namespace blink { |
57 | 57 |
58 using namespace HTMLNames; | 58 using namespace HTMLNames; |
59 | 59 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool HTMLPlugInElement::canProcessDrag() const | 92 bool HTMLPlugInElement::canProcessDrag() const |
93 { | 93 { |
94 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug
inWidget())->canProcessDrag(); | 94 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug
inWidget())->canProcessDrag(); |
95 } | 95 } |
96 | 96 |
97 bool HTMLPlugInElement::willRespondToMouseClickEvents() | 97 bool HTMLPlugInElement::willRespondToMouseClickEvents() |
98 { | 98 { |
99 if (isDisabledFormControl()) | 99 if (isDisabledFormControl()) |
100 return false; | 100 return false; |
101 RenderObject* r = renderer(); | 101 RenderObject* r = renderer(); |
102 return r && (r->isEmbeddedObject() || r->isWidget()); | 102 return r && (r->isEmbeddedObject() || r->isRenderPart()); |
103 } | 103 } |
104 | 104 |
105 void HTMLPlugInElement::removeAllEventListeners() | 105 void HTMLPlugInElement::removeAllEventListeners() |
106 { | 106 { |
107 HTMLFrameOwnerElement::removeAllEventListeners(); | 107 HTMLFrameOwnerElement::removeAllEventListeners(); |
108 if (RenderWidget* renderer = existingRenderWidget()) { | 108 if (RenderPart* renderer = existingRenderPart()) { |
109 if (Widget* widget = renderer->widget()) | 109 if (Widget* widget = renderer->widget()) |
110 widget->eventListenersRemoved(); | 110 widget->eventListenersRemoved(); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) | 114 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) |
115 { | 115 { |
116 if (m_imageLoader) | 116 if (m_imageLoader) |
117 m_imageLoader->elementDidMoveToNewDocument(); | 117 m_imageLoader->elementDidMoveToNewDocument(); |
118 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); | 118 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 void HTMLPlugInElement::requestPluginCreationWithoutRendererIfPossible() | 153 void HTMLPlugInElement::requestPluginCreationWithoutRendererIfPossible() |
154 { | 154 { |
155 if (m_serviceType.isEmpty()) | 155 if (m_serviceType.isEmpty()) |
156 return; | 156 return; |
157 | 157 |
158 if (!document().frame() | 158 if (!document().frame() |
159 || !document().frame()->loader().client()->canCreatePluginWithoutRendere
r(m_serviceType)) | 159 || !document().frame()->loader().client()->canCreatePluginWithoutRendere
r(m_serviceType)) |
160 return; | 160 return; |
161 | 161 |
162 if (renderer() && renderer()->isWidget()) | 162 if (renderer() && renderer()->isRenderPart()) |
163 return; | 163 return; |
164 | 164 |
165 createPluginWithoutRenderer(); | 165 createPluginWithoutRenderer(); |
166 } | 166 } |
167 | 167 |
168 void HTMLPlugInElement::createPluginWithoutRenderer() | 168 void HTMLPlugInElement::createPluginWithoutRenderer() |
169 { | 169 { |
170 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer
(m_serviceType)); | 170 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer
(m_serviceType)); |
171 | 171 |
172 KURL url; | 172 KURL url; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 _NPN_ReleaseObject(m_NPObject); | 220 _NPN_ReleaseObject(m_NPObject); |
221 m_NPObject = 0; | 221 m_NPObject = 0; |
222 } | 222 } |
223 | 223 |
224 HTMLFrameOwnerElement::detach(context); | 224 HTMLFrameOwnerElement::detach(context); |
225 } | 225 } |
226 | 226 |
227 RenderObject* HTMLPlugInElement::createRenderer(RenderStyle* style) | 227 RenderObject* HTMLPlugInElement::createRenderer(RenderStyle* style) |
228 { | 228 { |
229 // Fallback content breaks the DOM->Renderer class relationship of this | 229 // Fallback content breaks the DOM->Renderer class relationship of this |
230 // class and all superclasses because createObject won't necessarily | 230 // class and all superclasses because createObject won't necessarily return |
231 // return a RenderEmbeddedObject, RenderPart or even RenderWidget. | 231 // a RenderEmbeddedObject or RenderPart. |
232 if (useFallbackContent()) | 232 if (useFallbackContent()) |
233 return RenderObject::createObject(this, style); | 233 return RenderObject::createObject(this, style); |
234 | 234 |
235 if (isImageType()) { | 235 if (isImageType()) { |
236 RenderImage* image = new RenderImage(this); | 236 RenderImage* image = new RenderImage(this); |
237 image->setImageResource(RenderImageResource::create()); | 237 image->setImageResource(RenderImageResource::create()); |
238 return image; | 238 return image; |
239 } | 239 } |
240 | 240 |
241 if (usePlaceholderContent()) | 241 if (usePlaceholderContent()) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 plugin = pluginWidget(); | 278 plugin = pluginWidget(); |
279 | 279 |
280 if (plugin) | 280 if (plugin) |
281 m_pluginWrapper = frame->script().createPluginWrapper(plugin); | 281 m_pluginWrapper = frame->script().createPluginWrapper(plugin); |
282 } | 282 } |
283 return m_pluginWrapper.get(); | 283 return m_pluginWrapper.get(); |
284 } | 284 } |
285 | 285 |
286 Widget* HTMLPlugInElement::pluginWidget() const | 286 Widget* HTMLPlugInElement::pluginWidget() const |
287 { | 287 { |
288 if (RenderWidget* renderWidget = renderWidgetForJSBindings()) | 288 if (RenderPart* renderPart = renderPartForJSBindings()) |
289 return renderWidget->widget(); | 289 return renderPart->widget(); |
290 return 0; | 290 return 0; |
291 } | 291 } |
292 | 292 |
293 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const | 293 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const |
294 { | 294 { |
295 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name ==
hspaceAttr || name == alignAttr) | 295 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name ==
hspaceAttr || name == alignAttr) |
296 return true; | 296 return true; |
297 return HTMLFrameOwnerElement::isPresentationAttribute(name); | 297 return HTMLFrameOwnerElement::isPresentationAttribute(name); |
298 } | 298 } |
299 | 299 |
(...skipping 22 matching lines...) Expand all Loading... |
322 // (tested with mouse events only). This is observable via different order | 322 // (tested with mouse events only). This is observable via different order |
323 // of events - in Firefox, event listeners specified in HTML attributes | 323 // of events - in Firefox, event listeners specified in HTML attributes |
324 // fires first, then an event gets dispatched to plug-in, and only then | 324 // fires first, then an event gets dispatched to plug-in, and only then |
325 // other event listeners fire. Hopefully, this difference does not matter in | 325 // other event listeners fire. Hopefully, this difference does not matter in |
326 // practice. | 326 // practice. |
327 | 327 |
328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom | 328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom |
329 // code in EventHandler; these code paths should be united. | 329 // code in EventHandler; these code paths should be united. |
330 | 330 |
331 RenderObject* r = renderer(); | 331 RenderObject* r = renderer(); |
332 if (!r || !r->isWidget()) | 332 if (!r || !r->isRenderPart()) |
333 return; | 333 return; |
334 if (r->isEmbeddedObject()) { | 334 if (r->isEmbeddedObject()) { |
335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) | 335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) |
336 return; | 336 return; |
337 } | 337 } |
338 RefPtr<Widget> widget = toRenderWidget(r)->widget(); | 338 RefPtr<Widget> widget = toRenderPart(r)->widget(); |
339 if (!widget) | 339 if (!widget) |
340 return; | 340 return; |
341 widget->handleEvent(event); | 341 widget->handleEvent(event); |
342 if (event->defaultHandled()) | 342 if (event->defaultHandled()) |
343 return; | 343 return; |
344 HTMLFrameOwnerElement::defaultEventHandler(event); | 344 HTMLFrameOwnerElement::defaultEventHandler(event); |
345 } | 345 } |
346 | 346 |
347 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const | 347 RenderPart* HTMLPlugInElement::renderPartForJSBindings() const |
348 { | 348 { |
349 // Needs to load the plugin immediatedly because this function is called | 349 // Needs to load the plugin immediatedly because this function is called |
350 // when JavaScript code accesses the plugin. | 350 // when JavaScript code accesses the plugin. |
351 // FIXME: Check if dispatching events here is safe. | 351 // FIXME: Check if dispatching events here is safe. |
352 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
Synchronously); | 352 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
Synchronously); |
353 return existingRenderWidget(); | 353 return existingRenderPart(); |
354 } | 354 } |
355 | 355 |
356 bool HTMLPlugInElement::isKeyboardFocusable() const | 356 bool HTMLPlugInElement::isKeyboardFocusable() const |
357 { | 357 { |
358 if (!document().isActive()) | 358 if (!document().isActive()) |
359 return false; | 359 return false; |
360 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug
inWidget())->supportsKeyboardFocus(); | 360 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug
inWidget())->supportsKeyboardFocus(); |
361 } | 361 } |
362 | 362 |
363 bool HTMLPlugInElement::hasCustomFocusLogic() const | 363 bool HTMLPlugInElement::hasCustomFocusLogic() const |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 void HTMLPlugInElement::lazyReattachIfNeeded() | 596 void HTMLPlugInElement::lazyReattachIfNeeded() |
597 { | 597 { |
598 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate()
&& renderer() && !isImageType()) | 598 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate()
&& renderer() && !isImageType()) |
599 lazyReattachIfAttached(); | 599 lazyReattachIfAttached(); |
600 } | 600 } |
601 | 601 |
602 } | 602 } |
OLD | NEW |