Index: Source/core/css/StylePropertySet.cpp |
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp |
index 6a333f6651c74c93ae6c132b756039b17b4e69fc..96a40795f94253517b3ce2da4073c0b9aace3c53 100644 |
--- a/Source/core/css/StylePropertySet.cpp |
+++ b/Source/core/css/StylePropertySet.cpp |
@@ -94,6 +94,22 @@ ImmutableStylePropertySet::~ImmutableStylePropertySet() |
valueArray[i]->deref(); |
} |
+int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
+{ |
+ // Convert here propertyID into an uint16_t to compare it with the metadata's m_propertyID to avoid |
+ // the compiler converting it to an int multiple times in the loop. |
+ uint16_t id = static_cast<uint16_t>(propertyID); |
+ for (int n = m_arraySize - 1 ; n >= 0; --n) { |
+ if (metadataArray()[n].m_propertyID == id) { |
+ // Only enabled or internal properties should be part of the style. |
+ ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID)); |
+ return n; |
+ } |
+ } |
+ |
+ return -1; |
+} |
+ |
MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) |
: StylePropertySet(other.cssParserMode()) |
{ |
@@ -422,21 +438,6 @@ bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un |
return changed; |
} |
-int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
-{ |
- // Convert here propertyID into an uint16_t to compare it with the metadata's m_propertyID to avoid |
- // the compiler converting it to an int multiple times in the loop. |
- uint16_t id = static_cast<uint16_t>(propertyID); |
- for (int n = propertyCount() - 1 ; n >= 0; --n) { |
- if (id == propertyAt(n).propertyMetadata().m_propertyID) { |
- // Only enabled or internal properties should be part of the style. |
- ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID)); |
- return n; |
- } |
- } |
- return -1; |
-} |
- |
CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID propertyID) |
{ |
int foundPropertyIndex = findPropertyIndex(propertyID); |
@@ -511,6 +512,22 @@ CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
return m_cssomWrapper.get(); |
} |
+int MutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
+{ |
+ // Convert here propertyID into an uint16_t to compare it with the metadata's m_propertyID to avoid |
+ // the compiler converting it to an int multiple times in the loop. |
+ uint16_t id = static_cast<uint16_t>(propertyID); |
+ for (int n = m_propertyVector.size() - 1 ; n >= 0; --n) { |
+ if (m_propertyVector.at(n).metadata().m_propertyID == id) { |
+ // Only enabled or internal properties should be part of the style. |
+ ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID)); |
+ return n; |
+ } |
+ } |
+ |
+ return -1; |
+} |
+ |
unsigned StylePropertySet::averageSizeInBytes() |
{ |
// Please update this if the storage scheme changes so that this longer reflects the actual size. |