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

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

Issue 1068193002: Make Node::needsDistributionRecalc always check the root node of the tree of trees, instead of the … (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a test Created 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/shadow/distribution-for-detached-subtree-expected.txt ('k') | no next file » | 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 inline static ShadowRoot* oldestShadowRootFor(const Node* node) 644 inline static ShadowRoot* oldestShadowRootFor(const Node* node)
645 { 645 {
646 if (!node->isElementNode()) 646 if (!node->isElementNode())
647 return nullptr; 647 return nullptr;
648 if (ElementShadow* shadow = toElement(node)->shadow()) 648 if (ElementShadow* shadow = toElement(node)->shadow())
649 return shadow->oldestShadowRoot(); 649 return shadow->oldestShadowRoot();
650 return nullptr; 650 return nullptr;
651 } 651 }
652 #endif 652 #endif
653 653
654 inline static Node& rootInTreeOfTrees(Node& node) 654 inline static Node& rootInTreeOfTrees(const Node& node)
655 { 655 {
656 if (node.inDocument()) 656 if (node.inDocument())
657 return node.document(); 657 return node.document();
658 Node* root = &node; 658 Node* root = const_cast<Node*>(&node);
659 while (Node* host = root->shadowHost()) 659 while (Node* host = root->shadowHost())
660 root = host; 660 root = host;
661 while (Node* ancestor = root->parentNode()) 661 while (Node* ancestor = root->parentNode())
662 root = ancestor; 662 root = ancestor;
663 ASSERT(!root->shadowHost()); 663 ASSERT(!root->shadowHost());
664 return *root; 664 return *root;
665 } 665 }
666 666
667 #if ENABLE(ASSERT) 667 #if ENABLE(ASSERT)
668 bool Node::needsDistributionRecalc() const 668 bool Node::needsDistributionRecalc() const
669 { 669 {
670 // TODO(hayato): If we can prove that this->childNeedsDistributionRecalc() 670 return rootInTreeOfTrees(*this).childNeedsDistributionRecalc();
671 // is enough for either case, in a document, not in a document, remove this
672 // function after renaming Node::childNeedsDistributionRecalc() to a more
673 // appropriate name.
674 if (inDocument())
675 return document().childNeedsDistributionRecalc();
676 return childNeedsDistributionRecalc();
677 } 671 }
678 #endif 672 #endif
679 673
680 void Node::updateDistribution() 674 void Node::updateDistribution()
681 { 675 {
682 TRACE_EVENT0("blink", "Node::updateDistribution"); 676 TRACE_EVENT0("blink", "Node::updateDistribution");
683 ScriptForbiddenScope forbidScript; 677 ScriptForbiddenScope forbidScript;
684 rootInTreeOfTrees(*this).recalcDistribution(); 678 rootInTreeOfTrees(*this).recalcDistribution();
685 } 679 }
686 680
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 node->showTreeForThis(); 2500 node->showTreeForThis();
2507 } 2501 }
2508 2502
2509 void showNodePath(const blink::Node* node) 2503 void showNodePath(const blink::Node* node)
2510 { 2504 {
2511 if (node) 2505 if (node)
2512 node->showNodePathForThis(); 2506 node->showNodePathForThis();
2513 } 2507 }
2514 2508
2515 #endif 2509 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/distribution-for-detached-subtree-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698