| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 inline static ShadowRoot* oldestShadowRootFor(const Node* node) | 605 inline static ShadowRoot* oldestShadowRootFor(const Node* node) |
| 606 { | 606 { |
| 607 if (!node->isElementNode()) | 607 if (!node->isElementNode()) |
| 608 return nullptr; | 608 return nullptr; |
| 609 if (ElementShadow* shadow = toElement(node)->shadow()) | 609 if (ElementShadow* shadow = toElement(node)->shadow()) |
| 610 return shadow->oldestShadowRoot(); | 610 return shadow->oldestShadowRoot(); |
| 611 return nullptr; | 611 return nullptr; |
| 612 } | 612 } |
| 613 #endif | 613 #endif |
| 614 | 614 |
| 615 inline static Node& rootInTreeOfTrees(const Node& node) | 615 inline static Node& rootInComposedTree(const Node& node) |
| 616 { | 616 { |
| 617 if (node.inDocument()) | 617 if (node.inDocument()) |
| 618 return node.document(); | 618 return node.document(); |
| 619 Node* root = const_cast<Node*>(&node); | 619 Node* root = const_cast<Node*>(&node); |
| 620 while (Node* host = root->shadowHost()) | 620 while (Node* host = root->shadowHost()) |
| 621 root = host; | 621 root = host; |
| 622 while (Node* ancestor = root->parentNode()) | 622 while (Node* ancestor = root->parentNode()) |
| 623 root = ancestor; | 623 root = ancestor; |
| 624 ASSERT(!root->shadowHost()); | 624 ASSERT(!root->shadowHost()); |
| 625 return *root; | 625 return *root; |
| 626 } | 626 } |
| 627 | 627 |
| 628 #if ENABLE(ASSERT) | 628 #if ENABLE(ASSERT) |
| 629 bool Node::needsDistributionRecalc() const | 629 bool Node::needsDistributionRecalc() const |
| 630 { | 630 { |
| 631 return rootInTreeOfTrees(*this).childNeedsDistributionRecalc(); | 631 return rootInComposedTree(*this).childNeedsDistributionRecalc(); |
| 632 } | 632 } |
| 633 #endif | 633 #endif |
| 634 | 634 |
| 635 void Node::updateDistribution() | 635 void Node::updateDistribution() |
| 636 { | 636 { |
| 637 // Extra early out to avoid spamming traces. | 637 // Extra early out to avoid spamming traces. |
| 638 if (inDocument() && !document().childNeedsDistributionRecalc()) | 638 if (inDocument() && !document().childNeedsDistributionRecalc()) |
| 639 return; | 639 return; |
| 640 TRACE_EVENT0("blink", "Node::updateDistribution"); | 640 TRACE_EVENT0("blink", "Node::updateDistribution"); |
| 641 ScriptForbiddenScope forbidScript; | 641 ScriptForbiddenScope forbidScript; |
| 642 Node& root = rootInTreeOfTrees(*this); | 642 Node& root = rootInComposedTree(*this); |
| 643 if (root.childNeedsDistributionRecalc()) | 643 if (root.childNeedsDistributionRecalc()) |
| 644 root.recalcDistribution(); | 644 root.recalcDistribution(); |
| 645 } | 645 } |
| 646 | 646 |
| 647 void Node::recalcDistribution() | 647 void Node::recalcDistribution() |
| 648 { | 648 { |
| 649 ASSERT(childNeedsDistributionRecalc()); | 649 ASSERT(childNeedsDistributionRecalc()); |
| 650 | 650 |
| 651 if (isElementNode()) { | 651 if (isElementNode()) { |
| 652 if (ElementShadow* shadow = toElement(this)->shadow()) | 652 if (ElementShadow* shadow = toElement(this)->shadow()) |
| (...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 | 2425 |
| 2426 void showNodePath(const blink::Node* node) | 2426 void showNodePath(const blink::Node* node) |
| 2427 { | 2427 { |
| 2428 if (node) | 2428 if (node) |
| 2429 node->showNodePathForThis(); | 2429 node->showNodePathForThis(); |
| 2430 else | 2430 else |
| 2431 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2431 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2432 } | 2432 } |
| 2433 | 2433 |
| 2434 #endif | 2434 #endif |
| OLD | NEW |