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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 return *root; | 545 return *root; |
546 } | 546 } |
547 | 547 |
548 #if DCHECK_IS_ON() | 548 #if DCHECK_IS_ON() |
549 bool Node::needsDistributionRecalc() const | 549 bool Node::needsDistributionRecalc() const |
550 { | 550 { |
551 return shadowIncludingRoot().childNeedsDistributionRecalc(); | 551 return shadowIncludingRoot().childNeedsDistributionRecalc(); |
552 } | 552 } |
553 #endif | 553 #endif |
554 | 554 |
555 void Node::updateAssignment() | |
556 { | |
557 Node& root = shadowIncludingRoot(); | |
558 root.recalcAssignment(); | |
559 } | |
560 | |
555 void Node::updateDistribution() | 561 void Node::updateDistribution() |
556 { | 562 { |
557 // Extra early out to avoid spamming traces. | 563 // Extra early out to avoid spamming traces. |
558 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( )) | 564 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( )) |
559 return; | 565 return; |
560 TRACE_EVENT0("blink", "Node::updateDistribution"); | 566 TRACE_EVENT0("blink", "Node::updateDistribution"); |
561 ScriptForbiddenScope forbidScript; | 567 ScriptForbiddenScope forbidScript; |
562 Node& root = shadowIncludingRoot(); | 568 Node& root = shadowIncludingRoot(); |
563 if (root.childNeedsDistributionRecalc()) | 569 if (root.childNeedsDistributionRecalc()) |
564 root.recalcDistribution(); | 570 root.recalcDistribution(); |
565 } | 571 } |
566 | 572 |
573 void Node::recalcAssignment() | |
hayato
2016/04/18 07:16:31
We do not want to call recalcAssignment recursivel
yuzuchan
2016/04/18 09:43:27
Thanks for the feedback! Done.
| |
574 { | |
575 if (isElementNode()) { | |
576 if (ElementShadow* shadow = toElement(this)->shadow()) { | |
577 if (shadow->isV1()) | |
578 shadow->youngestShadowRoot().assignV1(); | |
579 } | |
580 } | |
581 | |
582 for (Node* child = firstChild(); child; child = child->nextSibling()) { | |
583 child->recalcAssignment(); | |
584 } | |
585 | |
586 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) { | |
587 root->recalcAssignment(); | |
588 } | |
589 } | |
590 | |
567 void Node::recalcDistribution() | 591 void Node::recalcDistribution() |
568 { | 592 { |
569 DCHECK(childNeedsDistributionRecalc()); | 593 DCHECK(childNeedsDistributionRecalc()); |
570 | 594 |
571 if (isElementNode()) { | 595 if (isElementNode()) { |
572 if (ElementShadow* shadow = toElement(this)->shadow()) | 596 if (ElementShadow* shadow = toElement(this)->shadow()) |
573 shadow->distributeIfNeeded(); | 597 shadow->distributeIfNeeded(); |
574 } | 598 } |
575 | 599 |
576 DCHECK(ScriptForbiddenScope::isScriptForbidden()); | 600 DCHECK(ScriptForbiddenScope::isScriptForbidden()); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
940 ElementShadow* parentShadow = parentElementShadow(); | 964 ElementShadow* parentShadow = parentElementShadow(); |
941 return parentShadow && parentShadow->isV1(); | 965 return parentShadow && parentShadow->isV1(); |
942 } | 966 } |
943 | 967 |
944 bool Node::isChildOfV0ShadowHost() const | 968 bool Node::isChildOfV0ShadowHost() const |
945 { | 969 { |
946 ElementShadow* parentShadow = parentElementShadow(); | 970 ElementShadow* parentShadow = parentElementShadow(); |
947 return parentShadow && !parentShadow->isV1(); | 971 return parentShadow && !parentShadow->isV1(); |
948 } | 972 } |
949 | 973 |
974 bool Node::isChildOfSlot() const | |
975 { | |
976 return parentElement() && isHTMLSlotElement(parentElement()); | |
977 } | |
978 | |
950 Element* Node::shadowHost() const | 979 Element* Node::shadowHost() const |
951 { | 980 { |
952 if (ShadowRoot* root = containingShadowRoot()) | 981 if (ShadowRoot* root = containingShadowRoot()) |
953 return root->host(); | 982 return root->host(); |
954 return nullptr; | 983 return nullptr; |
955 } | 984 } |
956 | 985 |
957 ShadowRoot* Node::containingShadowRoot() const | 986 ShadowRoot* Node::containingShadowRoot() const |
958 { | 987 { |
959 Node& root = treeScope().rootNode(); | 988 Node& root = treeScope().rootNode(); |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2326 | 2355 |
2327 void showNodePath(const blink::Node* node) | 2356 void showNodePath(const blink::Node* node) |
2328 { | 2357 { |
2329 if (node) | 2358 if (node) |
2330 node->showNodePathForThis(); | 2359 node->showNodePathForThis(); |
2331 else | 2360 else |
2332 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2361 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2333 } | 2362 } |
2334 | 2363 |
2335 #endif | 2364 #endif |
OLD | NEW |