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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Make needsAttach() only check if getStyleChangeType flag is NeedsReattachStyleChange and add a Layo… 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfe0428c4d1150b125568ba6936061c3c3ebea3b..1be048eec8c55266823a50c08266ee08568ee250 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -788,6 +788,7 @@ void ContainerNode::detachLayoutTree(const AttachContext& context) {
child->detachLayoutTree(childrenContext);
setChildNeedsStyleRecalc();
+ setChildNeedsReattachLayoutTree();
Node::detachLayoutTree(context);
}
@@ -795,9 +796,15 @@ void ContainerNode::childrenChanged(const ChildrenChange& change) {
document().incDOMTreeVersion();
document().notifyChangeChildren(*this);
invalidateNodeListCachesInAncestors();
- if (change.isChildInsertion() && !childNeedsStyleRecalc()) {
- setChildNeedsStyleRecalc();
- markAncestorsWithChildNeedsStyleRecalc();
+ if (change.isChildInsertion()) {
+ if (!childNeedsStyleRecalc()) {
+ setChildNeedsStyleRecalc();
+ markAncestorsWithChildNeedsStyleRecalc();
+ }
+ if (!childNeedsReattachLayoutTree()) {
+ setChildNeedsReattachLayoutTree();
+ markAncestorsWithChildNeedsReattachLayoutTree();
+ }
}
}
@@ -1305,6 +1312,24 @@ void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) {
}
}
+void ContainerNode::rebuildChildrenLayoutTrees() {
+ DCHECK(!needsReattachLayoutTree());
+
+ for (Node* child = lastChild(); child; child = child->previousSibling()) {
+ if (child->needsReattachLayoutTree() ||
+ child->childNeedsReattachLayoutTree()) {
+ if (child->isTextNode())
+ toText(child)->rebuildTextLayoutTree();
+ else if (child->isElementNode())
+ toElement(child)->rebuildLayoutTree();
+ }
+ }
+ // This is done in ContainerNode::attachLayoutTree but will never be cleared
+ // if we don't enter ContainerNode::attachLayoutTree so we do it here.
+ clearChildNeedsStyleRecalc();
+ clearChildNeedsReattachLayoutTree();
+}
+
void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
Element* changedElement,
Node* nodeBeforeChange,
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698