| 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 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #define HTMLElement_h | 24 #define HTMLElement_h |
| 25 | 25 |
| 26 #include "StyledElement.h" | 26 #include "StyledElement.h" |
| 27 | 27 |
| 28 namespace WebCore { | 28 namespace WebCore { |
| 29 | 29 |
| 30 class DocumentFragment; | 30 class DocumentFragment; |
| 31 class HTMLCollection; | 31 class HTMLCollection; |
| 32 class HTMLFormElement; | 32 class HTMLFormElement; |
| 33 | 33 |
| 34 #if ENABLE(MICRODATA) | |
| 35 class HTMLPropertiesCollection; | |
| 36 class MicroDataItemValue; | |
| 37 #endif | |
| 38 | |
| 39 enum TranslateAttributeMode { | 34 enum TranslateAttributeMode { |
| 40 TranslateAttributeYes, | 35 TranslateAttributeYes, |
| 41 TranslateAttributeNo, | 36 TranslateAttributeNo, |
| 42 TranslateAttributeInherit | 37 TranslateAttributeInherit |
| 43 }; | 38 }; |
| 44 | 39 |
| 45 class HTMLElement : public StyledElement { | 40 class HTMLElement : public StyledElement { |
| 46 public: | 41 public: |
| 47 static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document
*); | 42 static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document
*); |
| 48 | 43 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 virtual bool rendererIsNeeded(const NodeRenderingContext&); | 83 virtual bool rendererIsNeeded(const NodeRenderingContext&); |
| 89 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); | 84 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); |
| 90 | 85 |
| 91 HTMLFormElement* form() const { return virtualForm(); } | 86 HTMLFormElement* form() const { return virtualForm(); } |
| 92 | 87 |
| 93 HTMLFormElement* findFormAncestor() const; | 88 HTMLFormElement* findFormAncestor() const; |
| 94 | 89 |
| 95 bool hasDirectionAuto() const; | 90 bool hasDirectionAuto() const; |
| 96 TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const; | 91 TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const; |
| 97 | 92 |
| 98 #if ENABLE(MICRODATA) | |
| 99 void setItemValue(const String&, ExceptionCode&); | |
| 100 PassRefPtr<MicroDataItemValue> itemValue() const; | |
| 101 PassRefPtr<HTMLPropertiesCollection> properties(); | |
| 102 void getItemRefElements(Vector<HTMLElement*>&); | |
| 103 #endif | |
| 104 | |
| 105 virtual bool isHTMLUnknownElement() const { return false; } | 93 virtual bool isHTMLUnknownElement() const { return false; } |
| 106 | 94 |
| 107 virtual bool isLabelable() const { return false; } | 95 virtual bool isLabelable() const { return false; } |
| 108 | 96 |
| 109 protected: | 97 protected: |
| 110 HTMLElement(const QualifiedName& tagName, Document*, ConstructionType); | 98 HTMLElement(const QualifiedName& tagName, Document*, ConstructionType); |
| 111 | 99 |
| 112 void addHTMLLengthToStyle(MutableStylePropertySet*, CSSPropertyID, const Str
ing& value); | 100 void addHTMLLengthToStyle(MutableStylePropertySet*, CSSPropertyID, const Str
ing& value); |
| 113 void addHTMLColorToStyle(MutableStylePropertySet*, CSSPropertyID, const Stri
ng& color); | 101 void addHTMLColorToStyle(MutableStylePropertySet*, CSSPropertyID, const Stri
ng& color); |
| 114 | 102 |
| 115 void applyAlignmentAttributeToStyle(const AtomicString&, MutableStylePropert
ySet*); | 103 void applyAlignmentAttributeToStyle(const AtomicString&, MutableStylePropert
ySet*); |
| 116 void applyBorderAttributeToStyle(const AtomicString&, MutableStylePropertySe
t*); | 104 void applyBorderAttributeToStyle(const AtomicString&, MutableStylePropertySe
t*); |
| 117 | 105 |
| 118 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 106 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
| 119 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 107 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; |
| 120 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) OVERRIDE; | 108 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) OVERRIDE; |
| 121 unsigned parseBorderWidthAttribute(const AtomicString&) const; | 109 unsigned parseBorderWidthAttribute(const AtomicString&) const; |
| 122 | 110 |
| 123 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); | 111 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); |
| 124 void calculateAndAdjustDirectionality(); | 112 void calculateAndAdjustDirectionality(); |
| 125 | 113 |
| 126 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; | |
| 127 | |
| 128 private: | 114 private: |
| 129 virtual String nodeName() const; | 115 virtual String nodeName() const; |
| 130 | 116 |
| 131 void mapLanguageAttributeToLocale(const AtomicString&, MutableStylePropertyS
et*); | 117 void mapLanguageAttributeToLocale(const AtomicString&, MutableStylePropertyS
et*); |
| 132 | 118 |
| 133 virtual HTMLFormElement* virtualForm() const; | 119 virtual HTMLFormElement* virtualForm() const; |
| 134 | 120 |
| 135 Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&); | 121 Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&); |
| 136 PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionCode&); | 122 PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionCode&); |
| 137 | 123 |
| 138 void dirAttributeChanged(const AtomicString&); | 124 void dirAttributeChanged(const AtomicString&); |
| 139 void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child); | 125 void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child); |
| 140 void adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, in
t childCountDelta); | 126 void adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, in
t childCountDelta); |
| 141 TextDirection directionality(Node** strongDirectionalityTextNode= 0) const; | 127 TextDirection directionality(Node** strongDirectionalityTextNode= 0) const; |
| 142 | 128 |
| 143 TranslateAttributeMode translateAttributeMode() const; | 129 TranslateAttributeMode translateAttributeMode() const; |
| 144 | 130 |
| 145 AtomicString eventNameForAttributeName(const QualifiedName& attrName) const; | 131 AtomicString eventNameForAttributeName(const QualifiedName& attrName) const; |
| 146 | |
| 147 #if ENABLE(MICRODATA) | |
| 148 virtual String itemValueText() const; | |
| 149 virtual void setItemValueText(const String&, ExceptionCode&); | |
| 150 #endif | |
| 151 }; | 132 }; |
| 152 | 133 |
| 153 inline HTMLElement* toHTMLElement(Node* node) | 134 inline HTMLElement* toHTMLElement(Node* node) |
| 154 { | 135 { |
| 155 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); | 136 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); |
| 156 return static_cast<HTMLElement*>(node); | 137 return static_cast<HTMLElement*>(node); |
| 157 } | 138 } |
| 158 | 139 |
| 159 inline const HTMLElement* toHTMLElement(const Node* node) | 140 inline const HTMLElement* toHTMLElement(const Node* node) |
| 160 { | 141 { |
| 161 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); | 142 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); |
| 162 return static_cast<const HTMLElement*>(node); | 143 return static_cast<const HTMLElement*>(node); |
| 163 } | 144 } |
| 164 | 145 |
| 165 // This will catch anyone doing an unnecessary cast. | 146 // This will catch anyone doing an unnecessary cast. |
| 166 void toHTMLElement(const HTMLElement*); | 147 void toHTMLElement(const HTMLElement*); |
| 167 | 148 |
| 168 inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document
, ConstructionType type = CreateHTMLElement) | 149 inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document
, ConstructionType type = CreateHTMLElement) |
| 169 : StyledElement(tagName, document, type) | 150 : StyledElement(tagName, document, type) |
| 170 { | 151 { |
| 171 ASSERT(tagName.localName().impl()); | 152 ASSERT(tagName.localName().impl()); |
| 172 ScriptWrappable::init(this); | 153 ScriptWrappable::init(this); |
| 173 } | 154 } |
| 174 | 155 |
| 175 } // namespace WebCore | 156 } // namespace WebCore |
| 176 | 157 |
| 177 #endif // HTMLElement_h | 158 #endif // HTMLElement_h |
| OLD | NEW |