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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved. |
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 197 |
198 ~Node() override; | 198 ~Node() override; |
199 | 199 |
200 // DOM methods & attributes for Node | 200 // DOM methods & attributes for Node |
201 | 201 |
202 bool hasTagName(const HTMLQualifiedName&) const; | 202 bool hasTagName(const HTMLQualifiedName&) const; |
203 bool hasTagName(const SVGQualifiedName&) const; | 203 bool hasTagName(const SVGQualifiedName&) const; |
204 virtual String nodeName() const = 0; | 204 virtual String nodeName() const = 0; |
205 virtual String nodeValue() const; | 205 virtual String nodeValue() const; |
206 virtual void setNodeValue(const String&); | 206 virtual void setNodeValue(const String&); |
207 virtual NodeType nodeType() const = 0; | 207 virtual NodeType getNodeType() const = 0; |
pdr.
2016/02/25 01:11:29
This one is tough because it mirrors the JS api (N
| |
208 ContainerNode* parentNode() const; | 208 ContainerNode* parentNode() const; |
209 Element* parentElement() const; | 209 Element* parentElement() const; |
210 ContainerNode* parentElementOrShadowRoot() const; | 210 ContainerNode* parentElementOrShadowRoot() const; |
211 ContainerNode* parentElementOrDocumentFragment() const; | 211 ContainerNode* parentElementOrDocumentFragment() const; |
212 Node* previousSibling() const { return m_previous; } | 212 Node* previousSibling() const { return m_previous; } |
213 Node* nextSibling() const { return m_next; } | 213 Node* nextSibling() const { return m_next; } |
214 PassRefPtrWillBeRawPtr<NodeList> childNodes(); | 214 PassRefPtrWillBeRawPtr<NodeList> childNodes(); |
215 Node* firstChild() const; | 215 Node* firstChild() const; |
216 Node* lastChild() const; | 216 Node* lastChild() const; |
217 Node& treeRoot() const; | 217 Node& treeRoot() const; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 | 355 |
356 bool active() const { return isUserActionElement() && isUserActionElementAct ive(); } | 356 bool active() const { return isUserActionElement() && isUserActionElementAct ive(); } |
357 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); } | 357 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); } |
358 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); } | 358 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); } |
359 // Note: As a shadow host whose root with delegatesFocus=false may become fo cused state when | 359 // Note: As a shadow host whose root with delegatesFocus=false may become fo cused state when |
360 // an inner element gets focused, in that case more than one elements in a d ocument can return | 360 // an inner element gets focused, in that case more than one elements in a d ocument can return |
361 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum ent::focusedElement() | 361 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum ent::focusedElement() |
362 // to check which element is exactly focused. | 362 // to check which element is exactly focused. |
363 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); } | 363 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); } |
364 | 364 |
365 bool needsAttach() const { return styleChangeType() == NeedsReattachStyleCha nge; } | 365 bool needsAttach() const { return getStyleChangeType() == NeedsReattachStyle Change; } |
366 bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; } | 366 bool needsStyleRecalc() const { return getStyleChangeType() != NoStyleChange ; } |
367 StyleChangeType styleChangeType() const { return static_cast<StyleChangeType >(m_nodeFlags & StyleChangeMask); } | 367 StyleChangeType getStyleChangeType() const { return static_cast<StyleChangeT ype>(m_nodeFlags & StyleChangeMask); } |
368 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); } | 368 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); } |
369 bool isLink() const { return getFlag(IsLinkFlag); } | 369 bool isLink() const { return getFlag(IsLinkFlag); } |
370 bool isEditingText() const { ASSERT(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); } | 370 bool isEditingText() const { ASSERT(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); } |
371 | 371 |
372 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); } | 372 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); } |
373 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } | 373 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } |
374 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } | 374 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } |
375 | 375 |
376 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& ); | 376 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& ); |
377 void clearNeedsStyleRecalc(); | 377 void clearNeedsStyleRecalc(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } | 485 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } |
486 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } | 486 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } |
487 | 487 |
488 ElementShadow* parentElementShadow() const; | 488 ElementShadow* parentElementShadow() const; |
489 bool isInV1ShadowTree() const; | 489 bool isInV1ShadowTree() const; |
490 bool isInV0ShadowTree() const; | 490 bool isInV0ShadowTree() const; |
491 bool isChildOfV1ShadowHost() const; | 491 bool isChildOfV1ShadowHost() const; |
492 bool isChildOfV0ShadowHost() const; | 492 bool isChildOfV0ShadowHost() const; |
493 bool isSlotAssignable() const { return isTextNode() || isElementNode(); } | 493 bool isSlotAssignable() const { return isTextNode() || isElementNode(); } |
494 | 494 |
495 bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; } | 495 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; } |
496 virtual bool childTypeAllowed(NodeType) const { return false; } | 496 virtual bool childTypeAllowed(NodeType) const { return false; } |
497 unsigned countChildren() const; | 497 unsigned countChildren() const; |
498 | 498 |
499 bool isDescendantOf(const Node*) const; | 499 bool isDescendantOf(const Node*) const; |
500 bool contains(const Node*) const; | 500 bool contains(const Node*) const; |
501 bool containsIncludingShadowDOM(const Node*) const; | 501 bool containsIncludingShadowDOM(const Node*) const; |
502 bool containsIncludingHostElements(const Node&) const; | 502 bool containsIncludingHostElements(const Node&) const; |
503 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st; | 503 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st; |
504 | 504 |
505 // Used to determine whether range offsets use characters or node indices. | 505 // Used to determine whether range offsets use characters or node indices. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
858 return m_parentOrShadowHostNode; | 858 return m_parentOrShadowHostNode; |
859 } | 859 } |
860 | 860 |
861 inline ContainerNode* Node::parentNode() const | 861 inline ContainerNode* Node::parentNode() const |
862 { | 862 { |
863 return isShadowRoot() ? nullptr : parentOrShadowHostNode(); | 863 return isShadowRoot() ? nullptr : parentOrShadowHostNode(); |
864 } | 864 } |
865 | 865 |
866 inline void Node::lazyReattachIfAttached() | 866 inline void Node::lazyReattachIfAttached() |
867 { | 867 { |
868 if (styleChangeType() == NeedsReattachStyleChange) | 868 if (getStyleChangeType() == NeedsReattachStyleChange) |
869 return; | 869 return; |
870 if (!inActiveDocument()) | 870 if (!inActiveDocument()) |
871 return; | 871 return; |
872 | 872 |
873 AttachContext context; | 873 AttachContext context; |
874 context.performingReattach = true; | 874 context.performingReattach = true; |
875 | 875 |
876 detach(context); | 876 detach(context); |
877 markAncestorsWithChildNeedsStyleRecalc(); | 877 markAncestorsWithChildNeedsStyleRecalc(); |
878 } | 878 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
928 } // namespace blink | 928 } // namespace blink |
929 | 929 |
930 #ifndef NDEBUG | 930 #ifndef NDEBUG |
931 // Outside the WebCore namespace for ease of invocation from gdb. | 931 // Outside the WebCore namespace for ease of invocation from gdb. |
932 void showNode(const blink::Node*); | 932 void showNode(const blink::Node*); |
933 void showTree(const blink::Node*); | 933 void showTree(const blink::Node*); |
934 void showNodePath(const blink::Node*); | 934 void showNodePath(const blink::Node*); |
935 #endif | 935 #endif |
936 | 936 |
937 #endif // Node_h | 937 #endif // Node_h |
OLD | NEW |