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

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

Issue 2327743002: Rename Node::shadowHost() to Node::ownerShadowHost() (Closed)
Patch Set: fix Created 4 years, 3 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 return shadow->oldestShadowRoot(); 583 return shadow->oldestShadowRoot();
584 return nullptr; 584 return nullptr;
585 } 585 }
586 #endif 586 #endif
587 587
588 Node& Node::shadowIncludingRoot() const 588 Node& Node::shadowIncludingRoot() const
589 { 589 {
590 if (isConnected()) 590 if (isConnected())
591 return document(); 591 return document();
592 Node* root = const_cast<Node*>(this); 592 Node* root = const_cast<Node*>(this);
593 while (Node* host = root->shadowHost()) 593 while (Node* host = root->ownerShadowHost())
594 root = host; 594 root = host;
595 while (Node* ancestor = root->parentNode()) 595 while (Node* ancestor = root->parentNode())
596 root = ancestor; 596 root = ancestor;
597 DCHECK(!root->shadowHost()); 597 DCHECK(!root->ownerShadowHost());
598 return *root; 598 return *root;
599 } 599 }
600 600
601 bool Node::isClosedShadowHiddenFrom(const Node& other) const 601 bool Node::isClosedShadowHiddenFrom(const Node& other) const
602 { 602 {
603 if (!isInShadowTree() || treeScope() == other.treeScope()) 603 if (!isInShadowTree() || treeScope() == other.treeScope())
604 return false; 604 return false;
605 605
606 const TreeScope* scope = &treeScope(); 606 const TreeScope* scope = &treeScope();
607 for (; scope->parentTreeScope(); scope = scope->parentTreeScope()) { 607 for (; scope->parentTreeScope(); scope = scope->parentTreeScope()) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 return false; 812 return false;
813 813
814 if (isConnected() != node->isConnected()) 814 if (isConnected() != node->isConnected())
815 return false; 815 return false;
816 816
817 bool hasChildren = isContainerNode() && toContainerNode(this)->hasChildren() ; 817 bool hasChildren = isContainerNode() && toContainerNode(this)->hasChildren() ;
818 bool hasShadow = isElementNode() && toElement(this)->shadow(); 818 bool hasShadow = isElementNode() && toElement(this)->shadow();
819 if (!hasChildren && !hasShadow) 819 if (!hasChildren && !hasShadow)
820 return false; 820 return false;
821 821
822 for (; node; node = node->shadowHost()) { 822 for (; node; node = node->ownerShadowHost()) {
823 if (treeScope() == node->treeScope()) 823 if (treeScope() == node->treeScope())
824 return contains(node); 824 return contains(node);
825 } 825 }
826 826
827 return false; 827 return false;
828 } 828 }
829 829
830 bool Node::containsIncludingHostElements(const Node& node) const 830 bool Node::containsIncludingHostElements(const Node& node) const
831 { 831 {
832 const Node* current = &node; 832 const Node* current = &node;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 return parentShadow && !parentShadow->isV1(); 1026 return parentShadow && !parentShadow->isV1();
1027 } 1027 }
1028 1028
1029 ShadowRoot* Node::v1ShadowRootOfParent() const 1029 ShadowRoot* Node::v1ShadowRootOfParent() const
1030 { 1030 {
1031 if (Element* parent = parentElement()) 1031 if (Element* parent = parentElement())
1032 return parent->shadowRootIfV1(); 1032 return parent->shadowRootIfV1();
1033 return nullptr; 1033 return nullptr;
1034 } 1034 }
1035 1035
1036 Element* Node::shadowHost() const 1036 Element* Node::ownerShadowHost() const
1037 { 1037 {
1038 if (ShadowRoot* root = containingShadowRoot()) 1038 if (ShadowRoot* root = containingShadowRoot())
1039 return &root->host(); 1039 return &root->host();
1040 return nullptr; 1040 return nullptr;
1041 } 1041 }
1042 1042
1043 ShadowRoot* Node::containingShadowRoot() const 1043 ShadowRoot* Node::containingShadowRoot() const
1044 { 1044 {
1045 Node& root = treeScope().rootNode(); 1045 Node& root = treeScope().rootNode();
1046 return root.isShadowRoot() ? toShadowRoot(&root) : nullptr; 1046 return root.isShadowRoot() ? toShadowRoot(&root) : nullptr;
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 if (node) { 2411 if (node) {
2412 std::stringstream stream; 2412 std::stringstream stream;
2413 node->printNodePathTo(stream); 2413 node->printNodePathTo(stream);
2414 LOG(INFO) << stream.str(); 2414 LOG(INFO) << stream.str();
2415 } else { 2415 } else {
2416 LOG(INFO) << "Cannot showNodePath for <null>"; 2416 LOG(INFO) << "Cannot showNodePath for <null>";
2417 } 2417 }
2418 } 2418 }
2419 2419
2420 #endif 2420 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/TreeScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698