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

Unified Diff: Source/core/dom/Element.cpp

Issue 77863002: Update styleRecalc so that it traverses shadow insertion points in 2 pass algorithms (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make styleRecalc traverse shadow trees in 2 pass algorithm Created 7 years 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: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index f0b7b12554dac75334e698614c4d248274eebca2..06a55c6be64f8e02fd8a2f595ac37829f98e36ea 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1507,7 +1507,7 @@ PassRefPtr<RenderStyle> Element::originalStyleForRenderer()
return document().ensureStyleResolver().styleForElement(this);
}
-void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling)
+void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling, InsertionPoint* shadowInsertionPoint)
{
ASSERT(document().inStyleRecalc());
ASSERT(!parentOrShadowHostNode()->needsStyleRecalc());
@@ -1526,10 +1526,12 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling)
clearNeedsStyleRecalc();
}
- // If we reattached we don't need to recalc the style of our descendants anymore.
- if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc())
- recalcChildStyle(change);
- clearChildNeedsStyleRecalc();
+ if (this != shadowInsertionPoint) {
+ // If we reattached we don't need to recalc the style of our descendants anymore.
+ if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc())
+ recalcChildStyle(change, shadowInsertionPoint);
+ clearChildNeedsStyleRecalc();
+ }
if (hasCustomStyleCallbacks())
didRecalcStyle(change);
@@ -1595,7 +1597,7 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change)
return max(localChange, change);
}
-void Element::recalcChildStyle(StyleRecalcChange change)
+void Element::recalcChildStyle(StyleRecalcChange change, InsertionPoint* shadowInsertionPoint)
{
ASSERT(document().inStyleRecalc());
ASSERT(change >= Inherit || childNeedsStyleRecalc());
@@ -1610,6 +1612,14 @@ void Element::recalcChildStyle(StyleRecalcChange change)
}
}
+ for (ShadowRoot* root = oldestShadowRoot(); root; root = root->youngerShadowRoot()) {
+ if (InsertionPoint* insertionPoint = root->shadowInsertionPoint()) {
+ if ((change >= Inherit && change < Reattach) || insertionPoint->childNeedsStyleRecalc())
esprehn 2013/12/11 09:53:27 if (shouldRecalcStyle(change, insertionPoint)) We
+ insertionPoint->recalcChildStyle(change, 0);
esprehn 2013/12/11 09:53:27 This doesn't work, the bloom filter is wrong at th
+ insertionPoint->clearChildNeedsStyleRecalc();
esprehn 2013/12/11 09:53:27 If you make the above change this goes away.
+ }
+ }
+
if (shouldRecalcStyle(change, this))
updatePseudoElement(BEFORE, change);
@@ -1630,7 +1640,7 @@ void Element::recalcChildStyle(StyleRecalcChange change)
Element* element = toElement(child);
if (shouldRecalcStyle(change, element)) {
parentPusher.push();
- element->recalcStyle(change, lastTextNode);
+ element->recalcStyle(change, lastTextNode, shadowInsertionPoint);
} else if (element->supportsStyleSharing()) {
styleResolver.addToStyleSharingList(*element);
}

Powered by Google App Engine
This is Rietveld 408576698