Index: Source/core/css/StylePropertySet.cpp |
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp |
index d0da61710b52cdd6d624c5a5fc789e20ce727e02..167529644d5379e6890d6ddcbe815dd659f1d957 100644 |
--- a/Source/core/css/StylePropertySet.cpp |
+++ b/Source/core/css/StylePropertySet.cpp |
@@ -42,7 +42,7 @@ namespace blink { |
static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) |
{ |
- return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count; |
+ return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue) * count + sizeof(StylePropertyMetadata) * count; |
} |
PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode) |
@@ -81,12 +81,12 @@ ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti |
: StylePropertySet(cssParserMode, length) |
{ |
StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(this->metadataArray()); |
- RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSSValue>*>(this->valueArray()); |
+ CSSValue* valueArray = const_cast<CSSValue*>(this->valueArray()); |
for (unsigned i = 0; i < m_arraySize; ++i) { |
metadataArray[i] = properties[i].metadata(); |
- valueArray[i] = properties[i].value(); |
+ new(&valueArray[i]) CSSValue(properties[i].value()); |
#if !ENABLE(OILPAN) |
- valueArray[i]->ref(); |
+ valueArray[i].ref(); |
#endif |
} |
} |
@@ -94,11 +94,10 @@ ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti |
ImmutableStylePropertySet::~ImmutableStylePropertySet() |
{ |
#if !ENABLE(OILPAN) |
- RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSSValue>*>(this->valueArray()); |
+ CSSValue* valueArray = const_cast<CSSValue*>(this->valueArray()); |
for (unsigned i = 0; i < m_arraySize; ++i) { |
- // Checking for nullptr here is a workaround to prevent crashing. http://crbug.com/449032 |
- if (valueArray[i]) |
- valueArray[i]->deref(); |
+ // TODO: Check if this fixes http://crbug.com/449032 |
+ valueArray[i].deref(); |
} |
#endif |
} |
@@ -121,7 +120,7 @@ int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) |
{ |
- const RawPtrWillBeMember<CSSValue>* values = valueArray(); |
+ const CSSValue* values = valueArray(); |
for (unsigned i = 0; i < m_arraySize; i++) |
visitor->trace(values[i]); |
StylePropertySet::traceAfterDispatch(visitor); |
@@ -141,14 +140,14 @@ MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) |
String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const |
{ |
- RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID); |
+ NullableCSSValue value = getPropertyCSSValue(propertyID); |
if (value) |
return value->cssText(); |
return StylePropertySerializer(*this).getPropertyValue(propertyID); |
} |
-PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const |
+NullableCSSValue StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const |
{ |
int foundPropertyIndex = findPropertyIndex(propertyID); |
if (foundPropertyIndex == -1) |
@@ -200,7 +199,7 @@ bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* r |
} |
if (returnText) |
- *returnText = propertyAt(foundPropertyIndex).value()->cssText(); |
+ *returnText = propertyAt(foundPropertyIndex).value().cssText(); |
// A more efficient removal strategy would involve marking entries as empty |
// and sweeping them when the vector grows too big. |
@@ -254,7 +253,7 @@ bool MutableStylePropertySet::setProperty(CSSPropertyID unresolvedProperty, cons |
return CSSParser::parseValue(this, unresolvedProperty, value, important, cssParserMode(), contextStyleSheet); |
} |
-void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> prpValue, bool important) |
+void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValue prpValue, bool important) |
{ |
StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
if (!shorthand.length()) { |
@@ -264,7 +263,7 @@ void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi |
removePropertiesInSet(shorthand.properties(), shorthand.length()); |
- RefPtrWillBeRawPtr<CSSValue> value = prpValue; |
+ CSSValue value = prpValue; |
for (unsigned i = 0; i < shorthand.length(); ++i) |
m_propertyVector.append(CSSProperty(shorthand.properties()[i], value, important)); |
} |
@@ -342,7 +341,7 @@ bool StylePropertySet::hasFailedOrCanceledSubresources() const |
{ |
unsigned size = propertyCount(); |
for (unsigned i = 0; i < size; ++i) { |
- if (propertyAt(i).value()->hasFailedOrCanceledSubresources()) |
+ if (propertyAt(i).value().hasFailedOrCanceledSubresources()) |
return true; |
} |
return false; |
@@ -434,12 +433,12 @@ CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID proper |
return &m_propertyVector.at(foundPropertyIndex); |
} |
-bool StylePropertySet::propertyMatches(CSSPropertyID propertyID, const CSSValue* propertyValue) const |
+bool StylePropertySet::propertyMatches(CSSPropertyID propertyID, const CSSValue propertyValue) const |
{ |
int foundPropertyIndex = findPropertyIndex(propertyID); |
if (foundPropertyIndex == -1) |
return false; |
- return propertyAt(foundPropertyIndex).value()->equals(*propertyValue); |
+ return propertyAt(foundPropertyIndex).value().equals(propertyValue); |
} |
void MutableStylePropertySet::removeEquivalentProperties(const StylePropertySet* style) |
@@ -480,9 +479,9 @@ PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyProperties |
WillBeHeapVector<CSSProperty, 256> list; |
list.reserveInitialCapacity(properties.size()); |
for (unsigned i = 0; i < properties.size(); ++i) { |
- RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); |
+ NullableCSSValue value = getPropertyCSSValue(properties[i]); |
if (value) |
- list.append(CSSProperty(properties[i], value.release(), false)); |
+ list.append(CSSProperty(properties[i], *value, false)); |
} |
return MutableStylePropertySet::create(list.data(), list.size()); |
} |