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

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

Issue 2749033006: Handle fallback content case in FlatTreeTraversal::traverseSiblings() (Closed)
Patch Set: Created 3 years, 9 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 if (shadowWhereNodeCanBeDistributedForV0(node)) 128 if (shadowWhereNodeCanBeDistributedForV0(node))
129 return traverseSiblingsForV0Distribution(node, direction); 129 return traverseSiblingsForV0Distribution(node, direction);
130 130
131 if (Node* found = resolveDistributionStartingAt( 131 if (Node* found = resolveDistributionStartingAt(
132 direction == TraversalDirectionForward ? node.nextSibling() 132 direction == TraversalDirectionForward ? node.nextSibling()
133 : node.previousSibling(), 133 : node.previousSibling(),
134 direction)) 134 direction))
135 return found; 135 return found;
136 136
137 if (node.isInV1ShadowTree()) {
hayato 2017/03/16 09:32:56 Instead of this early check, could you use slot.su
kochi 2017/03/16 10:09:54 Done. Actually it looks better now. Thanks for th
138 // Slotted nodes are already handled in traverseSiblingsForV1HostChild()
139 // above, here is for fallback contents.
140 Element* parent = node.parentElement();
141 if (parent && isHTMLSlotElement(parent)) {
142 HTMLSlotElement& slot = toHTMLSlotElement(*parent);
143 if (!slot.assignedNodes().isEmpty())
144 return nullptr;
145 return traverseSiblings(slot, direction);
146 }
147 }
148
137 if (!node.isInV0ShadowTree()) 149 if (!node.isInV0ShadowTree())
138 return nullptr; 150 return nullptr;
139 151
140 // For v0 older shadow tree 152 // For v0 older shadow tree
141 if (node.parentNode() && node.parentNode()->isShadowRoot()) { 153 if (node.parentNode() && node.parentNode()->isShadowRoot()) {
142 ShadowRoot* parentShadowRoot = toShadowRoot(node.parentNode()); 154 ShadowRoot* parentShadowRoot = toShadowRoot(node.parentNode());
143 if (!parentShadowRoot->isYoungest()) { 155 if (!parentShadowRoot->isYoungest()) {
144 HTMLShadowElement* assignedInsertionPoint = 156 HTMLShadowElement* assignedInsertionPoint =
145 parentShadowRoot->shadowInsertionPointOfYoungerShadowRoot(); 157 parentShadowRoot->shadowInsertionPointOfYoungerShadowRoot();
146 DCHECK(assignedInsertionPoint); 158 DCHECK(assignedInsertionPoint);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 395
384 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { 396 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) {
385 assertPrecondition(node); 397 assertPrecondition(node);
386 Node* lastDescendant = lastWithin(node); 398 Node* lastDescendant = lastWithin(node);
387 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); 399 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node);
388 assertPostcondition(&result); 400 assertPostcondition(&result);
389 return result; 401 return result;
390 } 402 }
391 403
392 } // namespace blink 404 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698