Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: sky/engine/core/dom/ContainerNode.h

Issue 943433002: querySelectorAll should return List<Element> (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Named return value optimization Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/engine/core/dom/ContainerNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 #include "sky/engine/bindings/exception_state_placeholder.h" 27 #include "sky/engine/bindings/exception_state_placeholder.h"
28 #include "sky/engine/core/dom/Node.h" 28 #include "sky/engine/core/dom/Node.h"
29 #include "sky/engine/wtf/OwnPtr.h" 29 #include "sky/engine/wtf/OwnPtr.h"
30 #include "sky/engine/wtf/Vector.h" 30 #include "sky/engine/wtf/Vector.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class ExceptionState; 34 class ExceptionState;
35 class FloatPoint; 35 class FloatPoint;
36 template <typename NodeType> class StaticNodeTypeList; 36 template <typename NodeType> class StaticNodeTypeList;
37 typedef StaticNodeTypeList<Element> StaticElementList;
38 37
39 // This constant controls how much buffer is initially allocated 38 // This constant controls how much buffer is initially allocated
40 // for a Node Vector that is used to store child Nodes of a given Node. 39 // for a Node Vector that is used to store child Nodes of a given Node.
41 // FIXME: Optimize the value. 40 // FIXME: Optimize the value.
42 const int initialNodeVectorSize = 11; 41 const int initialNodeVectorSize = 11;
43 typedef Vector<RefPtr<Node>, initialNodeVectorSize> NodeVector; 42 typedef Vector<RefPtr<Node>, initialNodeVectorSize> NodeVector;
44 43
45 class ContainerNode : public Node { 44 class ContainerNode : public Node {
46 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
47 public: 46 public:
(...skipping 17 matching lines...) Expand all
65 void removeChildren(); 64 void removeChildren();
66 PassRefPtr<Node> setChild(PassRefPtr<Node> node, ExceptionState&); 65 PassRefPtr<Node> setChild(PassRefPtr<Node> node, ExceptionState&);
67 void setChildren(Vector<RefPtr<Node>>& nodes, ExceptionState&); 66 void setChildren(Vector<RefPtr<Node>>& nodes, ExceptionState&);
68 67
69 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); } 68 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); }
70 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); } 69 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); }
71 70
72 unsigned countChildren() const; 71 unsigned countChildren() const;
73 72
74 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt ate&); 73 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt ate&);
75 PassRefPtr<StaticElementList> querySelectorAll(const AtomicString& selectors , ExceptionState&); 74 Vector<RefPtr<Element>> querySelectorAll(const AtomicString& selectors, Exce ptionState&);
76 75
77 PassRefPtr<Node> insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exc eptionState& = ASSERT_NO_EXCEPTION); 76 PassRefPtr<Node> insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exc eptionState& = ASSERT_NO_EXCEPTION);
78 PassRefPtr<Node> replaceChild(PassRefPtr<Node> newChild, PassRefPtr<Node> ol dChild, ExceptionState& = ASSERT_NO_EXCEPTION); 77 PassRefPtr<Node> replaceChild(PassRefPtr<Node> newChild, PassRefPtr<Node> ol dChild, ExceptionState& = ASSERT_NO_EXCEPTION);
79 PassRefPtr<Node> removeChild(PassRefPtr<Node> child, ExceptionState& = ASSER T_NO_EXCEPTION); 78 PassRefPtr<Node> removeChild(PassRefPtr<Node> child, ExceptionState& = ASSER T_NO_EXCEPTION);
80 PassRefPtr<Node> appendChild(PassRefPtr<Node> newChild, ExceptionState& = AS SERT_NO_EXCEPTION); 79 PassRefPtr<Node> appendChild(PassRefPtr<Node> newChild, ExceptionState& = AS SERT_NO_EXCEPTION);
81 80
82 Element* getElementById(const AtomicString& id) const; 81 Element* getElementById(const AtomicString& id) const;
83 82
84 // These methods are only used during parsing. 83 // These methods are only used during parsing.
85 // They don't send DOM mutation events or handle reparenting. 84 // They don't send DOM mutation events or handle reparenting.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 inline void appendChildNodes(ContainerNode& node, NodeVector& nodes) 233 inline void appendChildNodes(ContainerNode& node, NodeVector& nodes)
235 { 234 {
236 ASSERT(!nodes.size()); 235 ASSERT(!nodes.size());
237 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 236 for (Node* child = node.firstChild(); child; child = child->nextSibling())
238 nodes.append(child); 237 nodes.append(child);
239 } 238 }
240 239
241 } // namespace blink 240 } // namespace blink
242 241
243 #endif // SKY_ENGINE_CORE_DOM_CONTAINERNODE_H_ 242 #endif // SKY_ENGINE_CORE_DOM_CONTAINERNODE_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698