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

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

Issue 1868433002: Rename function names to match the DOM Standard (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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 inline static ShadowRoot* oldestShadowRootFor(const Node* node) 609 inline static ShadowRoot* oldestShadowRootFor(const Node* node)
610 { 610 {
611 if (!node->isElementNode()) 611 if (!node->isElementNode())
612 return nullptr; 612 return nullptr;
613 if (ElementShadow* shadow = toElement(node)->shadow()) 613 if (ElementShadow* shadow = toElement(node)->shadow())
614 return shadow->oldestShadowRoot(); 614 return shadow->oldestShadowRoot();
615 return nullptr; 615 return nullptr;
616 } 616 }
617 #endif 617 #endif
618 618
619 inline static Node& rootInComposedTree(const Node& node) 619 Node& Node::shadowIncludingRoot() const
620 { 620 {
621 if (node.inDocument()) 621 if (inDocument())
622 return node.document(); 622 return document();
623 Node* root = const_cast<Node*>(&node); 623 Node* root = const_cast<Node*>(this);
624 while (Node* host = root->shadowHost()) 624 while (Node* host = root->shadowHost())
625 root = host; 625 root = host;
626 while (Node* ancestor = root->parentNode()) 626 while (Node* ancestor = root->parentNode())
627 root = ancestor; 627 root = ancestor;
628 ASSERT(!root->shadowHost()); 628 ASSERT(!root->shadowHost());
629 return *root; 629 return *root;
630 } 630 }
631 631
632 #if ENABLE(ASSERT) 632 #if ENABLE(ASSERT)
633 bool Node::needsDistributionRecalc() const 633 bool Node::needsDistributionRecalc() const
634 { 634 {
635 return rootInComposedTree(*this).childNeedsDistributionRecalc(); 635 return shadowIncludingRoot().childNeedsDistributionRecalc();
636 } 636 }
637 #endif 637 #endif
638 638
639 void Node::updateDistribution() 639 void Node::updateDistribution()
640 { 640 {
641 // Extra early out to avoid spamming traces. 641 // Extra early out to avoid spamming traces.
642 if (inDocument() && !document().childNeedsDistributionRecalc()) 642 if (inDocument() && !document().childNeedsDistributionRecalc())
643 return; 643 return;
644 TRACE_EVENT0("blink", "Node::updateDistribution"); 644 TRACE_EVENT0("blink", "Node::updateDistribution");
645 ScriptForbiddenScope forbidScript; 645 ScriptForbiddenScope forbidScript;
646 Node& root = rootInComposedTree(*this); 646 Node& root = shadowIncludingRoot();
647 if (root.childNeedsDistributionRecalc()) 647 if (root.childNeedsDistributionRecalc())
648 root.recalcDistribution(); 648 root.recalcDistribution();
649 } 649 }
650 650
651 void Node::recalcDistribution() 651 void Node::recalcDistribution()
652 { 652 {
653 ASSERT(childNeedsDistributionRecalc()); 653 ASSERT(childNeedsDistributionRecalc());
654 654
655 if (isElementNode()) { 655 if (isElementNode()) {
656 if (ElementShadow* shadow = toElement(this)->shadow()) 656 if (ElementShadow* shadow = toElement(this)->shadow())
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 return false; 809 return false;
810 } 810 }
811 811
812 bool Node::contains(const Node* node) const 812 bool Node::contains(const Node* node) const
813 { 813 {
814 if (!node) 814 if (!node)
815 return false; 815 return false;
816 return this == node || node->isDescendantOf(this); 816 return this == node || node->isDescendantOf(this);
817 } 817 }
818 818
819 bool Node::containsIncludingShadowDOM(const Node* node) const 819 bool Node::isShadowIncludingInclusiveAncestorOf(const Node* node) const
820 { 820 {
821 if (!node) 821 if (!node)
822 return false; 822 return false;
823 823
824 if (this == node) 824 if (this == node)
825 return true; 825 return true;
826 826
827 if (document() != node->document()) 827 if (document() != node->document())
828 return false; 828 return false;
829 829
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 2447
2448 void showNodePath(const blink::Node* node) 2448 void showNodePath(const blink::Node* node)
2449 { 2449 {
2450 if (node) 2450 if (node)
2451 node->showNodePathForThis(); 2451 node->showNodePathForThis();
2452 else 2452 else
2453 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2453 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2454 } 2454 }
2455 2455
2456 #endif 2456 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698