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

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: For landing 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
« no previous file with comments | « Source/core/dom/shadow/InsertionPoint.h ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e0ef0b25fb61998a63d556dc97ad8816615cd70c 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(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);
« no previous file with comments | « Source/core/dom/shadow/InsertionPoint.h ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698