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

Unified Diff: Source/core/dom/shadow/InsertionPoint.cpp

Issue 17054002: Element::recalcStyle() overly reattach()-es InsertionPoints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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/shadow/InsertionPoint.cpp
diff --git a/Source/core/dom/shadow/InsertionPoint.cpp b/Source/core/dom/shadow/InsertionPoint.cpp
index 4ee112b5cb8ef4627f4ba55aa29379f953da505d..63532d8b81b231439b2307bb2b46a3d0ffd7016c 100644
--- a/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/Source/core/dom/shadow/InsertionPoint.cpp
@@ -45,6 +45,7 @@ InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document, CreateInsertionPoint)
, m_registeredWithShadowRoot(false)
{
+ setHasCustomStyleCallbacks();
}
InsertionPoint::~InsertionPoint()
@@ -74,6 +75,16 @@ void InsertionPoint::detach(const AttachContext& context)
HTMLElement::detach(context);
}
+void InsertionPoint::willRecalcStyle(StyleChange change)
+{
+ if (change < Inherit)
+ return;
+ if (ShadowRoot* shadowRoot = containingShadowRoot()) {
+ ContentDistributor::ensureDistribution(shadowRoot);
esprehn 2013/06/14 08:32:29 Why not call shadowRoot->host() here and avoid the
+ shadowRoot->owner()->distributor().setNeedsStyleRecalcIfDistributedTo(shadowRoot->host(), this);
+ }
+}
+
bool InsertionPoint::shouldUseFallbackElements() const
{
return isActive() && !hasDistribution();
@@ -206,6 +217,7 @@ InsertionPoint* resolveReprojection(const Node* projectedNode)
while (current) {
if (ElementShadow* shadow = shadowOfParentForDistribution(current)) {
+ ContentDistributor::ensureDistribution(shadow);
if (ShadowRoot* root = current->containingShadowRoot())
ContentDistributor::ensureDistribution(root);
if (InsertionPoint* insertedTo = shadow->distributor().findInsertionPointFor(projectedNode)) {

Powered by Google App Engine
This is Rietveld 408576698