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

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

Issue 15680005: Element::recalcStyle() overly reattach()-es InsertionPoints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated test and test expectations Created 7 years, 7 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: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index d28320ada6db3218cecfefede5954e802ee22206..4e82e6f80fd9c7cefdf8cb7cdcff6a72bfb27580 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -835,6 +835,25 @@ inline void Node::markAncestorsWithChildNeedsStyleRecalc()
{
for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode())
p->setChildNeedsStyleRecalc();
+}
+
+inline void Node::markDistributionsWithNeedsStyleRecalc()
+{
+ for (ShadowRoot* root = containingShadowRoot(); root; root = root->host()->containingShadowRoot()) {
+ ScopeContentDistribution* distribution = root->scopeDistribution();
+ if (!distribution || !distribution->hasInsertionPoint(root))
esprehn 2013/06/13 02:25:38 hasInsertionPoint is static, this doesn't make sen
+ continue;
+ root->host()->setNeedsStyleRecalc();
+ const Vector<RefPtr<InsertionPoint> >& insertionPoints = distribution->ensureInsertionPointList(root);
+ for (unsigned i = 0; i < insertionPoints.size(); ++i)
+ insertionPoints[i]->setNeedsStyleRecalc();
esprehn 2013/06/13 02:25:38 This is much too aggressive. Now if we setNeedsSty
+ }
+}
+
+inline void Node::propagateStyleRecalcMarking()
+{
+ markAncestorsWithChildNeedsStyleRecalc();
+ markDistributionsWithNeedsStyleRecalc();
if (document()->childNeedsStyleRecalc())
document()->scheduleStyleRecalc();
@@ -861,7 +880,7 @@ void Node::setNeedsStyleRecalc(StyleChangeType changeType)
setStyleChange(changeType);
if (existingChangeType == NoStyleChange)
- markAncestorsWithChildNeedsStyleRecalc();
+ propagateStyleRecalcMarking();
}
void Node::lazyAttach()
@@ -877,7 +896,7 @@ void Node::lazyAttach()
return;
}
setStyleChange(FullStyleChange);
- markAncestorsWithChildNeedsStyleRecalc();
+ propagateStyleRecalcMarking();
}
bool Node::supportsFocus() const

Powered by Google App Engine
This is Rietveld 408576698