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

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

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 | « sky/engine/core/dom/ContainerNode.h ('k') | sky/engine/core/dom/ParentNode.idl » ('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, 2008, 2009, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 exceptionState.ThrowDOMException(SyntaxError, "The provided selector is empty."); 935 exceptionState.ThrowDOMException(SyntaxError, "The provided selector is empty.");
936 return nullptr; 936 return nullptr;
937 } 937 }
938 938
939 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState); 939 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState);
940 if (!selectorQuery) 940 if (!selectorQuery)
941 return nullptr; 941 return nullptr;
942 return selectorQuery->queryFirst(*this); 942 return selectorQuery->queryFirst(*this);
943 } 943 }
944 944
945 PassRefPtr<StaticElementList> ContainerNode::querySelectorAll(const AtomicString & selectors, ExceptionState& exceptionState) 945 Vector<RefPtr<Element>> ContainerNode::querySelectorAll(const AtomicString& sele ctors, ExceptionState& exceptionState)
946 { 946 {
947 Vector<RefPtr<Element>> result;
947 if (selectors.isEmpty()) { 948 if (selectors.isEmpty()) {
948 exceptionState.ThrowDOMException(SyntaxError, "The provided selector is empty."); 949 exceptionState.ThrowDOMException(SyntaxError, "The provided selector is empty.");
949 return nullptr; 950 return result;
950 } 951 }
951 952
952 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState); 953 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState);
953 if (!selectorQuery) 954 if (!selectorQuery)
954 return nullptr; 955 return result;
955 956
956 return selectorQuery->queryAll(*this); 957 result = selectorQuery->queryAll(*this);
958 return result;
957 } 959 }
958 960
959 void ContainerNode::updateTreeAfterInsertion(Node& child) 961 void ContainerNode::updateTreeAfterInsertion(Node& child)
960 { 962 {
961 ASSERT(refCount()); 963 ASSERT(refCount());
962 ASSERT(child.refCount()); 964 ASSERT(child.refCount());
963 965
964 ChildListMutationScope(*this).childAdded(child); 966 ChildListMutationScope(*this).childAdded(child);
965 967
966 notifyNodeInserted(child); 968 notifyNodeInserted(child);
(...skipping 29 matching lines...) Expand all
996 return true; 998 return true;
997 999
998 if (node->isElementNode() && toElement(node)->shadow()) 1000 if (node->isElementNode() && toElement(node)->shadow())
999 return true; 1001 return true;
1000 1002
1001 return false; 1003 return false;
1002 } 1004 }
1003 #endif 1005 #endif
1004 1006
1005 } // namespace blink 1007 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/ContainerNode.h ('k') | sky/engine/core/dom/ParentNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698