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..66245032fcf625ab0965571e8b27b331f9030adc 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() |
@@ -54,7 +55,7 @@ InsertionPoint::~InsertionPoint() |
void InsertionPoint::attach(const AttachContext& context) |
{ |
if (ShadowRoot* shadowRoot = containingShadowRoot()) |
- ContentDistributor::ensureDistribution(shadowRoot); |
+ shadowRoot->host()->ensureDistribution(); |
for (size_t i = 0; i < m_distribution.size(); ++i) { |
if (!m_distribution.at(i)->attached()) |
m_distribution.at(i)->attach(context); |
@@ -66,7 +67,7 @@ void InsertionPoint::attach(const AttachContext& context) |
void InsertionPoint::detach(const AttachContext& context) |
{ |
if (ShadowRoot* shadowRoot = containingShadowRoot()) |
- ContentDistributor::ensureDistribution(shadowRoot); |
+ shadowRoot->host()->ensureDistribution(); |
for (size_t i = 0; i < m_distribution.size(); ++i) |
m_distribution.at(i)->detach(context); |
@@ -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()) { |
+ shadowRoot->host()->ensureDistribution(); |
+ shadowRoot->owner()->distributor().setNeedsStyleRecalcIfDistributedTo(shadowRoot->host(), this); |
+ } |
+} |
+ |
bool InsertionPoint::shouldUseFallbackElements() const |
{ |
return isActive() && !hasDistribution(); |
@@ -101,7 +112,7 @@ bool InsertionPoint::isActive() const |
PassRefPtr<NodeList> InsertionPoint::getDistributedNodes() const |
{ |
if (ShadowRoot* shadowRoot = containingShadowRoot()) |
- ContentDistributor::ensureDistribution(shadowRoot); |
+ shadowRoot->host()->ensureDistribution(); |
Vector<RefPtr<Node> > nodes; |
@@ -206,8 +217,9 @@ InsertionPoint* resolveReprojection(const Node* projectedNode) |
while (current) { |
if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { |
+ shadow->host()->ensureDistribution(); |
if (ShadowRoot* root = current->containingShadowRoot()) |
- ContentDistributor::ensureDistribution(root); |
+ root->host()->ensureDistribution(); |
if (InsertionPoint* insertedTo = shadow->distributor().findInsertionPointFor(projectedNode)) { |
current = insertedTo; |
insertionPoint = insertedTo; |
@@ -235,7 +247,7 @@ void collectInsertionPointsWhereNodeIsDistributed(const Node* node, Vector<Inser |
while (true) { |
if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { |
if (ShadowRoot* root = current->containingShadowRoot()) |
- ContentDistributor::ensureDistribution(root); |
+ root->host()->ensureDistribution(); |
if (InsertionPoint* insertedTo = shadow->distributor().findInsertionPointFor(node)) { |
current = insertedTo; |
results.append(insertedTo); |