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

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

Issue 23766020: Trivial changes to default Vector sizing in the shadow area. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tidying up. Created 7 years, 3 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/ContentDistribution.h ('k') | Source/core/dom/shadow/InsertionPoint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/shadow/ElementShadow.cpp
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index 455ad3287d663ed6acbc44d59aa3311cab12e2b1..bebad50f004c6fac391e15fd7854d459049a452c 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -194,15 +194,16 @@ void ElementShadow::populate(Node* node, Vector<Node*>& pool)
void ElementShadow::distribute()
{
Vector<Node*> pool;
+ pool.reserveInitialCapacity(32);
for (Node* node = host()->firstChild(); node; node = node->nextSibling())
populate(node, pool);
host()->setNeedsStyleRecalc();
- Vector<bool> distributed(pool.size());
- distributed.fill(false);
+ Vector<bool> distributed;
+ distributed.fill(false, pool.size());
- Vector<HTMLShadowElement*, 8> activeShadowInsertionPoints;
+ Vector<HTMLShadowElement*, 32> activeShadowInsertionPoints;
for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
HTMLShadowElement* firstActiveShadowInsertionPoint = 0;
@@ -282,8 +283,9 @@ void ElementShadow::distributeNodeChildrenTo(InsertionPoint* insertionPoint, Con
InsertionPoint* innerInsertionPoint = toInsertionPoint(node);
if (innerInsertionPoint->hasDistribution()) {
for (size_t i = 0; i < innerInsertionPoint->size(); ++i) {
- distribution.append(innerInsertionPoint->at(i));
- m_nodeToInsertionPoint.add(innerInsertionPoint->at(i), insertionPoint);
+ Node* nodeToAdd = innerInsertionPoint->at(i);
+ distribution.append(nodeToAdd);
+ m_nodeToInsertionPoint.add(nodeToAdd, insertionPoint);
}
} else {
for (Node* child = innerInsertionPoint->firstChild(); child; child = child->nextSibling()) {
« no previous file with comments | « Source/core/dom/shadow/ContentDistribution.h ('k') | Source/core/dom/shadow/InsertionPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698