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

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

Issue 1879373002: Move Node::retarget() to TreeScope::retarget() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 return false; 836 return false;
837 837
838 for (; node; node = node->shadowHost()) { 838 for (; node; node = node->shadowHost()) {
839 if (treeScope() == node->treeScope()) 839 if (treeScope() == node->treeScope())
840 return contains(node); 840 return contains(node);
841 } 841 }
842 842
843 return false; 843 return false;
844 } 844 }
845 845
846 Node* Node::retarget(const Node& target) const
847 {
848 for (const Node* ancestor = ⌖ ancestor; ancestor = ancestor->shadowHo st()) {
849 if (treeScope() == ancestor->treeScope())
850 return const_cast<Node*>(ancestor);
851 }
852 return nullptr;
853 }
854
855 bool Node::containsIncludingHostElements(const Node& node) const 846 bool Node::containsIncludingHostElements(const Node& node) const
856 { 847 {
857 const Node* current = &node; 848 const Node* current = &node;
858 do { 849 do {
859 if (current == this) 850 if (current == this)
860 return true; 851 return true;
861 if (current->isDocumentFragment() && toDocumentFragment(current)->isTemp lateContent()) 852 if (current->isDocumentFragment() && toDocumentFragment(current)->isTemp lateContent())
862 current = static_cast<const TemplateContentDocumentFragment*>(curren t)->host(); 853 current = static_cast<const TemplateContentDocumentFragment*>(curren t)->host();
863 else 854 else
864 current = current->parentOrShadowHostNode(); 855 current = current->parentOrShadowHostNode();
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 2459
2469 void showNodePath(const blink::Node* node) 2460 void showNodePath(const blink::Node* node)
2470 { 2461 {
2471 if (node) 2462 if (node)
2472 node->showNodePathForThis(); 2463 node->showNodePathForThis();
2473 else 2464 else
2474 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2465 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2475 } 2466 }
2476 2467
2477 #endif 2468 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698