darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 1 | /* |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 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) |
darin@apple.com | 877ce5b | 2010-05-28 15:38:58 +0000 | [diff] [blame] | 5 | * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 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 |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 | * Boston, MA 02110-1301, USA. |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 21 | */ |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 22 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 23 | #include "config.h" |
| 24 | #include "HTMLParamElement.h" |
| 25 | |
weinig@apple.com | c360893 | 2010-05-19 17:48:06 +0000 | [diff] [blame] | 26 | #include "Attribute.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 27 | #include "Document.h" |
| 28 | #include "HTMLNames.h" |
| 29 | |
| 30 | namespace WebCore { |
| 31 | |
| 32 | using namespace HTMLNames; |
| 33 | |
darin@apple.com | 877ce5b | 2010-05-28 15:38:58 +0000 | [diff] [blame] | 34 | inline HTMLParamElement::HTMLParamElement(const QualifiedName& tagName, Document* document) |
| 35 | : HTMLElement(tagName, document) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 36 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 37 | ASSERT(hasTagName(paramTag)); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 38 | } |
| 39 | |
darin@apple.com | 877ce5b | 2010-05-28 15:38:58 +0000 | [diff] [blame] | 40 | PassRefPtr<HTMLParamElement> HTMLParamElement::create(const QualifiedName& tagName, Document* document) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 41 | { |
darin@apple.com | f190b3d | 2010-06-16 23:07:32 +0000 | [diff] [blame] | 42 | return adoptRef(new HTMLParamElement(tagName, document)); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 43 | } |
| 44 | |
weinig@apple.com | c360893 | 2010-05-19 17:48:06 +0000 | [diff] [blame] | 45 | void HTMLParamElement::parseMappedAttribute(Attribute* attr) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 46 | { |
darin@apple.com | f5247d1 | 2010-06-13 17:29:10 +0000 | [diff] [blame] | 47 | if (isIdAttributeName(attr->name())) { |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 48 | // Must call base class so that hasID bit gets set. |
| 49 | HTMLElement::parseMappedAttribute(attr); |
hyatt@apple.com | 4258307 | 2008-02-20 22:47:57 +0000 | [diff] [blame] | 50 | if (document()->isHTMLDocument()) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 51 | return; |
| 52 | m_name = attr->value(); |
| 53 | } else if (attr->name() == nameAttr) { |
| 54 | m_name = attr->value(); |
| 55 | } else if (attr->name() == valueAttr) { |
| 56 | m_value = attr->value(); |
| 57 | } else |
| 58 | HTMLElement::parseMappedAttribute(attr); |
| 59 | } |
| 60 | |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 61 | bool HTMLParamElement::isURLAttribute(Attribute* attr) const |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 62 | { |
| 63 | if (attr->name() == valueAttr) { |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 64 | Attribute* attr = attributes()->getAttributeItem(nameAttr); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 65 | if (attr) { |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 66 | const AtomicString& value = attr->value(); |
| 67 | if (equalIgnoringCase(value, "data") || equalIgnoringCase(value, "movie") || equalIgnoringCase(value, "src")) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 68 | return true; |
| 69 | } |
| 70 | } |
| 71 | return false; |
| 72 | } |
| 73 | |
ddkilzer@apple.com | b27ae03 | 2008-12-06 11:54:46 +0000 | [diff] [blame] | 74 | void HTMLParamElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const |
beidson@apple.com | a4fb38f | 2008-03-27 04:08:17 +0000 | [diff] [blame] | 75 | { |
ddkilzer@apple.com | e9a5504 | 2008-12-23 00:00:14 +0000 | [diff] [blame] | 76 | HTMLElement::addSubresourceAttributeURLs(urls); |
| 77 | |
beidson@apple.com | a4fb38f | 2008-03-27 04:08:17 +0000 | [diff] [blame] | 78 | if (!equalIgnoringCase(name(), "data") && |
| 79 | !equalIgnoringCase(name(), "movie") && |
| 80 | !equalIgnoringCase(name(), "src")) |
| 81 | return; |
ddkilzer@apple.com | b27ae03 | 2008-12-06 11:54:46 +0000 | [diff] [blame] | 82 | |
| 83 | addSubresourceURL(urls, document()->completeURL(value())); |
beidson@apple.com | a4fb38f | 2008-03-27 04:08:17 +0000 | [diff] [blame] | 84 | } |
| 85 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 86 | } |