Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / html / HTMLScriptElement.h
blob4d18beb467b10b4d85bfa19f169d8473771b07c4
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
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.
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.
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.
24 #ifndef HTMLScriptElement_h
25 #define HTMLScriptElement_h
27 #include "ScriptElement.h"
28 #include "HTMLElement.h"
30 namespace WebCore {
32 class HTMLScriptElement : public HTMLElement
33 , public ScriptElement {
34 public:
35 HTMLScriptElement(const QualifiedName&, Document*, bool createdByParser);
36 ~HTMLScriptElement();
38 virtual bool shouldExecuteAsJavaScript() const;
39 virtual String scriptContent() const;
41 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
42 virtual int tagPriority() const { return 1; }
43 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
45 virtual void parseMappedAttribute(MappedAttribute*);
46 virtual void insertedIntoDocument();
47 virtual void removedFromDocument();
48 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
50 virtual bool isURLAttribute(Attribute*) const;
51 virtual void finishParsingChildren();
53 String text() const;
54 void setText(const String&);
56 String htmlFor() const;
57 void setHtmlFor(const String&);
59 String event() const;
60 void setEvent(const String&);
62 String charset() const;
63 void setCharset(const String&);
65 bool defer() const;
66 void setDefer(bool);
68 KURL src() const;
69 void setSrc(const String&);
71 String type() const;
72 void setType(const String&);
74 virtual String scriptCharset() const;
76 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
78 bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); }
80 protected:
81 virtual String sourceAttributeValue() const;
82 virtual String charsetAttributeValue() const;
83 virtual String typeAttributeValue() const;
84 virtual String languageAttributeValue() const;
85 virtual String forAttributeValue() const;
87 virtual void dispatchLoadEvent();
88 virtual void dispatchErrorEvent();
90 private:
91 ScriptElementData m_data;
94 } //namespace
96 #endif