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

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

Issue 2460813002: Make slots in non-shadow trees participate in a flat tree (Closed)
Patch Set: update expectation 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp
diff --git a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp
index 1bca680144eec770a8294cfd465272502f9e75db..8e498b52afc88b645c2629d9c170bf420a0405c4 100644
--- a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp
@@ -68,14 +68,13 @@ Node* FlatTreeTraversal::resolveDistributionStartingAt(
: sibling->previousSibling())) {
if (isHTMLSlotElement(*sibling)) {
const HTMLSlotElement& slot = toHTMLSlotElement(*sibling);
- if (!slot.supportsDistribution()) {
- const_cast<HTMLSlotElement&>(slot).updateDistributedNodesManually();
+ if (slot.supportsDistribution()) {
+ if (Node* found = (direction == TraversalDirectionForward
+ ? slot.firstDistributedNode()
+ : slot.lastDistributedNode()))
+ return found;
+ continue;
}
- if (Node* found = (direction == TraversalDirectionForward
- ? slot.firstDistributedNode()
- : slot.lastDistributedNode()))
- return found;
- continue;
}
if (node->isInV0ShadowTree())
return v0ResolveDistributionStartingAt(*sibling, direction);
@@ -87,7 +86,8 @@ Node* FlatTreeTraversal::resolveDistributionStartingAt(
Node* FlatTreeTraversal::v0ResolveDistributionStartingAt(
const Node& node,
TraversalDirection direction) {
- DCHECK(!isHTMLSlotElement(node));
+ DCHECK(!isHTMLSlotElement(node) ||
+ !toHTMLSlotElement(node).supportsDistribution());
for (const Node* sibling = &node; sibling;
sibling = (direction == TraversalDirectionForward
? sibling->nextSibling()
@@ -195,9 +195,11 @@ ContainerNode* FlatTreeTraversal::traverseParent(
Element* parent = node.parentElement();
if (parent && isHTMLSlotElement(parent)) {
HTMLSlotElement& slot = toHTMLSlotElement(*parent);
- if (!slot.assignedNodes().isEmpty())
- return nullptr;
- return traverseParent(slot, details);
+ if (slot.supportsDistribution()) {
+ if (!slot.assignedNodes().isEmpty())
+ return nullptr;
+ return traverseParent(slot, details);
+ }
}
if (canBeDistributedToInsertionPoint(node))

Powered by Google App Engine
This is Rietveld 408576698