| Index: Source/core/css/StylePropertySet.cpp
|
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
|
| index e7b588b4bb69e3459690728e2bdf7208d76414d5..31d50240115c5efa99933b819243c7c8cc528be3 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,24 +81,20 @@ 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();
|
| -#if !ENABLE(OILPAN)
|
| - valueArray[i]->ref();
|
| -#endif
|
| + // Can't use operator= here since the valueArray[i] is an invalid CSSValue.
|
| + new(&valueArray[i]) CSSValue(properties[i].value());
|
| }
|
| }
|
|
|
| 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();
|
| + valueArray[i].~CSSValue();
|
| }
|
| #endif
|
| }
|
| @@ -121,7 +117,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 +137,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 +196,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 +250,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 +260,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 +338,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;
|
| @@ -392,12 +388,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)
|
| @@ -438,9 +434,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());
|
| }
|
|
|