| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
#ifndef Element_h |
|---|
| 26 |
#define Element_h |
|---|
| 27 |
|
|---|
| 28 |
#include "ContainerNode.h" |
|---|
| 29 |
#include "QualifiedName.h" |
|---|
| 30 |
#include "ScrollTypes.h" |
|---|
| 31 |
|
|---|
| 32 |
namespace WebCore { |
|---|
| 33 |
|
|---|
| 34 |
class Attr; |
|---|
| 35 |
class Attribute; |
|---|
| 36 |
class CSSStyleDeclaration; |
|---|
| 37 |
class ElementRareData; |
|---|
| 38 |
class IntSize; |
|---|
| 39 |
|
|---|
| 40 |
class Element : public ContainerNode { |
|---|
| 41 |
public: |
|---|
| 42 |
Element(const QualifiedName&, Document*); |
|---|
| 43 |
~Element(); |
|---|
| 44 |
|
|---|
| 45 |
const AtomicString& getIDAttribute() const; |
|---|
| 46 |
bool hasAttribute(const QualifiedName&) const; |
|---|
| 47 |
const AtomicString& getAttribute(const QualifiedName&) const; |
|---|
| 48 |
void setAttribute(const QualifiedName&, const AtomicString& value, ExceptionCode&); |
|---|
| 49 |
void removeAttribute(const QualifiedName&, ExceptionCode&); |
|---|
| 50 |
|
|---|
| 51 |
bool hasAttributes() const; |
|---|
| 52 |
|
|---|
| 53 |
bool hasAttribute(const String& name) const; |
|---|
| 54 |
bool hasAttributeNS(const String& namespaceURI, const String& localName) const; |
|---|
| 55 |
|
|---|
| 56 |
const AtomicString& getAttribute(const String& name) const; |
|---|
| 57 |
const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const; |
|---|
| 58 |
|
|---|
| 59 |
void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&); |
|---|
| 60 |
void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&); |
|---|
| 61 |
|
|---|
| 62 |
void scrollIntoView (bool alignToTop = true); |
|---|
| 63 |
void scrollIntoViewIfNeeded(bool centerIfNeeded = true); |
|---|
| 64 |
|
|---|
| 65 |
void scrollByUnits(int units, ScrollGranularity); |
|---|
| 66 |
void scrollByLines(int lines); |
|---|
| 67 |
void scrollByPages(int pages); |
|---|
| 68 |
|
|---|
| 69 |
int offsetLeft(); |
|---|
| 70 |
int offsetTop(); |
|---|
| 71 |
int offsetWidth(); |
|---|
| 72 |
int offsetHeight(); |
|---|
| 73 |
Element* offsetParent(); |
|---|
| 74 |
int clientLeft(); |
|---|
| 75 |
int clientTop(); |
|---|
| 76 |
int clientWidth(); |
|---|
| 77 |
int clientHeight(); |
|---|
| 78 |
int scrollLeft(); |
|---|
| 79 |
int scrollTop(); |
|---|
| 80 |
void setScrollLeft(int); |
|---|
| 81 |
void setScrollTop(int); |
|---|
| 82 |
int scrollWidth(); |
|---|
| 83 |
int scrollHeight(); |
|---|
| 84 |
|
|---|
| 85 |
void removeAttribute(const String& name, ExceptionCode&); |
|---|
| 86 |
void removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode&); |
|---|
| 87 |
|
|---|
| 88 |
PassRefPtr<Attr> getAttributeNode(const String& name); |
|---|
| 89 |
PassRefPtr<Attr> getAttributeNodeNS(const String& namespaceURI, const String& localName); |
|---|
| 90 |
PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&); |
|---|
| 91 |
PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&); |
|---|
| 92 |
PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&); |
|---|
| 93 |
|
|---|
| 94 |
virtual CSSStyleDeclaration* style(); |
|---|
| 95 |
|
|---|
| 96 |
const QualifiedName& tagQName() const { return m_tagName; } |
|---|
| 97 |
String tagName() const { return nodeName(); } |
|---|
| 98 |
bool hasTagName(const QualifiedName& tagName) const { return m_tagName.matches(tagName); } |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; } |
|---|
| 102 |
bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); } |
|---|
| 103 |
|
|---|
| 104 |
virtual const AtomicString& localName() const { return m_tagName.localName(); } |
|---|
| 105 |
virtual const AtomicString& prefix() const { return m_tagName.prefix(); } |
|---|
| 106 |
virtual void setPrefix(const AtomicString &_prefix, ExceptionCode&); |
|---|
| 107 |
virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); } |
|---|
| 108 |
|
|---|
| 109 |
virtual KURL baseURI() const; |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
virtual NodeType nodeType() const; |
|---|
| 113 |
virtual PassRefPtr<Node> cloneNode(bool deep); |
|---|
| 114 |
virtual String nodeName() const; |
|---|
| 115 |
virtual bool isElementNode() const { return true; } |
|---|
| 116 |
virtual void insertedIntoDocument(); |
|---|
| 117 |
virtual void removedFromDocument(); |
|---|
| 118 |
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); |
|---|
| 119 |
|
|---|
| 120 |
void normalizeAttributes(); |
|---|
| 121 |
|
|---|
| 122 |
virtual bool isInputTypeHidden() const { return false; } |
|---|
| 123 |
virtual bool isPasswordField() const { return false; } |
|---|
| 124 |
|
|---|
| 125 |
String nodeNamePreservingCase() const; |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
void setAttribute(const QualifiedName&, const AtomicString& value); |
|---|
| 129 |
void setBooleanAttribute(const QualifiedName& name, bool); |
|---|
| 130 |
|
|---|
| 131 |
virtual NamedAttrMap* attributes() const; |
|---|
| 132 |
NamedAttrMap* attributes(bool readonly) const; |
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
virtual void attributeChanged(Attribute*, bool preserveDecls = false); |
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
void setAttributeMap(PassRefPtr<NamedAttrMap>); |
|---|
| 139 |
|
|---|
| 140 |
virtual void copyNonAttributeProperties(const Element* source) {} |
|---|
| 141 |
|
|---|
| 142 |
virtual void attach(); |
|---|
| 143 |
virtual void detach(); |
|---|
| 144 |
virtual RenderStyle* styleForRenderer(RenderObject* parent); |
|---|
| 145 |
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); |
|---|
| 146 |
virtual void recalcStyle(StyleChange = NoChange); |
|---|
| 147 |
|
|---|
| 148 |
virtual RenderStyle* computedStyle(); |
|---|
| 149 |
|
|---|
| 150 |
virtual bool childTypeAllowed(NodeType); |
|---|
| 151 |
|
|---|
| 152 |
virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); |
|---|
| 153 |
|
|---|
| 154 |
void dispatchAttrRemovalEvent(Attribute*); |
|---|
| 155 |
void dispatchAttrAdditionEvent(Attribute*); |
|---|
| 156 |
|
|---|
| 157 |
virtual void accessKeyAction(bool sendToAnyEvent) { } |
|---|
| 158 |
|
|---|
| 159 |
virtual bool isURLAttribute(Attribute*) const; |
|---|
| 160 |
virtual const QualifiedName& imageSourceAttributeName() const; |
|---|
| 161 |
virtual String target() const { return String(); } |
|---|
| 162 |
|
|---|
| 163 |
virtual void focus(bool restorePreviousSelection = true); |
|---|
| 164 |
virtual void updateFocusAppearance(bool restorePreviousSelection); |
|---|
| 165 |
void blur(); |
|---|
| 166 |
|
|---|
| 167 |
#ifndef NDEBUG |
|---|
| 168 |
virtual void formatForDebugger(char* buffer, unsigned length) const; |
|---|
| 169 |
#endif |
|---|
| 170 |
|
|---|
| 171 |
bool contains(const Node*) const; |
|---|
| 172 |
|
|---|
| 173 |
String innerText() const; |
|---|
| 174 |
String outerText() const; |
|---|
| 175 |
|
|---|
| 176 |
virtual String title() const; |
|---|
| 177 |
|
|---|
| 178 |
String openTagStartToString() const; |
|---|
| 179 |
|
|---|
| 180 |
void updateId(const AtomicString& oldId, const AtomicString& newId); |
|---|
| 181 |
|
|---|
| 182 |
IntSize minimumSizeForResizing() const; |
|---|
| 183 |
void setMinimumSizeForResizing(const IntSize&); |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
virtual void willSaveToCache() { } |
|---|
| 187 |
virtual void didRestoreFromCache() { } |
|---|
| 188 |
|
|---|
| 189 |
bool isFinishedParsingChildren() const { return m_parsingChildrenFinished; } |
|---|
| 190 |
virtual void finishParsingChildren(); |
|---|
| 191 |
virtual void beginParsingChildren() { m_parsingChildrenFinished = false; } |
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
Element* firstElementChild() const; |
|---|
| 195 |
Element* lastElementChild() const; |
|---|
| 196 |
Element* previousElementSibling() const; |
|---|
| 197 |
Element* nextElementSibling() const; |
|---|
| 198 |
unsigned childElementCount() const; |
|---|
| 199 |
|
|---|
| 200 |
private: |
|---|
| 201 |
ElementRareData* rareData(); |
|---|
| 202 |
const ElementRareData* rareData() const; |
|---|
| 203 |
ElementRareData* createRareData(); |
|---|
| 204 |
|
|---|
| 205 |
virtual void createAttributeMap() const; |
|---|
| 206 |
|
|---|
| 207 |
virtual void updateStyleAttribute() const {} |
|---|
| 208 |
|
|---|
| 209 |
#if ENABLE(SVG) |
|---|
| 210 |
virtual void updateAnimatedSVGAttribute(const String&) const {} |
|---|
| 211 |
#endif |
|---|
| 212 |
|
|---|
| 213 |
void updateFocusAppearanceSoonAfterAttach(); |
|---|
| 214 |
void cancelFocusAppearanceUpdate(); |
|---|
| 215 |
|
|---|
| 216 |
virtual bool virtualHasTagName(const QualifiedName&) const; |
|---|
| 217 |
|
|---|
| 218 |
private: |
|---|
| 219 |
QualifiedName m_tagName; |
|---|
| 220 |
|
|---|
| 221 |
protected: |
|---|
| 222 |
mutable RefPtr<NamedAttrMap> namedAttrMap; |
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
mutable bool m_isStyleAttributeValid : 1; |
|---|
| 227 |
mutable bool m_synchronizingStyleAttribute : 1; |
|---|
| 228 |
|
|---|
| 229 |
#if ENABLE(SVG) |
|---|
| 230 |
|
|---|
| 231 |
mutable bool m_areSVGAttributesValid : 1; |
|---|
| 232 |
mutable bool m_synchronizingSVGAttributes : 1; |
|---|
| 233 |
#endif |
|---|
| 234 |
|
|---|
| 235 |
private: |
|---|
| 236 |
bool m_parsingChildrenFinished : 1; |
|---|
| 237 |
}; |
|---|
| 238 |
|
|---|
| 239 |
} |
|---|
| 240 |
|
|---|
| 241 |
#endif |
|---|
| 242 |
|
|---|