| 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, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 document->removeExtraNamedItem(m_id); | 109 document->removeExtraNamedItem(m_id); |
| 110 document->addExtraNamedItem(newId); | 110 document->addExtraNamedItem(newId); |
| 111 } | 111 } |
| 112 m_id = newId; | 112 m_id = newId; |
| 113 // also call superclass | 113 // also call superclass |
| 114 HTMLPlugInImageElement::parseMappedAttribute(attr); | 114 HTMLPlugInImageElement::parseMappedAttribute(attr); |
| 115 } else | 115 } else |
| 116 HTMLPlugInImageElement::parseMappedAttribute(attr); | 116 HTMLPlugInImageElement::parseMappedAttribute(attr); |
| 117 } | 117 } |
| 118 | 118 |
| 119 typedef HashMap<String, String, CaseFoldingHash> ClassIdToTypeMap; | |
| 120 | |
| 121 static ClassIdToTypeMap* createClassIdToTypeMap() | |
| 122 { | |
| 123 ClassIdToTypeMap* map = new ClassIdToTypeMap; | |
| 124 map->add("clsid:D27CDB6E-AE6D-11CF-96B8-444553540000", "application/x-shockw
ave-flash"); | |
| 125 map->add("clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA", "audio/x-pn-realaudio
-plugin"); | |
| 126 map->add("clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", "video/quicktime"); | |
| 127 map->add("clsid:166B1BCA-3F9C-11CF-8075-444553540000", "application/x-direct
or"); | |
| 128 map->add("clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6", "application/x-mplaye
r2"); | |
| 129 map->add("clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95", "application/x-mplaye
r2"); | |
| 130 return map; | |
| 131 } | |
| 132 | |
| 133 static String serviceTypeForClassId(const String& classId) | |
| 134 { | |
| 135 // Return early if classId is empty (since we won't do anything below). | |
| 136 // Furthermore, if classId is null, calling get() below will crash. | |
| 137 if (classId.isEmpty()) | |
| 138 return String(); | |
| 139 | |
| 140 static ClassIdToTypeMap* map = createClassIdToTypeMap(); | |
| 141 return map->get(classId); | |
| 142 } | |
| 143 | |
| 144 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV
alues) | 119 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV
alues) |
| 145 { | 120 { |
| 146 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e
. Real and WMP | 121 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e
. Real and WMP |
| 147 // require "src" attribute). | 122 // require "src" attribute). |
| 148 int srcIndex = -1, dataIndex = -1; | 123 int srcIndex = -1, dataIndex = -1; |
| 149 for (unsigned int i = 0; i < paramNames->size(); ++i) { | 124 for (unsigned int i = 0; i < paramNames->size(); ++i) { |
| 150 if (equalIgnoringCase((*paramNames)[i], "src")) | 125 if (equalIgnoringCase((*paramNames)[i], "src")) |
| 151 srcIndex = i; | 126 srcIndex = i; |
| 152 else if (equalIgnoringCase((*paramNames)[i], "data")) | 127 else if (equalIgnoringCase((*paramNames)[i], "data")) |
| 153 dataIndex = i; | 128 dataIndex = i; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 void HTMLObjectElement::updateWidget(bool onlyCreateNonNetscapePlugins) | 223 void HTMLObjectElement::updateWidget(bool onlyCreateNonNetscapePlugins) |
| 249 { | 224 { |
| 250 ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); | 225 ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); |
| 251 // FIXME: We should ASSERT(needsWidgetUpdate()), but currently | 226 // FIXME: We should ASSERT(needsWidgetUpdate()), but currently |
| 252 // FrameView::updateWidget() calls updateWidget(false) without checking if | 227 // FrameView::updateWidget() calls updateWidget(false) without checking if |
| 253 // the widget actually needs updating! | 228 // the widget actually needs updating! |
| 254 setNeedsWidgetUpdate(false); | 229 setNeedsWidgetUpdate(false); |
| 255 // FIXME: This should ASSERT isFinishedParsingChildren() instead. | 230 // FIXME: This should ASSERT isFinishedParsingChildren() instead. |
| 256 if (!isFinishedParsingChildren()) | 231 if (!isFinishedParsingChildren()) |
| 257 return; | 232 return; |
| 258 | 233 |
| 259 String url = this->url(); | 234 String url = this->url(); |
| 260 | |
| 261 // If the object does not specify a MIME type via a type attribute, but does | |
| 262 // contain a classid attribute, try to map the classid to a MIME type. | |
| 263 String serviceType = this->serviceType(); | 235 String serviceType = this->serviceType(); |
| 264 if (serviceType.isEmpty()) | |
| 265 serviceType = serviceTypeForClassId(classId()); | |
| 266 | 236 |
| 267 // FIXME: These should be joined into a PluginParameters class. | 237 // FIXME: These should be joined into a PluginParameters class. |
| 268 Vector<String> paramNames; | 238 Vector<String> paramNames; |
| 269 Vector<String> paramValues; | 239 Vector<String> paramValues; |
| 270 parametersForPlugin(paramNames, paramValues, url, serviceType); | 240 parametersForPlugin(paramNames, paramValues, url, serviceType); |
| 271 | 241 |
| 272 // Note: url is modified above by parametersForPlugin. | 242 // Note: url is modified above by parametersForPlugin. |
| 273 if (!allowedToLoadFrameURL(url)) | 243 if (!allowedToLoadFrameURL(url)) |
| 274 return; | 244 return; |
| 275 | 245 |
| 276 bool fallbackContent = hasFallbackContent(); | 246 bool fallbackContent = hasFallbackContent(); |
| 277 renderEmbeddedObject()->setHasFallbackContent(fallbackContent); | 247 renderEmbeddedObject()->setHasFallbackContent(fallbackContent); |
| 278 | 248 |
| 279 if (onlyCreateNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceTy
pe)) | 249 if (onlyCreateNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceTy
pe)) |
| 280 return; | 250 return; |
| 281 | 251 |
| 282 bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url); | 252 bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url); |
| 283 | 253 |
| 284 // beforeload events can modify the DOM, potentially causing | 254 // beforeload events can modify the DOM, potentially causing |
| 285 // RenderWidget::destroy() to be called. Ensure we haven't been | 255 // RenderWidget::destroy() to be called. Ensure we haven't been |
| 286 // destroyed before continuing. | 256 // destroyed before continuing. |
| 287 // FIXME: Should this render fallback content? | 257 // FIXME: Should this render fallback content? |
| 288 if (!renderer()) | 258 if (!renderer()) |
| 289 return; | 259 return; |
| 290 | 260 |
| 261 // HTML5 says that fallback content should be rendered if a non-empty |
| 262 // classid is specified for which the UA can't find a suitable plug-in. |
| 263 bool hasEmptyClassId = classId().isEmpty(); |
| 264 |
| 291 SubframeLoader* loader = document()->frame()->loader()->subframeLoader(); | 265 SubframeLoader* loader = document()->frame()->loader()->subframeLoader(); |
| 292 bool success = beforeLoadAllowedLoad && loader->requestObject(this, url, get
Attribute(nameAttr), serviceType, paramNames, paramValues); | 266 bool success = beforeLoadAllowedLoad && hasEmptyClassId && loader->requestOb
ject(this, url, getAttribute(nameAttr), serviceType, paramNames, paramValues); |
| 293 | 267 |
| 294 if (!success && fallbackContent) | 268 if (!success && fallbackContent) |
| 295 renderFallbackContent(); | 269 renderFallbackContent(); |
| 296 } | 270 } |
| 297 | 271 |
| 298 bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style) | 272 bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style) |
| 299 { | 273 { |
| 300 // FIXME: This check should not be needed, detached documents never render! | 274 // FIXME: This check should not be needed, detached documents never render! |
| 301 Frame* frame = document()->frame(); | 275 Frame* frame = document()->frame(); |
| 302 if (!frame) | 276 if (!frame) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 addSubresourceURL(urls, document()->completeURL(getAttribute(dataAttr))); | 439 addSubresourceURL(urls, document()->completeURL(getAttribute(dataAttr))); |
| 466 | 440 |
| 467 // FIXME: Passing a string that starts with "#" to the completeURL function
does | 441 // FIXME: Passing a string that starts with "#" to the completeURL function
does |
| 468 // not seem like it would work. The image element has similar but not identi
cal code. | 442 // not seem like it would work. The image element has similar but not identi
cal code. |
| 469 const AtomicString& useMap = getAttribute(usemapAttr); | 443 const AtomicString& useMap = getAttribute(usemapAttr); |
| 470 if (useMap.startsWith("#")) | 444 if (useMap.startsWith("#")) |
| 471 addSubresourceURL(urls, document()->completeURL(useMap)); | 445 addSubresourceURL(urls, document()->completeURL(useMap)); |
| 472 } | 446 } |
| 473 | 447 |
| 474 } | 448 } |
| OLD | NEW |