1 /* 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public License 18 * along with this library; see the file COPYING.LIB. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #include "config.h" 24 #include "HTMLParamElement.h" 25 26 #include "Document.h" 27 #include "HTMLNames.h" 28 #include "MappedAttribute.h" 29 30 namespace WebCore { 31 32 using namespace HTMLNames; 33 HTMLParamElement(const QualifiedName & tagName,Document * doc)34 HTMLParamElement::HTMLParamElement(const QualifiedName& tagName, Document* doc) 35 : HTMLElement(tagName, doc) 36 { 37 ASSERT(hasTagName(paramTag)); 38 } 39 ~HTMLParamElement()40 HTMLParamElement::~HTMLParamElement() 41 { 42 } 43 parseMappedAttribute(MappedAttribute * attr)44 void HTMLParamElement::parseMappedAttribute(MappedAttribute* attr) 45 { 46 if (attr->name() == idAttr) { 47 // Must call base class so that hasID bit gets set. 48 HTMLElement::parseMappedAttribute(attr); 49 if (document()->isHTMLDocument()) 50 return; 51 m_name = attr->value(); 52 } else if (attr->name() == nameAttr) { 53 m_name = attr->value(); 54 } else if (attr->name() == valueAttr) { 55 m_value = attr->value(); 56 } else 57 HTMLElement::parseMappedAttribute(attr); 58 } 59 isURLAttribute(Attribute * attr) const60 bool HTMLParamElement::isURLAttribute(Attribute* attr) const 61 { 62 if (attr->name() == valueAttr) { 63 Attribute* attr = attributes()->getAttributeItem(nameAttr); 64 if (attr) { 65 const AtomicString& value = attr->value(); 66 if (equalIgnoringCase(value, "data") || equalIgnoringCase(value, "movie") || equalIgnoringCase(value, "src")) 67 return true; 68 } 69 } 70 return false; 71 } 72 setName(const String & value)73 void HTMLParamElement::setName(const String& value) 74 { 75 setAttribute(nameAttr, value); 76 } 77 type() const78 String HTMLParamElement::type() const 79 { 80 return getAttribute(typeAttr); 81 } 82 setType(const String & value)83 void HTMLParamElement::setType(const String& value) 84 { 85 setAttribute(typeAttr, value); 86 } 87 setValue(const String & value)88 void HTMLParamElement::setValue(const String& value) 89 { 90 setAttribute(valueAttr, value); 91 } 92 valueType() const93 String HTMLParamElement::valueType() const 94 { 95 return getAttribute(valuetypeAttr); 96 } 97 setValueType(const String & value)98 void HTMLParamElement::setValueType(const String& value) 99 { 100 setAttribute(valuetypeAttr, value); 101 } 102 addSubresourceAttributeURLs(ListHashSet<KURL> & urls) const103 void HTMLParamElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 104 { 105 HTMLElement::addSubresourceAttributeURLs(urls); 106 107 if (!equalIgnoringCase(name(), "data") && 108 !equalIgnoringCase(name(), "movie") && 109 !equalIgnoringCase(name(), "src")) 110 return; 111 112 addSubresourceURL(urls, document()->completeURL(value())); 113 } 114 115 } 116