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

Unified Diff: third_party/WebKit/Source/core/dom/Element.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
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index a403176069c3b352a8a11cbf448a268666686e72..f040578077ee87dd16ef8915aa011ba73ccbfbf2 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -2037,12 +2037,13 @@ void Element::rebuildLayoutTree(Text* nextTextSibling) {
DCHECK(!needsReattachLayoutTree());
SelectorFilterParentScope filterScope(*this);
StyleSharingDepthScope sharingScope(*this);
- reattachPseudoElementLayoutTree(PseudoIdBefore);
- rebuildShadowRootLayoutTree();
- rebuildChildrenLayoutTrees();
- reattachPseudoElementLayoutTree(PseudoIdAfter);
- reattachPseudoElementLayoutTree(PseudoIdBackdrop);
- reattachPseudoElementLayoutTree(PseudoIdFirstLetter);
+ Text* nextTextSibling = nullptr;
+ rebuildPseudoElementLayoutTree(PseudoIdAfter);
+ rebuildShadowRootLayoutTree(nextTextSibling);
+ rebuildChildrenLayoutTrees(nextTextSibling);
+ rebuildPseudoElementLayoutTree(PseudoIdBefore, nextTextSibling);
+ rebuildPseudoElementLayoutTree(PseudoIdBackdrop);
+ rebuildPseudoElementLayoutTree(PseudoIdFirstLetter);
}
DCHECK(!needsStyleRecalc());
DCHECK(!childNeedsStyleRecalc());
@@ -2050,19 +2051,22 @@ void Element::rebuildLayoutTree(Text* nextTextSibling) {
DCHECK(!childNeedsReattachLayoutTree());
}
-void Element::rebuildShadowRootLayoutTree() {
+void Element::rebuildShadowRootLayoutTree(Text*& nextTextSibling) {
for (ShadowRoot* root = youngestShadowRoot(); root;
root = root->olderShadowRoot()) {
- if (root->needsReattachLayoutTree() || root->childNeedsReattachLayoutTree())
- root->rebuildLayoutTree();
+ // TODO(rune@opera.com): nextTextSibling is not set correctly when we have
+ // slotted nodes (crbug.com/648931). Also, it may be incorrect when we have
+ // multiple shadow roots (for V0 shadow hosts).
+ root->rebuildLayoutTree(nextTextSibling);
}
}
-void Element::reattachPseudoElementLayoutTree(PseudoId pseudoId) {
+void Element::rebuildPseudoElementLayoutTree(PseudoId pseudoId,
+ Text* nextTextSibling) {
if (PseudoElement* element = pseudoElement(pseudoId)) {
if (element->needsReattachLayoutTree() ||
element->childNeedsReattachLayoutTree())
- element->rebuildLayoutTree();
+ element->rebuildLayoutTree(nextTextSibling);
} else {
createPseudoElementIfNeeded(pseudoId);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698