| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. | 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void removeAttribute(const QualifiedName&); | 99 void removeAttribute(const QualifiedName&); |
| 100 | 100 |
| 101 // Typed getters and setters for language bindings. | 101 // Typed getters and setters for language bindings. |
| 102 int getIntegralAttribute(const QualifiedName& attributeName) const; | 102 int getIntegralAttribute(const QualifiedName& attributeName) const; |
| 103 void setIntegralAttribute(const QualifiedName& attributeName, int value); | 103 void setIntegralAttribute(const QualifiedName& attributeName, int value); |
| 104 unsigned getUnsignedIntegralAttribute(const QualifiedName& attributeName) co
nst; | 104 unsigned getUnsignedIntegralAttribute(const QualifiedName& attributeName) co
nst; |
| 105 void setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsign
ed value); | 105 void setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsign
ed value); |
| 106 double getFloatingPointAttribute(const QualifiedName& attributeName, double
fallbackValue = std::numeric_limits<double>::quiet_NaN()) const; | 106 double getFloatingPointAttribute(const QualifiedName& attributeName, double
fallbackValue = std::numeric_limits<double>::quiet_NaN()) const; |
| 107 void setFloatingPointAttribute(const QualifiedName& attributeName, double va
lue); | 107 void setFloatingPointAttribute(const QualifiedName& attributeName, double va
lue); |
| 108 | 108 |
| 109 #ifdef DUMP_NODE_STATISTICS | |
| 110 bool hasNamedNodeMap() const; | |
| 111 #endif | |
| 112 bool hasAttributes() const; | 109 bool hasAttributes() const; |
| 113 | 110 |
| 114 bool hasAttribute(const AtomicString& name) const; | 111 bool hasAttribute(const AtomicString& name) const; |
| 115 | 112 |
| 116 const AtomicString& getAttribute(const AtomicString& name) const; | 113 const AtomicString& getAttribute(const AtomicString& name) const; |
| 117 | 114 |
| 118 void setAttribute(const AtomicString& name, const AtomicString& value, Excep
tionState&); | 115 void setAttribute(const AtomicString& name, const AtomicString& value, Excep
tionState&); |
| 119 static bool parseAttributeName(QualifiedName&, const AtomicString& namespace
URI, const AtomicString& qualifiedName, ExceptionState&); | 116 static bool parseAttributeName(QualifiedName&, const AtomicString& namespace
URI, const AtomicString& qualifiedName, ExceptionState&); |
| 120 | 117 |
| 121 const AtomicString& getIdAttribute() const; | 118 const AtomicString& getIdAttribute() const; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int scrollWidth(); | 156 int scrollWidth(); |
| 160 int scrollHeight(); | 157 int scrollHeight(); |
| 161 | 158 |
| 162 PassRefPtr<ClientRectList> getClientRects(); | 159 PassRefPtr<ClientRectList> getClientRects(); |
| 163 PassRefPtr<ClientRect> getBoundingClientRect(); | 160 PassRefPtr<ClientRect> getBoundingClientRect(); |
| 164 | 161 |
| 165 virtual void didMoveToNewDocument(Document&) override; | 162 virtual void didMoveToNewDocument(Document&) override; |
| 166 | 163 |
| 167 void removeAttribute(const AtomicString& name); | 164 void removeAttribute(const AtomicString& name); |
| 168 | 165 |
| 169 PassRefPtr<Attr> getAttributeNode(const AtomicString& name); | |
| 170 | |
| 171 PassRefPtr<Attr> attrIfExists(const QualifiedName&); | |
| 172 PassRefPtr<Attr> ensureAttr(const QualifiedName&); | |
| 173 | |
| 174 Vector<RefPtr<Attr> >* attrNodeList(); | |
| 175 | |
| 176 CSSStyleDeclaration* style(); | 166 CSSStyleDeclaration* style(); |
| 177 | 167 |
| 178 const QualifiedName& tagQName() const { return m_tagName; } | 168 const QualifiedName& tagQName() const { return m_tagName; } |
| 179 String tagName() const { return nodeName(); } | 169 String tagName() const { return nodeName(); } |
| 180 | 170 |
| 181 bool hasTagName(const QualifiedName& tagName) const { return m_tagName == ta
gName; } | 171 bool hasTagName(const QualifiedName& tagName) const { return m_tagName == ta
gName; } |
| 182 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo
de::hasTagName(tagName); } | 172 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo
de::hasTagName(tagName); } |
| 183 | 173 |
| 184 // A fast function for checking the local name against another atomic string
. | 174 // A fast function for checking the local name against another atomic string
. |
| 185 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN
ame() == other; } | 175 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN
ame() == other; } |
| 186 | 176 |
| 187 virtual const AtomicString& localName() const override final { return m_tagN
ame.localName(); } | 177 virtual const AtomicString& localName() const override final { return m_tagN
ame.localName(); } |
| 188 | 178 |
| 189 virtual String nodeName() const override; | 179 virtual String nodeName() const override; |
| 190 | 180 |
| 191 PassRefPtr<Element> cloneElementWithChildren(); | 181 PassRefPtr<Element> cloneElementWithChildren(); |
| 192 PassRefPtr<Element> cloneElementWithoutChildren(); | 182 PassRefPtr<Element> cloneElementWithoutChildren(); |
| 193 | 183 |
| 194 void normalizeAttributes(); | |
| 195 | |
| 196 void setBooleanAttribute(const QualifiedName& name, bool); | 184 void setBooleanAttribute(const QualifiedName& name, bool); |
| 197 | 185 |
| 198 void invalidateStyleAttribute(); | 186 void invalidateStyleAttribute(); |
| 199 | 187 |
| 200 const StylePropertySet* inlineStyle() const { return elementData() ? element
Data()->m_inlineStyle.get() : 0; } | 188 const StylePropertySet* inlineStyle() const { return elementData() ? element
Data()->m_inlineStyle.get() : 0; } |
| 201 | 189 |
| 202 bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool impor
tant = false); | 190 bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool impor
tant = false); |
| 203 bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::
UnitType, bool important = false); | 191 bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::
UnitType, bool important = false); |
| 204 bool setInlineStyleProperty(CSSPropertyID, const String& value, bool importa
nt = false); | 192 bool setInlineStyleProperty(CSSPropertyID, const String& value, bool importa
nt = false); |
| 205 bool removeInlineStyleProperty(CSSPropertyID); | 193 bool removeInlineStyleProperty(CSSPropertyID); |
| 206 void removeAllInlineStyleProperties(); | 194 void removeAllInlineStyleProperties(); |
| 207 | 195 |
| 208 void synchronizeStyleAttributeInternal() const; | 196 void synchronizeStyleAttributeInternal() const; |
| 209 | 197 |
| 210 // For exposing to DOM only. | |
| 211 NamedNodeMap* attributesForBindings() const; | |
| 212 | |
| 213 enum AttributeModificationReason { | 198 enum AttributeModificationReason { |
| 214 ModifiedDirectly, | 199 ModifiedDirectly, |
| 215 ModifiedByCloning | 200 ModifiedByCloning |
| 216 }; | 201 }; |
| 217 | 202 |
| 218 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att
ributeModificationReason = ModifiedDirectly); | 203 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att
ributeModificationReason = ModifiedDirectly); |
| 219 virtual void parseAttribute(const QualifiedName&, const AtomicString&); | 204 virtual void parseAttribute(const QualifiedName&, const AtomicString&); |
| 220 | 205 |
| 221 virtual bool hasLegalLinkAttribute(const QualifiedName&) const; | 206 virtual bool hasLegalLinkAttribute(const QualifiedName&) const; |
| 222 virtual const QualifiedName& subResourceAttributeName() const; | 207 virtual const QualifiedName& subResourceAttributeName() const; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 431 |
| 447 SpellcheckAttributeState spellcheckAttributeState() const; | 432 SpellcheckAttributeState spellcheckAttributeState() const; |
| 448 | 433 |
| 449 void createUniqueElementData(); | 434 void createUniqueElementData(); |
| 450 | 435 |
| 451 bool shouldInvalidateDistributionWhenAttributeChanged(ElementShadow*, const
QualifiedName&, const AtomicString&); | 436 bool shouldInvalidateDistributionWhenAttributeChanged(ElementShadow*, const
QualifiedName&, const AtomicString&); |
| 452 | 437 |
| 453 ElementRareData* elementRareData() const; | 438 ElementRareData* elementRareData() const; |
| 454 ElementRareData& ensureElementRareData(); | 439 ElementRareData& ensureElementRareData(); |
| 455 | 440 |
| 456 Vector<RefPtr<Attr> >& ensureAttrNodeList(); | |
| 457 void removeAttrNodeList(); | |
| 458 void detachAllAttrNodesFromElement(); | |
| 459 | |
| 460 RefPtr<ElementData> m_elementData; | 441 RefPtr<ElementData> m_elementData; |
| 461 }; | 442 }; |
| 462 | 443 |
| 463 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); | 444 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); |
| 464 template <typename T> bool isElementOfType(const Node&); | 445 template <typename T> bool isElementOfType(const Node&); |
| 465 template <> inline bool isElementOfType<const Element>(const Node& node) { retur
n node.isElementNode(); } | 446 template <> inline bool isElementOfType<const Element>(const Node& node) { retur
n node.isElementNode(); } |
| 466 template <typename T> inline bool isElementOfType(const Element& element) { retu
rn isElementOfType<T>(static_cast<const Node&>(element)); } | 447 template <typename T> inline bool isElementOfType(const Element& element) { retu
rn isElementOfType<T>(static_cast<const Node&>(element)); } |
| 467 template <> inline bool isElementOfType<const Element>(const Element&) { return
true; } | 448 template <> inline bool isElementOfType<const Element>(const Element&) { return
true; } |
| 468 | 449 |
| 469 // Type casting. | 450 // Type casting. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 static PassRefPtr<T> create(const QualifiedName&, Document&) | 640 static PassRefPtr<T> create(const QualifiedName&, Document&) |
| 660 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 641 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
| 661 PassRefPtr<T> T::create(const QualifiedName& tagName, Document& document) \ | 642 PassRefPtr<T> T::create(const QualifiedName& tagName, Document& document) \ |
| 662 { \ | 643 { \ |
| 663 return adoptRef(new T(tagName, document)); \ | 644 return adoptRef(new T(tagName, document)); \ |
| 664 } | 645 } |
| 665 | 646 |
| 666 } // namespace | 647 } // namespace |
| 667 | 648 |
| 668 #endif // Element_h | 649 #endif // Element_h |
| OLD | NEW |