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

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

Issue 2420883002: Revert 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 }
74 if (Node* found = (direction == TraversalDirectionForward 71 if (Node* found = (direction == TraversalDirectionForward
75 ? slot.firstDistributedNode() 72 ? slot.firstDistributedNode()
76 : slot.lastDistributedNode())) 73 : slot.lastDistributedNode()))
77 return found; 74 return found;
78 continue; 75 continue;
79 } 76 }
80 if (node->isInV0ShadowTree()) 77 if (node->isInV0ShadowTree())
81 return v0ResolveDistributionStartingAt(*sibling, direction); 78 return v0ResolveDistributionStartingAt(*sibling, direction);
82 return const_cast<Node*>(sibling); 79 return const_cast<Node*>(sibling);
83 } 80 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 378
382 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { 379 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) {
383 assertPrecondition(node); 380 assertPrecondition(node);
384 Node* lastDescendant = lastWithin(node); 381 Node* lastDescendant = lastWithin(node);
385 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); 382 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node);
386 assertPostcondition(&result); 383 assertPostcondition(&result);
387 return result; 384 return result;
388 } 385 }
389 386
390 } // namespace blink 387 } // 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