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

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

Issue 2766163002: Pass nextTextSibling to ::before layout rebuild. (Closed)
Patch Set: Documentation fix. 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/Element.h » ('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 46aacf5a09266351f9e34286c481c4bf70ec6f1c..bc153f3593813f89899a9514f6c14f0601667177 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1298,7 +1298,7 @@ void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) {
}
}
-void ContainerNode::rebuildChildrenLayoutTrees() {
+void ContainerNode::rebuildChildrenLayoutTrees(Text*& nextTextSibling) {
DCHECK(!needsReattachLayoutTree());
// This loop is deliberately backwards because we use insertBefore in the
@@ -1306,21 +1306,20 @@ void ContainerNode::rebuildChildrenLayoutTrees() {
// point while building the layout tree. Having us start from the last child
// and work our way back means in the common case, we'll find the insertion
// point in O(1) time. See crbug.com/288225
- Text* lastTextNode = nullptr;
for (Node* child = lastChild(); child; child = child->previousSibling()) {
bool rebuildChild = child->needsReattachLayoutTree() ||
child->childNeedsReattachLayoutTree();
if (child->isTextNode()) {
Text* textNode = toText(child);
if (rebuildChild)
- textNode->rebuildTextLayoutTree(lastTextNode);
- lastTextNode = textNode;
+ textNode->rebuildTextLayoutTree(nextTextSibling);
+ nextTextSibling = textNode;
} else if (child->isElementNode()) {
Element* element = toElement(child);
if (rebuildChild)
- element->rebuildLayoutTree(lastTextNode);
+ element->rebuildLayoutTree(nextTextSibling);
if (element->layoutObject())
- lastTextNode = nullptr;
+ nextTextSibling = nullptr;
}
}
// This is done in ContainerNode::attachLayoutTree but will never be cleared
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698