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

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

Issue 2427443003: Reland of Fix FlatTreeTraversal for a slot in a document tree (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const Node* node, 61 const Node* node,
62 TraversalDirection direction) { 62 TraversalDirection direction) {
63 if (!node) 63 if (!node)
64 return nullptr; 64 return nullptr;
65 for (const Node* sibling = node; sibling; 65 for (const Node* sibling = node; sibling;
66 sibling = (direction == TraversalDirectionForward 66 sibling = (direction == TraversalDirectionForward
67 ? sibling->nextSibling() 67 ? sibling->nextSibling()
68 : sibling->previousSibling())) { 68 : sibling->previousSibling())) {
69 if (isHTMLSlotElement(*sibling)) { 69 if (isHTMLSlotElement(*sibling)) {
70 const HTMLSlotElement& slot = toHTMLSlotElement(*sibling); 70 const HTMLSlotElement& slot = toHTMLSlotElement(*sibling);
71 if (!slot.supportsDistribution()) {
72 const_cast<HTMLSlotElement&>(slot).updateDistributedNodesManually();
73 }
71 if (Node* found = (direction == TraversalDirectionForward 74 if (Node* found = (direction == TraversalDirectionForward
72 ? slot.firstDistributedNode() 75 ? slot.firstDistributedNode()
73 : slot.lastDistributedNode())) 76 : slot.lastDistributedNode()))
74 return found; 77 return found;
75 continue; 78 continue;
76 } 79 }
77 if (node->isInV0ShadowTree()) 80 if (node->isInV0ShadowTree())
78 return v0ResolveDistributionStartingAt(*sibling, direction); 81 return v0ResolveDistributionStartingAt(*sibling, direction);
79 return const_cast<Node*>(sibling); 82 return const_cast<Node*>(sibling);
80 } 83 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 381
379 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { 382 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) {
380 assertPrecondition(node); 383 assertPrecondition(node);
381 Node* lastDescendant = lastWithin(node); 384 Node* lastDescendant = lastWithin(node);
382 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); 385 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node);
383 assertPostcondition(&result); 386 assertPostcondition(&result);
384 return result; 387 return result;
385 } 388 }
386 389
387 } // namespace blink 390 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698