Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 | 975 |
| 976 bool Node::contains(const Node* node) const | 976 bool Node::contains(const Node* node) const |
| 977 { | 977 { |
| 978 if (!node) | 978 if (!node) |
| 979 return false; | 979 return false; |
| 980 return this == node || node->isDescendantOf(this); | 980 return this == node || node->isDescendantOf(this); |
| 981 } | 981 } |
| 982 | 982 |
| 983 bool Node::containsIncludingShadowDOM(const Node* node) const | 983 bool Node::containsIncludingShadowDOM(const Node* node) const |
| 984 { | 984 { |
| 985 for (; node; node = node->parentOrShadowHostNode()) { | 985 if (!node) |
| 986 if (node == this) | 986 return false; |
| 987 return true; | 987 |
| 988 if (this == node) | |
| 989 return true; | |
| 990 | |
| 991 if (document() != node->document()) | |
| 992 return false; | |
| 993 | |
| 994 if (inDocument() != node->inDocument()) | |
| 995 return false; | |
| 996 | |
| 997 if (!(isContainerNode() && toContainerNode(this)->hasChildNodes() || isEleme ntNode() && toElement(this)->shadow())) | |
|
esprehn
2013/07/30 03:36:26
This is a bit hard to understand, could you propag
| |
| 998 return false; | |
| 999 | |
| 1000 for (; node; node = node->shadowHost()) { | |
|
esprehn
2013/07/30 03:36:26
Nice!
| |
| 1001 if (treeScope() == node->treeScope()) | |
| 1002 return contains(node); | |
| 988 } | 1003 } |
| 1004 | |
| 989 return false; | 1005 return false; |
| 990 } | 1006 } |
| 991 | 1007 |
| 992 bool Node::containsIncludingHostElements(const Node* node) const | 1008 bool Node::containsIncludingHostElements(const Node* node) const |
| 993 { | 1009 { |
| 994 while (node) { | 1010 while (node) { |
| 995 if (node == this) | 1011 if (node == this) |
| 996 return true; | 1012 return true; |
| 997 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n ode)->isTemplateContent()) | 1013 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n ode)->isTemplateContent()) |
| 998 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho st(); | 1014 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho st(); |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2694 node->showTreeForThis(); | 2710 node->showTreeForThis(); |
| 2695 } | 2711 } |
| 2696 | 2712 |
| 2697 void showNodePath(const WebCore::Node* node) | 2713 void showNodePath(const WebCore::Node* node) |
| 2698 { | 2714 { |
| 2699 if (node) | 2715 if (node) |
| 2700 node->showNodePathForThis(); | 2716 node->showNodePathForThis(); |
| 2701 } | 2717 } |
| 2702 | 2718 |
| 2703 #endif | 2719 #endif |
| OLD | NEW |