LEFT | RIGHT |
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-2017 Apple Inc. All rights reserved. | 6 * Copyright (C) 2003-2017 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class PlatformKeyboardEvent; | 51 class PlatformKeyboardEvent; |
52 class PlatformMouseEvent; | 52 class PlatformMouseEvent; |
53 class PlatformWheelEvent; | 53 class PlatformWheelEvent; |
54 class PseudoElement; | 54 class PseudoElement; |
55 class RenderTreePosition; | 55 class RenderTreePosition; |
56 class WebAnimation; | 56 class WebAnimation; |
57 struct ElementStyle; | 57 struct ElementStyle; |
58 | 58 |
59 #if ENABLE(INTERSECTION_OBSERVER) | 59 #if ENABLE(INTERSECTION_OBSERVER) |
60 class IntersectionObserver; | 60 class IntersectionObserver; |
61 struct IntersectionObserverRegistration; | 61 struct IntersectionObserverData; |
62 #endif | 62 #endif |
63 | 63 |
64 enum SpellcheckAttributeState { | 64 enum SpellcheckAttributeState { |
65 SpellcheckAttributeTrue, | 65 SpellcheckAttributeTrue, |
66 SpellcheckAttributeFalse, | 66 SpellcheckAttributeFalse, |
67 SpellcheckAttributeDefault | 67 SpellcheckAttributeDefault |
68 }; | 68 }; |
69 | 69 |
70 enum class SelectionRevealMode { | 70 enum class SelectionRevealMode { |
71 Reveal, | 71 Reveal, |
72 RevealUpToMainFrame, // Scroll overflow and iframes, but not the main frame. | 72 RevealUpToMainFrame, // Scroll overflow and iframes, but not the main frame. |
73 DoNotReveal | 73 DoNotReveal |
74 }; | 74 }; |
75 | 75 |
76 class Element : public ContainerNode { | 76 class Element : public ContainerNode { |
77 WTF_MAKE_ISO_ALLOCATED(Element); | 77 WTF_MAKE_ISO_ALLOCATED(Element); |
78 public: | 78 public: |
79 static Ref<Element> create(const QualifiedName&, Document&); | 79 static Ref<Element> create(const QualifiedName&, Document&); |
80 virtual ~Element(); | 80 virtual ~Element(); |
81 | 81 |
82 WEBCORE_EXPORT bool hasAttribute(const QualifiedName&) const; | 82 WEBCORE_EXPORT bool hasAttribute(const QualifiedName&) const; |
83 WEBCORE_EXPORT const AtomicString& getAttribute(const QualifiedName&) const; | 83 WEBCORE_EXPORT const AtomicString& getAttribute(const QualifiedName&) const; |
| 84 template<typename... QualifiedNames> |
| 85 const AtomicString& getAttribute(const QualifiedName&, const QualifiedNames&
...) const; |
84 WEBCORE_EXPORT void setAttribute(const QualifiedName&, const AtomicString& v
alue); | 86 WEBCORE_EXPORT void setAttribute(const QualifiedName&, const AtomicString& v
alue); |
85 WEBCORE_EXPORT void setAttributeWithoutSynchronization(const QualifiedName&,
const AtomicString& value); | 87 WEBCORE_EXPORT void setAttributeWithoutSynchronization(const QualifiedName&,
const AtomicString& value); |
86 void setSynchronizedLazyAttribute(const QualifiedName&, const AtomicString&
value); | 88 void setSynchronizedLazyAttribute(const QualifiedName&, const AtomicString&
value); |
87 bool removeAttribute(const QualifiedName&); | 89 bool removeAttribute(const QualifiedName&); |
88 Vector<String> getAttributeNames() const; | 90 Vector<String> getAttributeNames() const; |
89 | 91 |
90 // Typed getters and setters for language bindings. | 92 // Typed getters and setters for language bindings. |
91 WEBCORE_EXPORT int getIntegralAttribute(const QualifiedName& attributeName)
const; | 93 WEBCORE_EXPORT int getIntegralAttribute(const QualifiedName& attributeName)
const; |
92 WEBCORE_EXPORT void setIntegralAttribute(const QualifiedName& attributeName,
int value); | 94 WEBCORE_EXPORT void setIntegralAttribute(const QualifiedName& attributeName,
int value); |
93 WEBCORE_EXPORT unsigned getUnsignedIntegralAttribute(const QualifiedName& at
tributeName) const; | 95 WEBCORE_EXPORT unsigned getUnsignedIntegralAttribute(const QualifiedName& at
tributeName) const; |
94 WEBCORE_EXPORT void setUnsignedIntegralAttribute(const QualifiedName& attrib
uteName, unsigned value); | 96 WEBCORE_EXPORT void setUnsignedIntegralAttribute(const QualifiedName& attrib
uteName, unsigned value); |
95 | 97 |
96 // Call this to get the value of an attribute that is known not to be the st
yle | 98 // Call this to get the value of an attribute that is known not to be the st
yle |
97 // attribute or one of the SVG animatable attributes. | 99 // attribute or one of the SVG animatable attributes. |
98 bool hasAttributeWithoutSynchronization(const QualifiedName&) const; | 100 bool hasAttributeWithoutSynchronization(const QualifiedName&) const; |
99 const AtomicString& attributeWithoutSynchronization(const QualifiedName&) co
nst; | 101 const AtomicString& attributeWithoutSynchronization(const QualifiedName&) co
nst; |
100 #ifndef NDEBUG | 102 #ifndef NDEBUG |
101 WEBCORE_EXPORT bool fastAttributeLookupAllowed(const QualifiedName&) const; | 103 WEBCORE_EXPORT bool fastAttributeLookupAllowed(const QualifiedName&) const; |
102 #endif | 104 #endif |
103 | 105 |
104 #ifdef DUMP_NODE_STATISTICS | 106 #ifdef DUMP_NODE_STATISTICS |
105 bool hasNamedNodeMap() const; | 107 bool hasNamedNodeMap() const; |
106 #endif | 108 #endif |
107 WEBCORE_EXPORT bool hasAttributes() const; | 109 WEBCORE_EXPORT bool hasAttributes() const; |
108 // This variant will not update the potentially invalid attributes. To be us
ed when not interested | 110 // This variant will not update the potentially invalid attributes. To be us
ed when not interested |
109 // in style attribute or one of the SVG animation attributes. | 111 // in style attribute or one of the SVG animation attributes. |
110 bool hasAttributesWithoutUpdate() const; | 112 bool hasAttributesWithoutUpdate() const; |
111 | 113 |
112 WEBCORE_EXPORT bool hasAttribute(const AtomicString& name) const; | 114 WEBCORE_EXPORT bool hasAttribute(const AtomicString& qualifiedName) const; |
113 WEBCORE_EXPORT bool hasAttributeNS(const AtomicString& namespaceURI, const A
tomicString& localName) const; | 115 WEBCORE_EXPORT bool hasAttributeNS(const AtomicString& namespaceURI, const A
tomicString& localName) const; |
114 | 116 |
115 WEBCORE_EXPORT const AtomicString& getAttribute(const AtomicString& name) co
nst; | 117 WEBCORE_EXPORT const AtomicString& getAttribute(const AtomicString& qualifie
dName) const; |
116 WEBCORE_EXPORT const AtomicString& getAttributeNS(const AtomicString& namesp
aceURI, const AtomicString& localName) const; | 118 WEBCORE_EXPORT const AtomicString& getAttributeNS(const AtomicString& namesp
aceURI, const AtomicString& localName) const; |
117 | 119 |
118 WEBCORE_EXPORT ExceptionOr<void> setAttribute(const AtomicString& name, cons
t AtomicString& value); | 120 WEBCORE_EXPORT ExceptionOr<void> setAttribute(const AtomicString& qualifiedN
ame, const AtomicString& value); |
119 static ExceptionOr<QualifiedName> parseAttributeName(const AtomicString& nam
espaceURI, const AtomicString& qualifiedName); | 121 static ExceptionOr<QualifiedName> parseAttributeName(const AtomicString& nam
espaceURI, const AtomicString& qualifiedName); |
120 WEBCORE_EXPORT ExceptionOr<void> setAttributeNS(const AtomicString& namespac
eURI, const AtomicString& qualifiedName, const AtomicString& value); | 122 WEBCORE_EXPORT ExceptionOr<void> setAttributeNS(const AtomicString& namespac
eURI, const AtomicString& qualifiedName, const AtomicString& value); |
121 | 123 |
122 ExceptionOr<bool> toggleAttribute(const AtomicString& name, std::optional<bo
ol> force); | 124 ExceptionOr<bool> toggleAttribute(const AtomicString& qualifiedName, std::op
tional<bool> force); |
123 | 125 |
124 const AtomicString& getIdAttribute() const; | 126 const AtomicString& getIdAttribute() const; |
125 void setIdAttribute(const AtomicString&); | 127 void setIdAttribute(const AtomicString&); |
126 | 128 |
127 const AtomicString& getNameAttribute() const; | 129 const AtomicString& getNameAttribute() const; |
128 | 130 |
129 // Call this to get the value of the id attribute for style resolution purpo
ses. | 131 // Call this to get the value of the id attribute for style resolution purpo
ses. |
130 // The value will already be lowercased if the document is in compatibility
mode, | 132 // The value will already be lowercased if the document is in compatibility
mode, |
131 // so this function is not suitable for non-style uses. | 133 // so this function is not suitable for non-style uses. |
132 const AtomicString& idForStyleResolution() const; | 134 const AtomicString& idForStyleResolution() const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 189 |
188 // Returns the absolute bounding box translated into root view coordinates.
Result affected by top content inset. | 190 // Returns the absolute bounding box translated into root view coordinates.
Result affected by top content inset. |
189 // Does not update layout. | 191 // Does not update layout. |
190 WEBCORE_EXPORT IntRect clientRect() const; | 192 WEBCORE_EXPORT IntRect clientRect() const; |
191 // Similar (idential?) behavior to clientRect(), but updates layout. | 193 // Similar (idential?) behavior to clientRect(), but updates layout. |
192 WEBCORE_EXPORT IntRect boundsInRootViewSpace(); | 194 WEBCORE_EXPORT IntRect boundsInRootViewSpace(); |
193 | 195 |
194 // Returns the absolute bounding box translated into screen coordinates. | 196 // Returns the absolute bounding box translated into screen coordinates. |
195 WEBCORE_EXPORT IntRect screenRect() const; | 197 WEBCORE_EXPORT IntRect screenRect() const; |
196 | 198 |
197 WEBCORE_EXPORT bool removeAttribute(const AtomicString& name); | 199 WEBCORE_EXPORT bool removeAttribute(const AtomicString& qualifiedName); |
198 WEBCORE_EXPORT bool removeAttributeNS(const AtomicString& namespaceURI, cons
t AtomicString& localName); | 200 WEBCORE_EXPORT bool removeAttributeNS(const AtomicString& namespaceURI, cons
t AtomicString& localName); |
199 | 201 |
200 Ref<Attr> detachAttribute(unsigned index); | 202 Ref<Attr> detachAttribute(unsigned index); |
201 | 203 |
202 WEBCORE_EXPORT RefPtr<Attr> getAttributeNode(const AtomicString& name); | 204 WEBCORE_EXPORT RefPtr<Attr> getAttributeNode(const AtomicString& qualifiedNa
me); |
203 WEBCORE_EXPORT RefPtr<Attr> getAttributeNodeNS(const AtomicString& namespace
URI, const AtomicString& localName); | 205 WEBCORE_EXPORT RefPtr<Attr> getAttributeNodeNS(const AtomicString& namespace
URI, const AtomicString& localName); |
204 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNode(Attr&); | 206 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNode(Attr&); |
205 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNodeNS(Attr&); | 207 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNodeNS(Attr&); |
206 WEBCORE_EXPORT ExceptionOr<Ref<Attr>> removeAttributeNode(Attr&); | 208 WEBCORE_EXPORT ExceptionOr<Ref<Attr>> removeAttributeNode(Attr&); |
207 | 209 |
208 RefPtr<Attr> attrIfExists(const QualifiedName&); | 210 RefPtr<Attr> attrIfExists(const QualifiedName&); |
209 RefPtr<Attr> attrIfExists(const AtomicString& localName, bool shouldIgnoreAt
tributeCase); | 211 RefPtr<Attr> attrIfExists(const AtomicString& localName, bool shouldIgnoreAt
tributeCase); |
210 Ref<Attr> ensureAttr(const QualifiedName&); | 212 Ref<Attr> ensureAttr(const QualifiedName&); |
211 | 213 |
212 const Vector<RefPtr<Attr>>& attrNodeList(); | 214 const Vector<RefPtr<Attr>>& attrNodeList(); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 virtual void buildPendingResource() { }; | 481 virtual void buildPendingResource() { }; |
480 | 482 |
481 bool hasCSSAnimation() const; | 483 bool hasCSSAnimation() const; |
482 void setHasCSSAnimation(); | 484 void setHasCSSAnimation(); |
483 void clearHasCSSAnimation(); | 485 void clearHasCSSAnimation(); |
484 | 486 |
485 #if ENABLE(FULLSCREEN_API) | 487 #if ENABLE(FULLSCREEN_API) |
486 WEBCORE_EXPORT bool containsFullScreenElement() const; | 488 WEBCORE_EXPORT bool containsFullScreenElement() const; |
487 void setContainsFullScreenElement(bool); | 489 void setContainsFullScreenElement(bool); |
488 void setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool); | 490 void setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool); |
489 WEBCORE_EXPORT void webkitRequestFullscreen(); | 491 WEBCORE_EXPORT virtual void webkitRequestFullscreen(); |
490 #endif | 492 #endif |
491 | 493 |
492 #if ENABLE(POINTER_LOCK) | 494 #if ENABLE(POINTER_LOCK) |
493 WEBCORE_EXPORT void requestPointerLock(); | 495 WEBCORE_EXPORT void requestPointerLock(); |
494 #endif | 496 #endif |
495 | 497 |
496 bool isSpellCheckingEnabled() const; | 498 bool isSpellCheckingEnabled() const; |
497 | 499 |
498 bool hasID() const; | 500 bool hasID() const; |
499 bool hasClass() const; | 501 bool hasClass() const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 bool hasDisplayContents() const; | 573 bool hasDisplayContents() const; |
572 void storeDisplayContentsStyle(std::unique_ptr<RenderStyle>); | 574 void storeDisplayContentsStyle(std::unique_ptr<RenderStyle>); |
573 | 575 |
574 using ContainerNode::setAttributeEventListener; | 576 using ContainerNode::setAttributeEventListener; |
575 void setAttributeEventListener(const AtomicString& eventType, const Qualifie
dName& attributeName, const AtomicString& value); | 577 void setAttributeEventListener(const AtomicString& eventType, const Qualifie
dName& attributeName, const AtomicString& value); |
576 | 578 |
577 #if ENABLE(INTERSECTION_OBSERVER) | 579 #if ENABLE(INTERSECTION_OBSERVER) |
578 void startObservingIntersections(IntersectionObserver&); | 580 void startObservingIntersections(IntersectionObserver&); |
579 void endObservingIntersections(IntersectionObserver&); | 581 void endObservingIntersections(IntersectionObserver&); |
580 | 582 |
581 Vector<IntersectionObserverRegistration>* intersectionObserverRegistrations(
); | 583 IntersectionObserverData& ensureIntersectionObserverData(); |
| 584 IntersectionObserverData* intersectionObserverData(); |
582 #endif | 585 #endif |
583 | 586 |
584 Element* findAnchorElementForLink(String& outAnchorName); | 587 Element* findAnchorElementForLink(String& outAnchorName); |
585 | 588 |
586 ExceptionOr<Ref<WebAnimation>> animate(JSC::ExecState&, JSC::Strong<JSC::JSO
bject>&&, std::optional<Variant<double, KeyframeAnimationOptions>>&&); | 589 ExceptionOr<Ref<WebAnimation>> animate(JSC::ExecState&, JSC::Strong<JSC::JSO
bject>&&, std::optional<Variant<double, KeyframeAnimationOptions>>&&); |
587 Vector<RefPtr<WebAnimation>> getAnimations(); | 590 Vector<RefPtr<WebAnimation>> getAnimations(); |
588 | 591 |
589 protected: | 592 protected: |
590 Element(const QualifiedName&, Document&, ConstructionType); | 593 Element(const QualifiedName&, Document&, ConstructionType); |
591 | 594 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 833 |
831 inline void Element::setHasFocusWithin(bool flag) | 834 inline void Element::setHasFocusWithin(bool flag) |
832 { | 835 { |
833 if (hasFocusWithin() == flag) | 836 if (hasFocusWithin() == flag) |
834 return; | 837 return; |
835 setFlag(flag, HasFocusWithin); | 838 setFlag(flag, HasFocusWithin); |
836 if (styleAffectedByFocusWithin()) | 839 if (styleAffectedByFocusWithin()) |
837 invalidateStyleForSubtree(); | 840 invalidateStyleForSubtree(); |
838 } | 841 } |
839 | 842 |
| 843 template<typename... QualifiedNames> |
| 844 inline const AtomicString& Element::getAttribute(const QualifiedName& name, cons
t QualifiedNames&... names) const |
| 845 { |
| 846 const AtomicString& value = getAttribute(name); |
| 847 if (!value.isEmpty()) |
| 848 return value; |
| 849 return getAttribute(names...); |
| 850 } |
| 851 |
840 } // namespace WebCore | 852 } // namespace WebCore |
841 | 853 |
842 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Element) | 854 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Element) |
843 static bool isType(const WebCore::Node& node) { return node.isElementNode();
} | 855 static bool isType(const WebCore::Node& node) { return node.isElementNode();
} |
844 static bool isType(const WebCore::EventTarget& target) { return is<WebCore::
Node>(target) && isType(downcast<WebCore::Node>(target)); } | 856 static bool isType(const WebCore::EventTarget& target) { return is<WebCore::
Node>(target) && isType(downcast<WebCore::Node>(target)); } |
845 SPECIALIZE_TYPE_TRAITS_END() | 857 SPECIALIZE_TYPE_TRAITS_END() |
LEFT | RIGHT |