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

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2836753002: Rebuild layout tree in flat tree order. (Closed)
Patch Set: Rebased Created 3 years, 7 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/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 7d8415f0b1a934c007004df3e9fc46dcb54354ce..75a14c126049e00ced0923749a439772f8c35f52 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -769,9 +769,27 @@ void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
}
+static ContainerNode* GetReattachParent(Node& node) {
+ if (node.IsPseudoElement())
+ return node.ParentOrShadowHostNode();
+ if (node.IsChildOfV1ShadowHost()) {
+ if (HTMLSlotElement* slot = node.FinalDestinationSlot())
+ return slot;
+ }
+ if (node.IsInV0ShadowTree() || node.IsChildOfV0ShadowHost()) {
+ if (ShadowWhereNodeCanBeDistributedForV0(node)) {
+ if (InsertionPoint* insertion_point =
+ const_cast<InsertionPoint*>(ResolveReprojection(&node))) {
+ return insertion_point;
+ }
+ }
+ }
+ return node.ParentOrShadowHostNode();
+}
+
void Node::MarkAncestorsWithChildNeedsReattachLayoutTree() {
- for (ContainerNode* p = ParentOrShadowHostNode();
- p && !p->ChildNeedsReattachLayoutTree(); p = p->ParentOrShadowHostNode())
+ for (ContainerNode* p = GetReattachParent(*this);
+ p && !p->ChildNeedsReattachLayoutTree(); p = GetReattachParent(*p))
p->SetChildNeedsReattachLayoutTree();
}
@@ -2391,6 +2409,17 @@ HTMLSlotElement* Node::AssignedSlot() const {
return nullptr;
}
+HTMLSlotElement* Node::FinalDestinationSlot() const {
+ HTMLSlotElement* slot = AssignedSlot();
+ if (!slot)
+ return nullptr;
+ for (HTMLSlotElement* next = slot->AssignedSlot(); next;
+ next = next->AssignedSlot()) {
+ slot = next;
+ }
+ return slot;
+}
+
HTMLSlotElement* Node::assignedSlotForBinding() {
// assignedSlot doesn't need to call updateDistribution().
if (ShadowRoot* root = V1ShadowRootOfParent()) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698