Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: Source/core/html/HTMLObjectElement.cpp

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.ht ml>. This means 180 // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.ht ml>. This means
181 // we have to explicitly suppress the tag's CODEBASE attribute if there is n one in a PARAM, 181 // we have to explicitly suppress the tag's CODEBASE attribute if there is n one in a PARAM,
182 // else our Java plugin will misinterpret it. [4004531] 182 // else our Java plugin will misinterpret it. [4004531]
183 String codebase; 183 String codebase;
184 if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) { 184 if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) {
185 codebase = "codebase"; 185 codebase = "codebase";
186 uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already 186 uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already
187 } 187 }
188 188
189 // Turn the attributes of the <object> element into arrays, but don't overri de <param> values. 189 // Turn the attributes of the <object> element into arrays, but don't overri de <param> values.
190 if (hasAttributes()) { 190 AttributeCollection attributes = this->attributes();
191 AttributeCollection attributes = this->attributes(); 191 AttributeCollection::const_iterator end = attributes.end();
192 AttributeCollection::const_iterator end = attributes.end(); 192 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
193 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 193 const AtomicString& name = it->name().localName();
194 const AtomicString& name = it->name().localName(); 194 if (!uniqueParamNames.contains(name.impl())) {
195 if (!uniqueParamNames.contains(name.impl())) { 195 paramNames.append(name.string());
196 paramNames.append(name.string()); 196 paramValues.append(it->value().string());
197 paramValues.append(it->value().string());
198 }
199 } 197 }
200 } 198 }
201 199
202 mapDataParamToSrc(&paramNames, &paramValues); 200 mapDataParamToSrc(&paramNames, &paramValues);
203 201
204 // HTML5 says that an object resource's URL is specified by the object's dat a 202 // HTML5 says that an object resource's URL is specified by the object's dat a
205 // attribute, not by a param element. However, for compatibility, allow the 203 // attribute, not by a param element. However, for compatibility, allow the
206 // resource's URL to be given by a param named "src", "movie", "code" or "ur l" 204 // resource's URL to be given by a param named "src", "movie", "code" or "ur l"
207 // if we know that resource points to a plug-in. 205 // if we know that resource points to a plug-in.
208 if (url.isEmpty() && !urlParameter.isEmpty()) { 206 if (url.isEmpty() && !urlParameter.isEmpty()) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 { 458 {
461 return fastHasAttribute(usemapAttr); 459 return fastHasAttribute(usemapAttr);
462 } 460 }
463 461
464 bool HTMLObjectElement::useFallbackContent() const 462 bool HTMLObjectElement::useFallbackContent() const
465 { 463 {
466 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; 464 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent;
467 } 465 }
468 466
469 } 467 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698