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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 138743008: Make sure the root node of selector queries is a ContainerNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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 | « Source/core/dom/Node.h ('k') | Source/core/dom/SelectorQuery.h » ('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, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 29 matching lines...) Expand all
40 #include "core/dom/DocumentMarkerController.h" 40 #include "core/dom/DocumentMarkerController.h"
41 #include "core/dom/DocumentType.h" 41 #include "core/dom/DocumentType.h"
42 #include "core/dom/Element.h" 42 #include "core/dom/Element.h"
43 #include "core/dom/ElementRareData.h" 43 #include "core/dom/ElementRareData.h"
44 #include "core/dom/ExceptionCode.h" 44 #include "core/dom/ExceptionCode.h"
45 #include "core/dom/LiveNodeList.h" 45 #include "core/dom/LiveNodeList.h"
46 #include "core/dom/NodeRareData.h" 46 #include "core/dom/NodeRareData.h"
47 #include "core/dom/NodeTraversal.h" 47 #include "core/dom/NodeTraversal.h"
48 #include "core/dom/ProcessingInstruction.h" 48 #include "core/dom/ProcessingInstruction.h"
49 #include "core/dom/Range.h" 49 #include "core/dom/Range.h"
50 #include "core/dom/SelectorQuery.h"
51 #include "core/dom/StaticNodeList.h" 50 #include "core/dom/StaticNodeList.h"
52 #include "core/dom/TagNodeList.h" 51 #include "core/dom/TagNodeList.h"
53 #include "core/dom/TemplateContentDocumentFragment.h" 52 #include "core/dom/TemplateContentDocumentFragment.h"
54 #include "core/dom/Text.h" 53 #include "core/dom/Text.h"
55 #include "core/dom/TreeScopeAdopter.h" 54 #include "core/dom/TreeScopeAdopter.h"
56 #include "core/dom/UserActionElementSet.h" 55 #include "core/dom/UserActionElementSet.h"
57 #include "core/dom/WheelController.h" 56 #include "core/dom/WheelController.h"
58 #include "core/dom/shadow/ElementShadow.h" 57 #include "core/dom/shadow/ElementShadow.h"
59 #include "core/dom/shadow/InsertionPoint.h" 58 #include "core/dom/shadow/InsertionPoint.h"
60 #include "core/dom/shadow/ShadowRoot.h" 59 #include "core/dom/shadow/ShadowRoot.h"
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 return result; 1249 return result;
1251 } 1250 }
1252 1251
1253 bool Node::inSameContainingBlockFlowElement(Node *n) 1252 bool Node::inSameContainingBlockFlowElement(Node *n)
1254 { 1253 {
1255 return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : f alse; 1254 return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : f alse;
1256 } 1255 }
1257 1256
1258 // FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node. 1257 // FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node.
1259 1258
1260 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, Exception State& exceptionState)
1261 {
1262 if (selectors.isEmpty()) {
1263 exceptionState.throwDOMException(SyntaxError, "The provided selector is empty.");
1264 return 0;
1265 }
1266
1267 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState);
1268 if (!selectorQuery)
1269 return 0;
1270 return selectorQuery->queryFirst(*this);
1271 }
1272
1273 PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, Excep tionState& exceptionState)
1274 {
1275 if (selectors.isEmpty()) {
1276 exceptionState.throwDOMException(SyntaxError, "The provided selector is empty.");
1277 return 0;
1278 }
1279
1280 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState);
1281 if (!selectorQuery)
1282 return 0;
1283 return selectorQuery->queryAll(*this);
1284 }
1285
1286 Document* Node::ownerDocument() const 1259 Document* Node::ownerDocument() const
1287 { 1260 {
1288 Document* doc = &document(); 1261 Document* doc = &document();
1289 return doc == this ? 0 : doc; 1262 return doc == this ? 0 : doc;
1290 } 1263 }
1291 1264
1292 KURL Node::baseURI() const 1265 KURL Node::baseURI() const
1293 { 1266 {
1294 return parentNode() ? parentNode()->baseURI() : KURL(); 1267 return parentNode() ? parentNode()->baseURI() : KURL();
1295 } 1268 }
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 node->showTreeForThis(); 2561 node->showTreeForThis();
2589 } 2562 }
2590 2563
2591 void showNodePath(const WebCore::Node* node) 2564 void showNodePath(const WebCore::Node* node)
2592 { 2565 {
2593 if (node) 2566 if (node)
2594 node->showNodePathForThis(); 2567 node->showNodePathForThis();
2595 } 2568 }
2596 2569
2597 #endif 2570 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/SelectorQuery.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698