42 #include "HTMLFormElement.h" |
42 #include "HTMLFormElement.h" |
43 #include "ResourceRequest.h" |
43 #include "ResourceRequest.h" |
44 #include "webkitlogger.h" |
44 #include "webkitlogger.h" |
45 #include "webutil.h" |
45 #include "webutil.h" |
46 #include "PluginSkin.h" |
46 #include "PluginSkin.h" |
|
47 #include "PluginHandler.h" |
47 #include "kjs_proxy.h" |
48 #include "kjs_proxy.h" |
48 #if PLATFORM(SYMBIAN) |
49 #if PLATFORM(SYMBIAN) |
49 #include "oom.h" |
50 #include "oom.h" |
50 #endif |
51 #endif |
51 |
52 |
305 } |
306 } |
306 } |
307 } |
307 |
308 |
308 PluginSkin* WebFrame::focusedPlugin() |
309 PluginSkin* WebFrame::focusedPlugin() |
309 { |
310 { |
310 int pluginCount = 0; |
311 PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler(); |
311 Frame* coreFrame = core(this); |
312 PluginSkin* plugin = pluginHandler->activePlugin(); |
312 MWebCoreObjectWidget* view = NULL; |
313 if (!plugin) { |
313 MWebCoreObjectWidget* tmpView = NULL; |
314 //no focused plugin. If only one plugin is present return that plugin |
314 |
315 WTF::HashSet<PluginSkin*> pluginObjs = pluginHandler->pluginObjects(); |
315 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
316 if (pluginObjs.size() == 1) { |
316 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
317 WTF::HashSet<PluginSkin*>::iterator it = pluginObjs.begin(); |
317 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) { |
318 plugin = *it; |
318 tmpView = widget(n); |
319 } |
319 if (tmpView) { |
320 } |
320 pluginCount++; |
321 |
321 view = tmpView; |
322 return plugin; |
322 if (view->isActive()) { |
|
323 return static_cast<PluginSkin*>(view); |
|
324 } |
|
325 } |
|
326 } |
|
327 |
|
328 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
|
329 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) { |
|
330 tmpView = widget(n); |
|
331 if (tmpView) { |
|
332 pluginCount++; |
|
333 view = tmpView; |
|
334 if (view->isActive()) { |
|
335 return static_cast<PluginSkin*>(view); |
|
336 } |
|
337 } |
|
338 } |
|
339 } |
|
340 //no focused plugin. If only one plugin is present return that plugin |
|
341 if(pluginCount == 1 && view) { |
|
342 return static_cast<PluginSkin*>(view); |
|
343 } //endof pluginCount = 1 |
|
344 |
|
345 return NULL; |
|
346 } |
323 } |
347 |
324 |
348 void WebFrame::setFrameView(WebFrameView* v) |
325 void WebFrame::setFrameView(WebFrameView* v) |
349 { |
326 { |
350 if (m_view) |
327 if (m_view) |