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

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

Issue 2170793002: Add Node.getRootNode(options) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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 | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Node.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, 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 26 matching lines...) Expand all
37 #include "core/dom/ChildListMutationScope.h" 37 #include "core/dom/ChildListMutationScope.h"
38 #include "core/dom/ChildNodeList.h" 38 #include "core/dom/ChildNodeList.h"
39 #include "core/dom/DOMNodeIds.h" 39 #include "core/dom/DOMNodeIds.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/dom/DocumentFragment.h" 41 #include "core/dom/DocumentFragment.h"
42 #include "core/dom/DocumentType.h" 42 #include "core/dom/DocumentType.h"
43 #include "core/dom/Element.h" 43 #include "core/dom/Element.h"
44 #include "core/dom/ElementRareData.h" 44 #include "core/dom/ElementRareData.h"
45 #include "core/dom/ElementTraversal.h" 45 #include "core/dom/ElementTraversal.h"
46 #include "core/dom/ExceptionCode.h" 46 #include "core/dom/ExceptionCode.h"
47 #include "core/dom/GetRootNodeOptions.h"
47 #include "core/dom/LayoutTreeBuilderTraversal.h" 48 #include "core/dom/LayoutTreeBuilderTraversal.h"
48 #include "core/dom/NodeRareData.h" 49 #include "core/dom/NodeRareData.h"
49 #include "core/dom/NodeTraversal.h" 50 #include "core/dom/NodeTraversal.h"
50 #include "core/dom/ProcessingInstruction.h" 51 #include "core/dom/ProcessingInstruction.h"
51 #include "core/dom/Range.h" 52 #include "core/dom/Range.h"
52 #include "core/dom/StaticNodeList.h" 53 #include "core/dom/StaticNodeList.h"
53 #include "core/dom/StyleEngine.h" 54 #include "core/dom/StyleEngine.h"
54 #include "core/dom/TemplateContentDocumentFragment.h" 55 #include "core/dom/TemplateContentDocumentFragment.h"
55 #include "core/dom/Text.h" 56 #include "core/dom/Text.h"
56 #include "core/dom/TreeScopeAdopter.h" 57 #include "core/dom/TreeScopeAdopter.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 Node& Node::treeRoot() const 375 Node& Node::treeRoot() const
375 { 376 {
376 if (isInTreeScope()) 377 if (isInTreeScope())
377 return containingTreeScope().rootNode(); 378 return containingTreeScope().rootNode();
378 const Node* node = this; 379 const Node* node = this;
379 while (node->parentNode()) 380 while (node->parentNode())
380 node = node->parentNode(); 381 node = node->parentNode();
381 return const_cast<Node&>(*node); 382 return const_cast<Node&>(*node);
382 } 383 }
383 384
385 Node* Node::getRootNode(const GetRootNodeOptions& options) const
386 {
387 return (options.hasComposed() && options.composed()) ? &shadowIncludingRoot( ) : &treeRoot();
388 }
389
384 Node* Node::insertBefore(Node* newChild, Node* refChild, ExceptionState& excepti onState) 390 Node* Node::insertBefore(Node* newChild, Node* refChild, ExceptionState& excepti onState)
385 { 391 {
386 if (isContainerNode()) 392 if (isContainerNode())
387 return toContainerNode(this)->insertBefore(newChild, refChild, exception State); 393 return toContainerNode(this)->insertBefore(newChild, refChild, exception State);
388 394
389 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method."); 395 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method.");
390 return nullptr; 396 return nullptr;
391 } 397 }
392 398
393 Node* Node::replaceChild(Node* newChild, Node* oldChild, ExceptionState& excepti onState) 399 Node* Node::replaceChild(Node* newChild, Node* oldChild, ExceptionState& excepti onState)
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 2544
2539 void showNodePath(const blink::Node* node) 2545 void showNodePath(const blink::Node* node)
2540 { 2546 {
2541 if (node) 2547 if (node)
2542 node->showNodePathForThis(); 2548 node->showNodePathForThis();
2543 else 2549 else
2544 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2550 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2545 } 2551 }
2546 2552
2547 #endif 2553 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Node.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698