• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
5  *
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.
10  *
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.
15  *
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.
20  *
21  */
22 
23 #ifndef HTMLElement_h
24 #define HTMLElement_h
25 
26 #include "StyledElement.h"
27 
28 namespace WebCore {
29 
30 class DocumentFragment;
31 class HTMLCollection;
32 class HTMLFormElement;
33 
34 enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
35 
36 class HTMLElement : public StyledElement {
37 public:
38     HTMLElement(const QualifiedName& tagName, Document*);
39     virtual ~HTMLElement();
40 
isHTMLElement()41     virtual bool isHTMLElement() const { return true; }
42 
43     virtual String nodeName() const;
44 
45     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
46     virtual void parseMappedAttribute(MappedAttribute*);
47 
48     PassRefPtr<HTMLCollection> children();
49 
50     String id() const;
51     void setId(const String&);
52     virtual String title() const;
53     void setTitle(const String&);
54     String lang() const;
55     void setLang(const String&);
56     String dir() const;
57     void setDir(const String&);
58     String className() const;
59     void setClassName(const String&);
60     virtual short tabIndex() const;
61     void setTabIndex(int);
62 
63     String innerHTML() const;
64     String outerHTML() const;
65     PassRefPtr<DocumentFragment> createContextualFragment(const String&);
66     void setInnerHTML(const String&, ExceptionCode&);
67     void setOuterHTML(const String&, ExceptionCode&);
68     void setInnerText(const String&, ExceptionCode&);
69     void setOuterText(const String&, ExceptionCode&);
70 
71     Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&);
72     void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
73     void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
74 
75     virtual bool isFocusable() const;
76     virtual bool isContentEditable() const;
77     virtual bool isContentRichlyEditable() const;
78     virtual String contentEditable() const;
79     virtual void setContentEditable(MappedAttribute*);
80     virtual void setContentEditable(const String&);
81 
82     virtual bool draggable() const;
83     void setDraggable(bool);
84 
85     void click();
86 
87     virtual void accessKeyAction(bool sendToAnyElement);
88 
89     virtual HTMLTagStatus endTagRequirement() const;
90     virtual int tagPriority() const;
91     virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
92 
93     // Helper function to check the DTD for a given child node.
94     virtual bool checkDTD(const Node*);
95     static bool inEitherTagList(const Node*);
96     static bool inInlineTagList(const Node*);
97     static bool inBlockTagList(const Node*);
98     static bool isRecognizedTagName(const QualifiedName&);
99 
100     virtual bool rendererIsNeeded(RenderStyle*);
101     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
102 
form()103     HTMLFormElement* form() const { return virtualForm(); }
104     HTMLFormElement* findFormAncestor() const;
105 
106     static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*);
107 
108 protected:
109     void addHTMLAlignment(MappedAttribute*);
110 
111 private:
112     virtual HTMLFormElement* virtualForm() const;
113     Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
114 };
115 
116 } // namespace WebCore
117 
118 #endif // HTMLElement_h
119