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

Unified Diff: Source/core/css/parser/CSSParserImpl.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Some small fixes to (hopefully) fix some broken tests Created 5 years, 7 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/css/parser/CSSParserImpl.cpp
diff --git a/Source/core/css/parser/CSSParserImpl.cpp b/Source/core/css/parser/CSSParserImpl.cpp
index ee38ce43af26d0f74f7e6a94dea878ddf21447c4..dc4d0a930e904b6eff1f6fd9ccc81df4cb342154 100644
--- a/Source/core/css/parser/CSSParserImpl.cpp
+++ b/Source/core/css/parser/CSSParserImpl.cpp
@@ -49,7 +49,7 @@ bool CSSParserImpl::parseValue(MutableStylePropertySet* declaration, CSSProperty
return declaration->addParsedProperties(parser.m_parsedProperties);
}
-static inline void filterProperties(bool important, const WillBeHeapVector<CSSProperty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties)
+static inline void filterProperties(bool important, const WillBeHeapVector<CSSProperty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, BitArray<numCSSProperties>& seenProperties)
{
// Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
for (size_t i = input.size(); i--; ) {
@@ -60,20 +60,21 @@ static inline void filterProperties(bool important, const WillBeHeapVector<CSSPr
if (seenProperties.get(propertyIDIndex))
continue;
seenProperties.set(propertyIDIndex);
- output[--unusedEntries] = property;
+ output.append(property);
}
+ output.reverse();
}
static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> createStylePropertySet(WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSParserMode mode)
{
BitArray<numCSSProperties> seenProperties;
- size_t unusedEntries = parsedProperties.size();
- WillBeHeapVector<CSSProperty, 256> results(unusedEntries);
+ WillBeHeapVector<CSSProperty, 256> results;
+ results.reserveCapacity(parsedProperties.size());
Timothy Loh 2015/06/02 00:42:04 reserveInitialCapacity
sashab 2015/06/05 06:16:30 Done.
- filterProperties(true, parsedProperties, results, unusedEntries, seenProperties);
- filterProperties(false, parsedProperties, results, unusedEntries, seenProperties);
+ filterProperties(true, parsedProperties, results, seenProperties);
+ filterProperties(false, parsedProperties, results, seenProperties);
- RefPtrWillBeRawPtr<ImmutableStylePropertySet> result = ImmutableStylePropertySet::create(results.data() + unusedEntries, results.size() - unusedEntries, mode);
+ RefPtrWillBeRawPtr<ImmutableStylePropertySet> result = ImmutableStylePropertySet::create(results.data(), results.size(), mode);
parsedProperties.clear();
return result.release();
}

Powered by Google App Engine
This is Rietveld 408576698