Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ContainerNode.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
| index 315ac2dd6b3cc465ac398d051e66f65763c0623c..af5ebf844b46e1b9443d257feaae0e6b33447322 100644 |
| --- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
| +++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
| @@ -91,7 +91,6 @@ void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent) { |
| } |
| ContainerNode::~ContainerNode() { |
| - DCHECK(needsAttach()); |
|
nainar
2016/11/29 06:13:39
This is unnecessary - maybe replace this with a ch
rune
2016/12/05 10:05:16
Wouldn't this correspond with needsReattachLayoutT
esprehn
2016/12/05 22:31:33
Leave this ASSERT alone, it's making sure by the t
|
| } |
| DISABLE_CFI_PERF |
| @@ -549,7 +548,7 @@ void ContainerNode::removeBetween(Node* previousChild, |
| AttachContext context; |
| context.clearInvalidation = true; |
| - if (!oldChild.needsAttach()) |
|
nainar
2016/11/29 06:13:39
This statemement is no longer true since we are no
rune
2016/12/05 10:05:16
Shouldn't this be !needsReattachLayoutTree()?
esprehn
2016/12/05 22:31:33
Leave this alone.
|
| + if (oldChild.needsReattachLayoutTree()) |
| oldChild.detachLayoutTree(context); |
| if (nextChild) |
| @@ -759,10 +758,10 @@ void ContainerNode::attachLayoutTree(const AttachContext& context) { |
| for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| #if DCHECK_IS_ON() |
| - DCHECK(child->needsAttach() || |
| + DCHECK(child->needsReattachLayoutTree() || |
| childAttachedAllowedWhenAttachingChildren(this)); |
| #endif |
| - if (child->needsAttach()) |
| + if (child->needsReattachLayoutTree()) |
| child->attachLayoutTree(childrenContext); |
| } |
| @@ -778,8 +777,6 @@ void ContainerNode::detachLayoutTree(const AttachContext& context) { |
| for (Node* child = firstChild(); child; child = child->nextSibling()) |
| child->detachLayoutTree(childrenContext); |
| - |
| - setChildNeedsStyleRecalc(); |
| Node::detachLayoutTree(context); |
| } |
| @@ -1294,6 +1291,25 @@ void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) { |
| lastTextNode = nullptr; |
| } |
| } |
| + clearChildNeedsStyleRecalc(); |
| +} |
| + |
| +void ContainerNode::rebuildDescendantLayoutTree() { |
| + DCHECK(!needsStyleRecalc()); |
| + DCHECK(!childNeedsStyleRecalc()); |
| + DCHECK(!needsReattachLayoutTree()); |
| + |
| + for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| + if (child->needsReattachLayoutTree() || |
| + child->childNeedsReattachLayoutTree()) { |
| + if (child->isTextNode()) |
| + toText(child)->rebuildTextLayoutTree(); |
| + else if (child->isElementNode()) |
| + toElement(child)->rebuildLayoutTree(); |
| + } |
| + } |
| + clearChildNeedsStyleRecalc(); |
| + clearChildNeedsReattachLayoutTree(); |
| } |
| void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, |