| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type; | 762 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type; |
| 763 } | 763 } |
| 764 | 764 |
| 765 void Node::MarkAncestorsWithChildNeedsStyleRecalc() { | 765 void Node::MarkAncestorsWithChildNeedsStyleRecalc() { |
| 766 for (ContainerNode* p = ParentOrShadowHostNode(); | 766 for (ContainerNode* p = ParentOrShadowHostNode(); |
| 767 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode()) | 767 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode()) |
| 768 p->SetChildNeedsStyleRecalc(); | 768 p->SetChildNeedsStyleRecalc(); |
| 769 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); | 769 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); |
| 770 } | 770 } |
| 771 | 771 |
| 772 static ContainerNode* GetReattachParent(Node& node) { |
| 773 if (node.IsPseudoElement()) |
| 774 return node.ParentOrShadowHostNode(); |
| 775 if (node.IsChildOfV1ShadowHost()) { |
| 776 if (HTMLSlotElement* slot = node.FinalDestinationSlot()) |
| 777 return slot; |
| 778 } |
| 779 if (node.IsInV0ShadowTree() || node.IsChildOfV0ShadowHost()) { |
| 780 if (ShadowWhereNodeCanBeDistributedForV0(node)) { |
| 781 if (InsertionPoint* insertion_point = |
| 782 const_cast<InsertionPoint*>(ResolveReprojection(&node))) { |
| 783 return insertion_point; |
| 784 } |
| 785 } |
| 786 } |
| 787 return node.ParentOrShadowHostNode(); |
| 788 } |
| 789 |
| 772 void Node::MarkAncestorsWithChildNeedsReattachLayoutTree() { | 790 void Node::MarkAncestorsWithChildNeedsReattachLayoutTree() { |
| 773 for (ContainerNode* p = ParentOrShadowHostNode(); | 791 for (ContainerNode* p = GetReattachParent(*this); |
| 774 p && !p->ChildNeedsReattachLayoutTree(); p = p->ParentOrShadowHostNode()) | 792 p && !p->ChildNeedsReattachLayoutTree(); p = GetReattachParent(*p)) |
| 775 p->SetChildNeedsReattachLayoutTree(); | 793 p->SetChildNeedsReattachLayoutTree(); |
| 776 } | 794 } |
| 777 | 795 |
| 778 void Node::SetNeedsReattachLayoutTree() { | 796 void Node::SetNeedsReattachLayoutTree() { |
| 779 DCHECK(GetDocument().InStyleRecalc()); | 797 DCHECK(GetDocument().InStyleRecalc()); |
| 780 DCHECK(!GetDocument().ChildNeedsDistributionRecalc()); | 798 DCHECK(!GetDocument().ChildNeedsDistributionRecalc()); |
| 781 SetFlag(kNeedsReattachLayoutTree); | 799 SetFlag(kNeedsReattachLayoutTree); |
| 782 MarkAncestorsWithChildNeedsReattachLayoutTree(); | 800 MarkAncestorsWithChildNeedsReattachLayoutTree(); |
| 783 } | 801 } |
| 784 | 802 |
| (...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2384 } | 2402 } |
| 2385 | 2403 |
| 2386 HTMLSlotElement* Node::AssignedSlot() const { | 2404 HTMLSlotElement* Node::AssignedSlot() const { |
| 2387 // assignedSlot doesn't need to call updateDistribution(). | 2405 // assignedSlot doesn't need to call updateDistribution(). |
| 2388 DCHECK(!IsPseudoElement()); | 2406 DCHECK(!IsPseudoElement()); |
| 2389 if (ShadowRoot* root = V1ShadowRootOfParent()) | 2407 if (ShadowRoot* root = V1ShadowRootOfParent()) |
| 2390 return root->AssignedSlotFor(*this); | 2408 return root->AssignedSlotFor(*this); |
| 2391 return nullptr; | 2409 return nullptr; |
| 2392 } | 2410 } |
| 2393 | 2411 |
| 2412 HTMLSlotElement* Node::FinalDestinationSlot() const { |
| 2413 HTMLSlotElement* slot = AssignedSlot(); |
| 2414 if (!slot) |
| 2415 return nullptr; |
| 2416 for (HTMLSlotElement* next = slot->AssignedSlot(); next; |
| 2417 next = next->AssignedSlot()) { |
| 2418 slot = next; |
| 2419 } |
| 2420 return slot; |
| 2421 } |
| 2422 |
| 2394 HTMLSlotElement* Node::assignedSlotForBinding() { | 2423 HTMLSlotElement* Node::assignedSlotForBinding() { |
| 2395 // assignedSlot doesn't need to call updateDistribution(). | 2424 // assignedSlot doesn't need to call updateDistribution(). |
| 2396 if (ShadowRoot* root = V1ShadowRootOfParent()) { | 2425 if (ShadowRoot* root = V1ShadowRootOfParent()) { |
| 2397 if (root->GetType() == ShadowRootType::kOpen) | 2426 if (root->GetType() == ShadowRootType::kOpen) |
| 2398 return root->AssignedSlotFor(*this); | 2427 return root->AssignedSlotFor(*this); |
| 2399 } | 2428 } |
| 2400 return nullptr; | 2429 return nullptr; |
| 2401 } | 2430 } |
| 2402 | 2431 |
| 2403 void Node::SetFocused(bool flag, WebFocusType focus_type) { | 2432 void Node::SetFocused(bool flag, WebFocusType focus_type) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 if (node) { | 2622 if (node) { |
| 2594 std::stringstream stream; | 2623 std::stringstream stream; |
| 2595 node->PrintNodePathTo(stream); | 2624 node->PrintNodePathTo(stream); |
| 2596 LOG(INFO) << stream.str(); | 2625 LOG(INFO) << stream.str(); |
| 2597 } else { | 2626 } else { |
| 2598 LOG(INFO) << "Cannot showNodePath for <null>"; | 2627 LOG(INFO) << "Cannot showNodePath for <null>"; |
| 2599 } | 2628 } |
| 2600 } | 2629 } |
| 2601 | 2630 |
| 2602 #endif | 2631 #endif |
| OLD | NEW |