2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / html / HTMLElement.h
blob1fba13089520cead91a88100d527a52232d76d4c
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef HTMLElement_h
24 #define HTMLElement_h
26 #include "StyledElement.h"
28 namespace WebCore {
30 class DocumentFragment;
31 class HTMLCollection;
32 class HTMLFormElement;
34 enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
36 class HTMLElement : public StyledElement {
37 public:
38 HTMLElement(const QualifiedName& tagName, Document*);
39 virtual ~HTMLElement();
41 virtual bool isHTMLElement() const { return true; }
43 virtual String nodeName() const;
45 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
46 virtual void parseMappedAttribute(MappedAttribute*);
48 virtual PassRefPtr<Node> cloneNode(bool deep);
50 PassRefPtr<HTMLCollection> children();
52 String id() const;
53 void setId(const String&);
54 virtual String title() const;
55 void setTitle(const String&);
56 String lang() const;
57 void setLang(const String&);
58 String dir() const;
59 void setDir(const String&);
60 String className() const;
61 void setClassName(const String&);
62 virtual short tabIndex() const;
63 void setTabIndex(int);
65 String innerHTML() const;
66 String outerHTML() const;
67 PassRefPtr<DocumentFragment> createContextualFragment(const String&);
68 void setInnerHTML(const String&, ExceptionCode&);
69 void setOuterHTML(const String&, ExceptionCode&);
70 void setInnerText(const String&, ExceptionCode&);
71 void setOuterText(const String&, ExceptionCode&);
73 Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&);
74 void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
75 void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
77 virtual bool isFocusable() const;
78 virtual bool isContentEditable() const;
79 virtual bool isContentRichlyEditable() const;
80 virtual String contentEditable() const;
81 virtual void setContentEditable(MappedAttribute*);
82 virtual void setContentEditable(const String&);
84 void click();
86 virtual void accessKeyAction(bool sendToAnyElement);
88 virtual bool isGenericFormElement() const { return false; }
90 virtual HTMLTagStatus endTagRequirement() const;
91 virtual int tagPriority() const;
92 virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
94 // Helper function to check the DTD for a given child node.
95 virtual bool checkDTD(const Node*);
96 static bool inEitherTagList(const Node*);
97 static bool inInlineTagList(const Node*);
98 static bool inBlockTagList(const Node*);
99 static bool isRecognizedTagName(const QualifiedName&);
101 virtual bool rendererIsNeeded(RenderStyle*);
102 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
104 HTMLFormElement* form() const { return virtualForm(); }
105 HTMLFormElement* findFormAncestor() const;
107 protected:
108 void addHTMLAlignment(MappedAttribute*);
110 private:
111 virtual HTMLFormElement* virtualForm() const;
112 Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
115 } // namespace WebCore
117 #endif // HTMLElement_h