blob: 2dc9d1d1b72eefd5f03760d3dc12380a294696ad [file] [log] [blame]
darin@apple.coma3c493e2008-03-18 13:47:47 +00001/*
eseideld2f36a12006-05-12 18:14:17 +00002 * 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.com877ce5b2010-05-28 15:38:58 +00005 * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
eseideld2f36a12006-05-12 18:14:17 +00006 *
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
ddkilzerc8eccec2007-09-26 02:29:57 +000019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
eseideld2f36a12006-05-12 18:14:17 +000021 */
darin@apple.coma3c493e2008-03-18 13:47:47 +000022
eseideld2f36a12006-05-12 18:14:17 +000023#include "config.h"
24#include "HTMLParamElement.h"
25
weinig@apple.comc3608932010-05-19 17:48:06 +000026#include "Attribute.h"
eseideld2f36a12006-05-12 18:14:17 +000027#include "Document.h"
28#include "HTMLNames.h"
29
30namespace WebCore {
31
32using namespace HTMLNames;
33
darin@apple.com877ce5b2010-05-28 15:38:58 +000034inline HTMLParamElement::HTMLParamElement(const QualifiedName& tagName, Document* document)
35 : HTMLElement(tagName, document)
eseideld2f36a12006-05-12 18:14:17 +000036{
jchaffraix@webkit.org94d95b02008-12-04 22:39:05 +000037 ASSERT(hasTagName(paramTag));
eseideld2f36a12006-05-12 18:14:17 +000038}
39
darin@apple.com877ce5b2010-05-28 15:38:58 +000040PassRefPtr<HTMLParamElement> HTMLParamElement::create(const QualifiedName& tagName, Document* document)
eseideld2f36a12006-05-12 18:14:17 +000041{
darin@apple.comf190b3d2010-06-16 23:07:32 +000042 return adoptRef(new HTMLParamElement(tagName, document));
eseideld2f36a12006-05-12 18:14:17 +000043}
44
weinig@apple.comc3608932010-05-19 17:48:06 +000045void HTMLParamElement::parseMappedAttribute(Attribute* attr)
eseideld2f36a12006-05-12 18:14:17 +000046{
darin@apple.comf5247d12010-06-13 17:29:10 +000047 if (isIdAttributeName(attr->name())) {
eseideld2f36a12006-05-12 18:14:17 +000048 // Must call base class so that hasID bit gets set.
49 HTMLElement::parseMappedAttribute(attr);
hyatt@apple.com42583072008-02-20 22:47:57 +000050 if (document()->isHTMLDocument())
eseideld2f36a12006-05-12 18:14:17 +000051 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.coma3c493e2008-03-18 13:47:47 +000061bool HTMLParamElement::isURLAttribute(Attribute* attr) const
eseideld2f36a12006-05-12 18:14:17 +000062{
63 if (attr->name() == valueAttr) {
darin@apple.coma3c493e2008-03-18 13:47:47 +000064 Attribute* attr = attributes()->getAttributeItem(nameAttr);
eseideld2f36a12006-05-12 18:14:17 +000065 if (attr) {
darin@apple.coma3c493e2008-03-18 13:47:47 +000066 const AtomicString& value = attr->value();
67 if (equalIgnoringCase(value, "data") || equalIgnoringCase(value, "movie") || equalIgnoringCase(value, "src"))
eseideld2f36a12006-05-12 18:14:17 +000068 return true;
69 }
70 }
71 return false;
72}
73
ddkilzer@apple.comb27ae032008-12-06 11:54:46 +000074void HTMLParamElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
beidson@apple.coma4fb38f2008-03-27 04:08:17 +000075{
ddkilzer@apple.come9a55042008-12-23 00:00:14 +000076 HTMLElement::addSubresourceAttributeURLs(urls);
77
beidson@apple.coma4fb38f2008-03-27 04:08:17 +000078 if (!equalIgnoringCase(name(), "data") &&
79 !equalIgnoringCase(name(), "movie") &&
80 !equalIgnoringCase(name(), "src"))
81 return;
ddkilzer@apple.comb27ae032008-12-06 11:54:46 +000082
83 addSubresourceURL(urls, document()->completeURL(value()));
beidson@apple.coma4fb38f2008-03-27 04:08:17 +000084}
85
eseideld2f36a12006-05-12 18:14:17 +000086}