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, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r
ights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }; | 63 }; |
64 | 64 |
65 // This constant controls how much buffer is initially allocated | 65 // This constant controls how much buffer is initially allocated |
66 // for a Node Vector that is used to store child Nodes of a given Node. | 66 // for a Node Vector that is used to store child Nodes of a given Node. |
67 // FIXME: Optimize the value. | 67 // FIXME: Optimize the value. |
68 const int initialNodeVectorSize = 11; | 68 const int initialNodeVectorSize = 11; |
69 using NodeVector = WillBeHeapVector<RefPtrWillBeMember<Node>, initialNodeVectorS
ize>; | 69 using NodeVector = WillBeHeapVector<RefPtrWillBeMember<Node>, initialNodeVectorS
ize>; |
70 | 70 |
71 class CORE_EXPORT ContainerNode : public Node { | 71 class CORE_EXPORT ContainerNode : public Node { |
72 public: | 72 public: |
73 virtual ~ContainerNode(); | 73 ~ContainerNode() override; |
74 | 74 |
75 Node* firstChild() const { return m_firstChild; } | 75 Node* firstChild() const { return m_firstChild; } |
76 Node* lastChild() const { return m_lastChild; } | 76 Node* lastChild() const { return m_lastChild; } |
77 bool hasChildren() const { return m_firstChild; } | 77 bool hasChildren() const { return m_firstChild; } |
78 | 78 |
79 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling
(); } | 79 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling
(); } |
80 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN
ode(); } | 80 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN
ode(); } |
81 bool hasChildCount(unsigned) const; | 81 bool hasChildCount(unsigned) const; |
82 | 82 |
83 PassRefPtrWillBeRawPtr<HTMLCollection> children(); | 83 PassRefPtrWillBeRawPtr<HTMLCollection> children(); |
(...skipping 19 matching lines...) Expand all Loading... |
103 // They don't send DOM mutation events or accept DocumentFragments. | 103 // They don't send DOM mutation events or accept DocumentFragments. |
104 void parserAppendChild(PassRefPtrWillBeRawPtr<Node>); | 104 void parserAppendChild(PassRefPtrWillBeRawPtr<Node>); |
105 void parserRemoveChild(Node&); | 105 void parserRemoveChild(Node&); |
106 void parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node& refChil
d); | 106 void parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node& refChil
d); |
107 void parserTakeAllChildrenFrom(ContainerNode&); | 107 void parserTakeAllChildrenFrom(ContainerNode&); |
108 | 108 |
109 void removeChildren(SubtreeModificationAction = DispatchSubtreeModifiedEvent
); | 109 void removeChildren(SubtreeModificationAction = DispatchSubtreeModifiedEvent
); |
110 | 110 |
111 void cloneChildNodes(ContainerNode* clone); | 111 void cloneChildNodes(ContainerNode* clone); |
112 | 112 |
113 virtual void attach(const AttachContext& = AttachContext()) override; | 113 void attach(const AttachContext& = AttachContext()) override; |
114 virtual void detach(const AttachContext& = AttachContext()) override; | 114 void detach(const AttachContext& = AttachContext()) override; |
115 virtual LayoutRect boundingBox() const override final; | 115 LayoutRect boundingBox() const final; |
116 virtual void setFocus(bool) override; | 116 void setFocus(bool) override; |
117 void focusStateChanged(); | 117 void focusStateChanged(); |
118 virtual void setActive(bool = true) override; | 118 void setActive(bool = true) override; |
119 virtual void setHovered(bool = true) override; | 119 void setHovered(bool = true) override; |
120 | 120 |
121 bool childrenOrSiblingsAffectedByFocus() const { return hasRestyleFlag(Child
renOrSiblingsAffectedByFocus); } | 121 bool childrenOrSiblingsAffectedByFocus() const { return hasRestyleFlag(Child
renOrSiblingsAffectedByFocus); } |
122 void setChildrenOrSiblingsAffectedByFocus() { setRestyleFlag(ChildrenOrSibli
ngsAffectedByFocus); } | 122 void setChildrenOrSiblingsAffectedByFocus() { setRestyleFlag(ChildrenOrSibli
ngsAffectedByFocus); } |
123 | 123 |
124 bool childrenOrSiblingsAffectedByHover() const { return hasRestyleFlag(Child
renOrSiblingsAffectedByHover); } | 124 bool childrenOrSiblingsAffectedByHover() const { return hasRestyleFlag(Child
renOrSiblingsAffectedByHover); } |
125 void setChildrenOrSiblingsAffectedByHover() { setRestyleFlag(ChildrenOrSibli
ngsAffectedByHover); } | 125 void setChildrenOrSiblingsAffectedByHover() { setRestyleFlag(ChildrenOrSibli
ngsAffectedByHover); } |
126 | 126 |
127 bool childrenOrSiblingsAffectedByActive() const { return hasRestyleFlag(Chil
drenOrSiblingsAffectedByActive); } | 127 bool childrenOrSiblingsAffectedByActive() const { return hasRestyleFlag(Chil
drenOrSiblingsAffectedByActive); } |
128 void setChildrenOrSiblingsAffectedByActive() { setRestyleFlag(ChildrenOrSibl
ingsAffectedByActive); } | 128 void setChildrenOrSiblingsAffectedByActive() { setRestyleFlag(ChildrenOrSibl
ingsAffectedByActive); } |
129 | 129 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) | 367 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) |
368 { | 368 { |
369 ASSERT(!nodes.size()); | 369 ASSERT(!nodes.size()); |
370 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 370 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
371 nodes.append(child); | 371 nodes.append(child); |
372 } | 372 } |
373 | 373 |
374 } // namespace blink | 374 } // namespace blink |
375 | 375 |
376 #endif // ContainerNode_h | 376 #endif // ContainerNode_h |
OLD | NEW |