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

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

Issue 1671873002: Fixed for-loop increments in InsertionPoint::setDistributedNodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
diff --git a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
index 03f5048f5d55aa6c5a6f47211a3e95f4b32f9f55..19323fd4098cdfe0315745b4d62344ab2f7a9ac6 100644
--- a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
@@ -54,11 +54,6 @@ InsertionPoint::~InsertionPoint()
void InsertionPoint::setDistributedNodes(DistributedNodes& distributedNodes)
{
- if (shouldUseFallbackElements()) {
- for (Node* child = firstChild(); child; child = child->nextSibling())
- child->lazyReattachIfAttached();
- }
-
// Attempt not to reattach nodes that would be distributed to the exact same
// location by comparing the old and new distributions.
@@ -71,11 +66,15 @@ void InsertionPoint::setDistributedNodes(DistributedNodes& distributedNodes)
// the new distribution that were inserted.
for ( ; j < distributedNodes.size() && m_distributedNodes.at(i) != distributedNodes.at(j); ++j)
distributedNodes.at(j)->lazyReattachIfAttached();
+ if (j == distributedNodes.size())
+ break;
} else if (m_distributedNodes.size() > distributedNodes.size()) {
// If the old distribution is larger than the new one, reattach all nodes in
// the old distribution that were removed.
for ( ; i < m_distributedNodes.size() && m_distributedNodes.at(i) != distributedNodes.at(j); ++i)
m_distributedNodes.at(i)->lazyReattachIfAttached();
+ if (i == m_distributedNodes.size())
+ break;
} else if (m_distributedNodes.at(i) != distributedNodes.at(j)) {
// If both distributions are the same length reattach both old and new.
m_distributedNodes.at(i)->lazyReattachIfAttached();
@@ -130,11 +129,6 @@ void InsertionPoint::willRecalcStyle(StyleRecalcChange change)
m_distributedNodes.at(i)->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::PropagateInheritChangeToDistributedNodes));
}
-bool InsertionPoint::shouldUseFallbackElements() const
-{
- return isActive() && !hasDistribution();
-}
-
bool InsertionPoint::canBeActive() const
{
ShadowRoot* shadowRoot = containingShadowRoot();
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698