| 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, 2011 Apple Inc. All rights | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Real and WMP require "src" attribute). | 133 // Real and WMP require "src" attribute). |
| 134 int srcIndex = -1, dataIndex = -1; | 134 int srcIndex = -1, dataIndex = -1; |
| 135 for (unsigned i = 0; i < paramNames->size(); ++i) { | 135 for (unsigned i = 0; i < paramNames->size(); ++i) { |
| 136 if (equalIgnoringCase((*paramNames)[i], "src")) | 136 if (equalIgnoringCase((*paramNames)[i], "src")) |
| 137 srcIndex = i; | 137 srcIndex = i; |
| 138 else if (equalIgnoringCase((*paramNames)[i], "data")) | 138 else if (equalIgnoringCase((*paramNames)[i], "data")) |
| 139 dataIndex = i; | 139 dataIndex = i; |
| 140 } | 140 } |
| 141 | 141 |
| 142 if (srcIndex == -1 && dataIndex != -1) { | 142 if (srcIndex == -1 && dataIndex != -1) { |
| 143 paramNames->append("src"); | 143 paramNames->push_back("src"); |
| 144 paramValues->append((*paramValues)[dataIndex]); | 144 paramValues->push_back((*paramValues)[dataIndex]); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 // TODO(schenney): crbug.com/572908 This function should not deal with url or | 148 // TODO(schenney): crbug.com/572908 This function should not deal with url or |
| 149 // serviceType! | 149 // serviceType! |
| 150 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, | 150 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, |
| 151 Vector<String>& paramValues, | 151 Vector<String>& paramValues, |
| 152 String& url, | 152 String& url, |
| 153 String& serviceType) { | 153 String& serviceType) { |
| 154 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; | 154 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; |
| 155 String urlParameter; | 155 String urlParameter; |
| 156 | 156 |
| 157 // Scan the PARAM children and store their name/value pairs. | 157 // Scan the PARAM children and store their name/value pairs. |
| 158 // Get the URL and type from the params if we don't already have them. | 158 // Get the URL and type from the params if we don't already have them. |
| 159 for (HTMLParamElement* p = Traversal<HTMLParamElement>::firstChild(*this); p; | 159 for (HTMLParamElement* p = Traversal<HTMLParamElement>::firstChild(*this); p; |
| 160 p = Traversal<HTMLParamElement>::nextSibling(*p)) { | 160 p = Traversal<HTMLParamElement>::nextSibling(*p)) { |
| 161 String name = p->name(); | 161 String name = p->name(); |
| 162 if (name.isEmpty()) | 162 if (name.isEmpty()) |
| 163 continue; | 163 continue; |
| 164 | 164 |
| 165 uniqueParamNames.add(name.impl()); | 165 uniqueParamNames.add(name.impl()); |
| 166 paramNames.append(p->name()); | 166 paramNames.push_back(p->name()); |
| 167 paramValues.append(p->value()); | 167 paramValues.push_back(p->value()); |
| 168 | 168 |
| 169 // TODO(schenney): crbug.com/572908 url adjustment does not belong in this | 169 // TODO(schenney): crbug.com/572908 url adjustment does not belong in this |
| 170 // function. | 170 // function. |
| 171 if (url.isEmpty() && urlParameter.isEmpty() && | 171 if (url.isEmpty() && urlParameter.isEmpty() && |
| 172 (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || | 172 (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || |
| 173 equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) | 173 equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) |
| 174 urlParameter = stripLeadingAndTrailingHTMLSpaces(p->value()); | 174 urlParameter = stripLeadingAndTrailingHTMLSpaces(p->value()); |
| 175 // TODO(schenney): crbug.com/572908 serviceType calculation does not belong | 175 // TODO(schenney): crbug.com/572908 serviceType calculation does not belong |
| 176 // in this function. | 176 // in this function. |
| 177 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { | 177 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 194 uniqueParamNames.add( | 194 uniqueParamNames.add( |
| 195 codebase.impl()); // pretend we found it in a PARAM already | 195 codebase.impl()); // pretend we found it in a PARAM already |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Turn the attributes of the <object> element into arrays, but don't override | 198 // Turn the attributes of the <object> element into arrays, but don't override |
| 199 // <param> values. | 199 // <param> values. |
| 200 AttributeCollection attributes = this->attributes(); | 200 AttributeCollection attributes = this->attributes(); |
| 201 for (const Attribute& attribute : attributes) { | 201 for (const Attribute& attribute : attributes) { |
| 202 const AtomicString& name = attribute.name().localName(); | 202 const AtomicString& name = attribute.name().localName(); |
| 203 if (!uniqueParamNames.contains(name.impl())) { | 203 if (!uniqueParamNames.contains(name.impl())) { |
| 204 paramNames.append(name.getString()); | 204 paramNames.push_back(name.getString()); |
| 205 paramValues.append(attribute.value().getString()); | 205 paramValues.push_back(attribute.value().getString()); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 mapDataParamToSrc(¶mNames, ¶mValues); | 209 mapDataParamToSrc(¶mNames, ¶mValues); |
| 210 | 210 |
| 211 // HTML5 says that an object resource's URL is specified by the object's data | 211 // HTML5 says that an object resource's URL is specified by the object's data |
| 212 // attribute, not by a param element. However, for compatibility, allow the | 212 // attribute, not by a param element. However, for compatibility, allow the |
| 213 // resource's URL to be given by a param named "src", "movie", "code" or "url" | 213 // resource's URL to be given by a param named "src", "movie", "code" or "url" |
| 214 // if we know that resource points to a plugin. | 214 // if we know that resource points to a plugin. |
| 215 if (url.isEmpty() && !urlParameter.isEmpty()) { | 215 if (url.isEmpty() && !urlParameter.isEmpty()) { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 458 |
| 459 bool HTMLObjectElement::willUseFallbackContentAtLayout() const { | 459 bool HTMLObjectElement::willUseFallbackContentAtLayout() const { |
| 460 return !hasValidClassId() && hasFallbackContent(); | 460 return !hasValidClassId() && hasFallbackContent(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void HTMLObjectElement::associateWith(HTMLFormElement* form) { | 463 void HTMLObjectElement::associateWith(HTMLFormElement* form) { |
| 464 associateByParser(form); | 464 associateByParser(form); |
| 465 }; | 465 }; |
| 466 | 466 |
| 467 } // namespace blink | 467 } // namespace blink |
| OLD | NEW |