| 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());
|
|
|
| - 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();
|
| }
|
|
|