| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/CSSParserImpl.h" | 6 #include "core/css/parser/CSSParserImpl.h" |
| 7 | 7 |
| 8 #include "core/css/CSSCustomPropertyDeclaration.h" | 8 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 9 #include "core/css/CSSKeyframesRule.h" | 9 #include "core/css/CSSKeyframesRule.h" |
| 10 #include "core/css/CSSStyleSheet.h" | 10 #include "core/css/CSSStyleSheet.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return declaration->addParsedProperties(parser.m_parsedProperties); | 51 return declaration->addParsedProperties(parser.m_parsedProperties); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static inline void filterProperties(bool important, const WillBeHeapVector<CSSPr
operty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedE
ntries, BitArray<numCSSProperties>& seenProperties) | 54 static inline void filterProperties(bool important, const WillBeHeapVector<CSSPr
operty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedE
ntries, BitArray<numCSSProperties>& seenProperties) |
| 55 { | 55 { |
| 56 // Add properties in reverse order so that highest priority definitions are
reached first. Duplicate definitions can then be ignored when found. | 56 // Add properties in reverse order so that highest priority definitions are
reached first. Duplicate definitions can then be ignored when found. |
| 57 for (size_t i = input.size(); i--; ) { | 57 for (size_t i = input.size(); i--; ) { |
| 58 const CSSProperty& property = input[i]; | 58 const CSSProperty& property = input[i]; |
| 59 if (property.isImportant() != important) | 59 if (property.isImportant() != important) |
| 60 continue; | 60 continue; |
| 61 const unsigned propertyIDIndex = property.id(); | 61 const unsigned propertyIDIndex = property.id() - firstCSSProperty; |
| 62 // All custom properties use the same CSSPropertyID so we can't remove r
epeated definitions | 62 // All custom properties use the same CSSPropertyID so we can't remove r
epeated definitions |
| 63 if (property.id() != CSSPropertyVariable) { | 63 if (property.id() != CSSPropertyVariable) { |
| 64 if (seenProperties.get(propertyIDIndex)) | 64 if (seenProperties.get(propertyIDIndex)) |
| 65 continue; | 65 continue; |
| 66 seenProperties.set(propertyIDIndex); | 66 seenProperties.set(propertyIDIndex); |
| 67 } | 67 } |
| 68 output[--unusedEntries] = property; | 68 output[--unusedEntries] = property; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 else | 747 else |
| 748 return nullptr; // Parser error, invalid value in keyframe selector | 748 return nullptr; // Parser error, invalid value in keyframe selector |
| 749 if (range.atEnd()) | 749 if (range.atEnd()) |
| 750 return result.release(); | 750 return result.release(); |
| 751 if (range.consume().type() != CommaToken) | 751 if (range.consume().type() != CommaToken) |
| 752 return nullptr; // Parser error | 752 return nullptr; // Parser error |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 | 755 |
| 756 } // namespace blink | 756 } // namespace blink |
| OLD | NEW |