| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (srcIndex == -1 && dataIndex != -1) { | 156 if (srcIndex == -1 && dataIndex != -1) { |
| 157 paramNames->append("src"); | 157 paramNames->append("src"); |
| 158 paramValues->append((*paramValues)[dataIndex]); | 158 paramValues->append((*paramValues)[dataIndex]); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 // FIXME: This function should not deal with url or serviceType! | 162 // FIXME: This function should not deal with url or serviceType! |
| 163 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
tring>& paramValues, String& url, String& serviceType) | 163 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
tring>& paramValues, String& url, String& serviceType) |
| 164 { | 164 { |
| 165 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; | 165 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; |
| 166 String urlParam; |
| 166 | 167 |
| 167 // Scan the PARAM children and store their name/value pairs. | 168 // Scan the PARAM children and store their name/value pairs. |
| 168 // Get the URL and type from the params if we don't already have them. | 169 // Get the URL and type from the params if we don't already have them. |
| 169 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 170 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 170 if (!child->hasTagName(paramTag)) | 171 if (!child->hasTagName(paramTag)) |
| 171 continue; | 172 continue; |
| 172 | 173 |
| 173 HTMLParamElement* p = static_cast<HTMLParamElement*>(child); | 174 HTMLParamElement* p = static_cast<HTMLParamElement*>(child); |
| 174 String name = p->name(); | 175 String name = p->name(); |
| 175 if (name.isEmpty()) | 176 if (name.isEmpty()) |
| 176 continue; | 177 continue; |
| 177 | 178 |
| 178 uniqueParamNames.add(name.impl()); | 179 uniqueParamNames.add(name.impl()); |
| 179 paramNames.append(p->name()); | 180 paramNames.append(p->name()); |
| 180 paramValues.append(p->value()); | 181 paramValues.append(p->value()); |
| 181 | 182 |
| 182 // FIXME: url adjustment does not belong in this function. | 183 // FIXME: url adjustment does not belong in this function. |
| 183 if (url.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCas
e(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "
url"))) | 184 if (url.isEmpty() && urlParam.isEmpty() && (equalIgnoringCase(name, "src
") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equ
alIgnoringCase(name, "url"))) |
| 184 url = deprecatedParseURL(p->value()); | 185 urlParam = deprecatedParseURL(p->value()); |
| 185 // FIXME: serviceType calculation does not belong in this function. | 186 // FIXME: serviceType calculation does not belong in this function. |
| 186 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { | 187 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { |
| 187 serviceType = p->value(); | 188 serviceType = p->value(); |
| 188 size_t pos = serviceType.find(";"); | 189 size_t pos = serviceType.find(";"); |
| 189 if (pos != notFound) | 190 if (pos != notFound) |
| 190 serviceType = serviceType.left(pos); | 191 serviceType = serviceType.left(pos); |
| 191 } | 192 } |
| 192 } | 193 } |
| 193 | 194 |
| 194 // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE att
ribute in the tag | 195 // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE att
ribute in the tag |
| (...skipping 15 matching lines...) Expand all Loading... |
| 210 const AtomicString& name = it->name().localName(); | 211 const AtomicString& name = it->name().localName(); |
| 211 if (!uniqueParamNames.contains(name.impl())) { | 212 if (!uniqueParamNames.contains(name.impl())) { |
| 212 paramNames.append(name.string()); | 213 paramNames.append(name.string()); |
| 213 paramValues.append(it->value().string()); | 214 paramValues.append(it->value().string()); |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 mapDataParamToSrc(¶mNames, ¶mValues); | 219 mapDataParamToSrc(¶mNames, ¶mValues); |
| 219 | 220 |
| 220 // If we still don't have a type, try to map from a specific CLASSID to a ty
pe. | 221 // HTML5 says that an object resource's URL is specified by the object's dat
a |
| 221 if (serviceType.isEmpty()) | 222 // attribute, not by a param element. However, for compatibility, allow the |
| 222 serviceType = serviceTypeForClassId(classId()); | 223 // resource's URL to be given by a param named "src", "movie", "code" or "ur
l" |
| 224 // if we know that resource points to a plug-in. |
| 225 if (url.isEmpty() && !urlParam.isEmpty()) { |
| 226 SubframeLoader* loader = document()->frame()->loader()->subframeLoader()
; |
| 227 if (loader->resourceWillUsePlugin(urlParam, serviceType)) |
| 228 url = urlParam; |
| 229 } |
| 223 } | 230 } |
| 224 | 231 |
| 225 | 232 |
| 226 bool HTMLObjectElement::hasFallbackContent() const | 233 bool HTMLObjectElement::hasFallbackContent() const |
| 227 { | 234 { |
| 228 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 235 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 229 // Ignore whitespace-only text, and <param> tags, any other content is f
allback content. | 236 // Ignore whitespace-only text, and <param> tags, any other content is f
allback content. |
| 230 if (child->isTextNode()) { | 237 if (child->isTextNode()) { |
| 231 if (!static_cast<Text*>(child)->containsOnlyWhitespace()) | 238 if (!static_cast<Text*>(child)->containsOnlyWhitespace()) |
| 232 return true; | 239 return true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 243 ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); | 250 ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); |
| 244 // FIXME: We should ASSERT(needsWidgetUpdate()), but currently | 251 // FIXME: We should ASSERT(needsWidgetUpdate()), but currently |
| 245 // FrameView::updateWidget() calls updateWidget(false) without checking if | 252 // FrameView::updateWidget() calls updateWidget(false) without checking if |
| 246 // the widget actually needs updating! | 253 // the widget actually needs updating! |
| 247 setNeedsWidgetUpdate(false); | 254 setNeedsWidgetUpdate(false); |
| 248 // FIXME: This should ASSERT isFinishedParsingChildren() instead. | 255 // FIXME: This should ASSERT isFinishedParsingChildren() instead. |
| 249 if (!isFinishedParsingChildren()) | 256 if (!isFinishedParsingChildren()) |
| 250 return; | 257 return; |
| 251 | 258 |
| 252 String url = this->url(); | 259 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. |
| 253 String serviceType = this->serviceType(); | 263 String serviceType = this->serviceType(); |
| 264 if (serviceType.isEmpty()) |
| 265 serviceType = serviceTypeForClassId(classId()); |
| 254 | 266 |
| 255 // FIXME: These should be joined into a PluginParameters class. | 267 // FIXME: These should be joined into a PluginParameters class. |
| 256 Vector<String> paramNames; | 268 Vector<String> paramNames; |
| 257 Vector<String> paramValues; | 269 Vector<String> paramValues; |
| 258 parametersForPlugin(paramNames, paramValues, url, serviceType); | 270 parametersForPlugin(paramNames, paramValues, url, serviceType); |
| 259 | 271 |
| 260 // Note: url is modified above by parametersForPlugin. | 272 // Note: url is modified above by parametersForPlugin. |
| 261 if (!allowedToLoadFrameURL(url)) | 273 if (!allowedToLoadFrameURL(url)) |
| 262 return; | 274 return; |
| 263 | 275 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 addSubresourceURL(urls, document()->completeURL(getAttribute(dataAttr))); | 465 addSubresourceURL(urls, document()->completeURL(getAttribute(dataAttr))); |
| 454 | 466 |
| 455 // FIXME: Passing a string that starts with "#" to the completeURL function
does | 467 // FIXME: Passing a string that starts with "#" to the completeURL function
does |
| 456 // not seem like it would work. The image element has similar but not identi
cal code. | 468 // not seem like it would work. The image element has similar but not identi
cal code. |
| 457 const AtomicString& useMap = getAttribute(usemapAttr); | 469 const AtomicString& useMap = getAttribute(usemapAttr); |
| 458 if (useMap.startsWith("#")) | 470 if (useMap.startsWith("#")) |
| 459 addSubresourceURL(urls, document()->completeURL(useMap)); | 471 addSubresourceURL(urls, document()->completeURL(useMap)); |
| 460 } | 472 } |
| 461 | 473 |
| 462 } | 474 } |
| OLD | NEW |