Commit 43b2a3f1 authored by wibling@chromium.org's avatar wibling@chromium.org

Move all RefPtr's to CSSValue to oilpan transition types, except for the one...

Move all RefPtr's to CSSValue to oilpan transition types, except for the one in CSSCursorImageValue.

This change gets rid of all but one RefPtr to CSSValue. I have introduced a few persistents core/animation/..., core/css/StylePropertySet, and ElementStyleResources. I plan to attack the one in CSSCursorImageValue subsequently, and then change CSSValue from RefCountedGarbageCollected to GarbageCollectedFinalized.

R=ager@chromium.org, erik.corry@gmail.com, haraken@chromium.org, oilpan-reviews@chromium.org, tkent@chromium.org, vegorov@chromium.org, zerny@chromium.org
BUG=341815
NOTRY=true

Review URL: https://codereview.chromium.org/184313004

git-svn-id: svn://svn.chromium.org/blink/trunk@168466 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 36418cc2
...@@ -47,7 +47,7 @@ TEST(AnimationAnimatableNeutralTest, Create) ...@@ -47,7 +47,7 @@ TEST(AnimationAnimatableNeutralTest, Create)
TEST(AnimationAnimatableNeutralTest, Add) TEST(AnimationAnimatableNeutralTest, Add)
{ {
RefPtr<CSSValue> cssValue = CSSArrayFunctionValue::create(); RefPtrWillBeRawPtr<CSSValue> cssValue = CSSArrayFunctionValue::create();
RefPtr<AnimatableValue> animatableUnknown = AnimatableUnknown::create(cssValue); RefPtr<AnimatableValue> animatableUnknown = AnimatableUnknown::create(cssValue);
EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::add(animatableUnknown.get(), AnimatableValue::neutralValue()).get())->toCSSValue()); EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::add(animatableUnknown.get(), AnimatableValue::neutralValue()).get())->toCSSValue());
......
...@@ -41,7 +41,7 @@ class AnimatableUnknown FINAL : public AnimatableValue { ...@@ -41,7 +41,7 @@ class AnimatableUnknown FINAL : public AnimatableValue {
public: public:
virtual ~AnimatableUnknown() { } virtual ~AnimatableUnknown() { }
static PassRefPtr<AnimatableUnknown> create(PassRefPtr<CSSValue> value) static PassRefPtr<AnimatableUnknown> create(PassRefPtrWillBeRawPtr<CSSValue> value)
{ {
return adoptRef(new AnimatableUnknown(value)); return adoptRef(new AnimatableUnknown(value));
} }
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
return adoptRef(new AnimatableUnknown(cssValuePool().createIdentifierValue(value))); return adoptRef(new AnimatableUnknown(cssValuePool().createIdentifierValue(value)));
} }
PassRefPtr<CSSValue> toCSSValue() const { return m_value; } PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const { return m_value; }
CSSValueID toCSSValueID() const { return toCSSPrimitiveValue(m_value.get())->getValueID(); } CSSValueID toCSSValueID() const { return toCSSPrimitiveValue(m_value.get())->getValueID(); }
protected: protected:
...@@ -62,7 +62,7 @@ protected: ...@@ -62,7 +62,7 @@ protected:
virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVERRIDE { return true; } virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVERRIDE { return true; }
private: private:
explicit AnimatableUnknown(PassRefPtr<CSSValue> value) explicit AnimatableUnknown(PassRefPtrWillBeRawPtr<CSSValue> value)
: m_value(value) : m_value(value)
{ {
ASSERT(m_value); ASSERT(m_value);
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
virtual AnimatableType type() const OVERRIDE { return TypeUnknown; } virtual AnimatableType type() const OVERRIDE { return TypeUnknown; }
virtual bool equalTo(const AnimatableValue*) const OVERRIDE; virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
const RefPtr<CSSValue> m_value; const RefPtrWillBePersistent<CSSValue> m_value;
}; };
DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableUnknown, isUnknown()); DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableUnknown, isUnknown());
......
...@@ -51,10 +51,10 @@ protected: ...@@ -51,10 +51,10 @@ protected:
otherAnimatableUnknown = AnimatableUnknown::create(otherCSSValue); otherAnimatableUnknown = AnimatableUnknown::create(otherCSSValue);
} }
RefPtr<CSSValue> cssValue; RefPtrWillBePersistent<CSSValue> cssValue;
RefPtr<AnimatableValue> animatableUnknown; RefPtr<AnimatableValue> animatableUnknown;
RefPtr<CSSValue> otherCSSValue; RefPtrWillBePersistent<CSSValue> otherCSSValue;
RefPtr<AnimatableValue> otherAnimatableUnknown; RefPtr<AnimatableValue> otherAnimatableUnknown;
}; };
......
...@@ -47,7 +47,7 @@ CSSPropertyID StylePropertyMetadata::shorthandID() const ...@@ -47,7 +47,7 @@ CSSPropertyID StylePropertyMetadata::shorthandID() const
void CSSProperty::wrapValueInCommaSeparatedList() void CSSProperty::wrapValueInCommaSeparatedList()
{ {
RefPtr<CSSValue> value = m_value.release(); RefPtrWillBeRawPtr<CSSValue> value = m_value.release();
m_value = CSSValueList::createCommaSeparated(); m_value = CSSValueList::createCommaSeparated();
toCSSValueList(m_value.get())->append(value.release()); toCSSValueList(m_value.get())->append(value.release());
} }
......
...@@ -53,6 +53,7 @@ struct StylePropertyMetadata { ...@@ -53,6 +53,7 @@ struct StylePropertyMetadata {
}; };
class CSSProperty { class CSSProperty {
ALLOW_ONLY_INLINE_ALLOCATION();
public: public:
CSSProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value, bool important = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false) CSSProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value, bool important = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false)
: m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, important, implicit, isInheritedProperty(propertyID)) : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, important, implicit, isInheritedProperty(propertyID))
...@@ -81,9 +82,11 @@ public: ...@@ -81,9 +82,11 @@ public:
const StylePropertyMetadata& metadata() const { return m_metadata; } const StylePropertyMetadata& metadata() const { return m_metadata; }
void trace(Visitor* visitor) { visitor->trace(m_value); }
private: private:
StylePropertyMetadata m_metadata; StylePropertyMetadata m_metadata;
RefPtr<CSSValue> m_value; RefPtrWillBeMember<CSSValue> m_value;
}; };
inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId) inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId)
......
...@@ -224,34 +224,15 @@ private: ...@@ -224,34 +224,15 @@ private:
}; };
template<typename CSSValueType, size_t inlineCapacity> template<typename CSSValueType, size_t inlineCapacity>
inline bool compareCSSValueVector(const Vector<RefPtr<CSSValueType>, inlineCapacity>& firstVector, const Vector<RefPtr<CSSValueType>, inlineCapacity>& secondVector) inline bool compareCSSValueVector(const WillBeHeapVector<RefPtrWillBeMember<CSSValueType>, inlineCapacity>& firstVector, const WillBeHeapVector<RefPtrWillBeMember<CSSValueType>, inlineCapacity>& secondVector)
{ {
size_t size = firstVector.size(); size_t size = firstVector.size();
if (size != secondVector.size()) if (size != secondVector.size())
return false; return false;
for (size_t i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
const RefPtr<CSSValueType>& firstPtr = firstVector[i]; const RefPtrWillBeMember<CSSValueType>& firstPtr = firstVector[i];
const RefPtr<CSSValueType>& secondPtr = secondVector[i]; const RefPtrWillBeMember<CSSValueType>& secondPtr = secondVector[i];
if (firstPtr == secondPtr || (firstPtr && secondPtr && firstPtr->equals(*secondPtr)))
continue;
return false;
}
return true;
}
// FIXME: oilpan: this will be merged with the above compareCSSVector method
// once CSSValue is moved to the transition types.
template<typename CSSValueType, size_t inlineCapacity>
inline bool compareCSSValueVector(const HeapVector<Member<CSSValueType>, inlineCapacity>& firstVector, const HeapVector<Member<CSSValueType>, inlineCapacity>& secondVector)
{
size_t size = firstVector.size();
if (size != secondVector.size())
return false;
for (size_t i = 0; i < size; i++) {
const Member<CSSValueType>& firstPtr = firstVector[i];
const Member<CSSValueType>& secondPtr = secondVector[i];
if (firstPtr == secondPtr || (firstPtr && secondPtr && firstPtr->equals(*secondPtr))) if (firstPtr == secondPtr || (firstPtr && secondPtr && firstPtr->equals(*secondPtr)))
continue; continue;
return false; return false;
......
...@@ -53,7 +53,7 @@ bool CSSValueList::removeAll(CSSValue* val) ...@@ -53,7 +53,7 @@ bool CSSValueList::removeAll(CSSValue* val)
{ {
bool found = false; bool found = false;
for (size_t index = 0; index < m_values.size(); index++) { for (size_t index = 0; index < m_values.size(); index++) {
RefPtr<CSSValue>& value = m_values.at(index); RefPtrWillBeMember<CSSValue>& value = m_values.at(index);
if (value && val && value->equals(*val)) { if (value && val && value->equals(*val)) {
m_values.remove(index); m_values.remove(index);
found = true; found = true;
...@@ -66,7 +66,7 @@ bool CSSValueList::removeAll(CSSValue* val) ...@@ -66,7 +66,7 @@ bool CSSValueList::removeAll(CSSValue* val)
bool CSSValueList::hasValue(CSSValue* val) const bool CSSValueList::hasValue(CSSValue* val) const
{ {
for (size_t index = 0; index < m_values.size(); index++) { for (size_t index = 0; index < m_values.size(); index++) {
const RefPtr<CSSValue>& value = m_values.at(index); const RefPtrWillBeMember<CSSValue>& value = m_values.at(index);
if (value && val && value->equals(*val)) if (value && val && value->equals(*val))
return true; return true;
} }
...@@ -135,7 +135,7 @@ bool CSSValueList::equals(const CSSValue& other) const ...@@ -135,7 +135,7 @@ bool CSSValueList::equals(const CSSValue& other) const
if (m_values.size() != 1) if (m_values.size() != 1)
return false; return false;
const RefPtr<CSSValue>& value = m_values[0]; const RefPtrWillBeMember<CSSValue>& value = m_values[0];
return value && value->equals(other); return value && value->equals(other);
} }
...@@ -164,6 +164,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSValueList::cloneForCSSOM() const ...@@ -164,6 +164,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSValueList::cloneForCSSOM() const
void CSSValueList::traceAfterDispatch(Visitor* visitor) void CSSValueList::traceAfterDispatch(Visitor* visitor)
{ {
visitor->trace(m_values);
CSSValue::traceAfterDispatch(visitor); CSSValue::traceAfterDispatch(visitor);
} }
......
...@@ -53,8 +53,8 @@ public: ...@@ -53,8 +53,8 @@ public:
const CSSValue* item(size_t index) const { return index < m_values.size() ? m_values[index].get() : 0; } const CSSValue* item(size_t index) const { return index < m_values.size() ? m_values[index].get() : 0; }
CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); } CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); }
void append(PassRefPtr<CSSValue> value) { m_values.append(value); } void append(PassRefPtrWillBeRawPtr<CSSValue> value) { m_values.append(value); }
void prepend(PassRefPtr<CSSValue> value) { m_values.prepend(value); } void prepend(PassRefPtrWillBeRawPtr<CSSValue> value) { m_values.prepend(value); }
bool removeAll(CSSValue*); bool removeAll(CSSValue*);
bool hasValue(CSSValue*) const; bool hasValue(CSSValue*) const;
PassRefPtrWillBeRawPtr<CSSValueList> copy(); PassRefPtrWillBeRawPtr<CSSValueList> copy();
...@@ -77,7 +77,7 @@ private: ...@@ -77,7 +77,7 @@ private:
explicit CSSValueList(ValueListSeparator); explicit CSSValueList(ValueListSeparator);
explicit CSSValueList(CSSParserValueList*); explicit CSSValueList(CSSParserValueList*);
Vector<RefPtr<CSSValue>, 4> m_values; WillBeHeapVector<RefPtrWillBeMember<CSSValue>, 4> m_values;
}; };
DEFINE_CSS_VALUE_TYPE_CASTS(CSSValueList, isValueList()); DEFINE_CSS_VALUE_TYPE_CASTS(CSSValueList, isValueList());
......
...@@ -703,8 +703,8 @@ String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c ...@@ -703,8 +703,8 @@ String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c
String StylePropertySerializer::backgroundRepeatPropertyValue() const String StylePropertySerializer::backgroundRepeatPropertyValue() const
{ {
RefPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatX); RefPtrWillBeRawPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatX);
RefPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatY); RefPtrWillBeRawPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatY);
if (!repeatX || !repeatY) if (!repeatX || !repeatY)
return String(); return String();
if (repeatX->cssValueType() != repeatY->cssValueType()) if (repeatX->cssValueType() != repeatY->cssValueType())
...@@ -755,7 +755,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu ...@@ -755,7 +755,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
return; return;
} }
if (shorthandHasOnlyInitialOrInheritedValue(backgroundShorthand())) { if (shorthandHasOnlyInitialOrInheritedValue(backgroundShorthand())) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundImage); RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundImage);
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundImage); bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundImage);
result.append(getPropertyText(CSSPropertyBackground, value->cssText(), isImportant, numDecls++)); result.append(getPropertyText(CSSPropertyBackground, value->cssText(), isImportant, numDecls++));
return; return;
...@@ -773,7 +773,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu ...@@ -773,7 +773,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
for (unsigned i = 0; i < WTF_ARRAY_LENGTH(backgroundPropertyIds); ++i) { for (unsigned i = 0; i < WTF_ARRAY_LENGTH(backgroundPropertyIds); ++i) {
CSSPropertyID propertyID = backgroundPropertyIds[i]; CSSPropertyID propertyID = backgroundPropertyIds[i];
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(propertyID); RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(propertyID);
if (!value) if (!value)
continue; continue;
result.append(getPropertyText(propertyID, value->cssText(), m_propertySet.propertyIsImportant(propertyID), numDecls++)); result.append(getPropertyText(propertyID, value->cssText(), m_propertySet.propertyIsImportant(propertyID), numDecls++));
...@@ -784,7 +784,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu ...@@ -784,7 +784,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
// would not work in Firefox (<rdar://problem/5143183>) // would not work in Firefox (<rdar://problem/5143183>)
// It would be a better solution if background-position was CSS_PAIR. // It would be a better solution if background-position was CSS_PAIR.
if (shorthandHasOnlyInitialOrInheritedValue(backgroundPositionShorthand())) { if (shorthandHasOnlyInitialOrInheritedValue(backgroundPositionShorthand())) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX); RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX);
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX); bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX);
result.append(getPropertyText(CSSPropertyBackgroundPosition, value->cssText(), isImportant, numDecls++)); result.append(getPropertyText(CSSPropertyBackgroundPosition, value->cssText(), isImportant, numDecls++));
} else if (isPropertyShorthandAvailable(backgroundPositionShorthand())) { } else if (isPropertyShorthandAvailable(backgroundPositionShorthand())) {
...@@ -794,13 +794,13 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu ...@@ -794,13 +794,13 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
result.append(getPropertyText(CSSPropertyBackgroundPosition, positionValue, isImportant, numDecls++)); result.append(getPropertyText(CSSPropertyBackgroundPosition, positionValue, isImportant, numDecls++));
} else { } else {
// should check background-position-x or background-position-y. // should check background-position-x or background-position-y.
if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX)) { if (RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX)) {
if (!value->isImplicitInitialValue()) { if (!value->isImplicitInitialValue()) {
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX); bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX);
result.append(getPropertyText(CSSPropertyBackgroundPositionX, value->cssText(), isImportant, numDecls++)); result.append(getPropertyText(CSSPropertyBackgroundPositionX, value->cssText(), isImportant, numDecls++));
} }
} }
if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionY)) { if (RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionY)) {
if (!value->isImplicitInitialValue()) { if (!value->isImplicitInitialValue()) {
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionY); bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionY);
result.append(getPropertyText(CSSPropertyBackgroundPositionY, value->cssText(), isImportant, numDecls++)); result.append(getPropertyText(CSSPropertyBackgroundPositionY, value->cssText(), isImportant, numDecls++));
...@@ -819,7 +819,7 @@ bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertySh ...@@ -819,7 +819,7 @@ bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertySh
bool isImportant = m_propertySet.propertyIsImportant(shorthand.properties()[0]); bool isImportant = m_propertySet.propertyIsImportant(shorthand.properties()[0]);
for (unsigned i = 0; i < shorthand.length(); ++i) { for (unsigned i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]); RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value || (value->isInitialValue() && !value->isImplicitInitialValue()) || value->isInheritedValue()) if (!value || (value->isInitialValue() && !value->isImplicitInitialValue()) || value->isInheritedValue())
return false; return false;
if (isImportant != m_propertySet.propertyIsImportant(shorthand.properties()[i])) if (isImportant != m_propertySet.propertyIsImportant(shorthand.properties()[i]))
...@@ -835,7 +835,7 @@ bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const Styl ...@@ -835,7 +835,7 @@ bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const Styl
bool isInitialValue = true; bool isInitialValue = true;
bool isInheritedValue = true; bool isInheritedValue = true;
for (unsigned i = 0; i < shorthand.length(); ++i) { for (unsigned i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]); RefPtrWillBeRawPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value) if (!value)
return false; return false;
if (!value->isInitialValue()) if (!value->isInitialValue())
......
...@@ -319,7 +319,7 @@ void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S ...@@ -319,7 +319,7 @@ void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet);
} }
void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256>& properties) void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProperty, 256>& properties)
{ {
m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()); m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size());
for (unsigned i = 0; i < properties.size(); ++i) for (unsigned i = 0; i < properties.size(); ++i)
...@@ -419,7 +419,7 @@ bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un ...@@ -419,7 +419,7 @@ bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
for (unsigned i = 0; i < length; ++i) for (unsigned i = 0; i < length; ++i)
toRemove.add(set[i]); toRemove.add(set[i]);
Vector<CSSProperty> newProperties; WillBeHeapVector<CSSProperty> newProperties;
newProperties.reserveInitialCapacity(m_propertyVector.size()); newProperties.reserveInitialCapacity(m_propertyVector.size());
unsigned size = m_propertyVector.size(); unsigned size = m_propertyVector.size();
...@@ -489,7 +489,7 @@ PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const ...@@ -489,7 +489,7 @@ PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
{ {
Vector<CSSProperty, 256> list; WillBeHeapVector<CSSProperty, 256> list;
list.reserveInitialCapacity(properties.size()); list.reserveInitialCapacity(properties.size());
for (unsigned i = 0; i < properties.size(); ++i) { for (unsigned i = 0; i < properties.size(); ++i) {
RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]);
......
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
unsigned propertyCount() const { return m_propertyVector.size(); } unsigned propertyCount() const { return m_propertyVector.size(); }
void addParsedProperties(const Vector<CSSProperty, 256>&); void addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&);
void addParsedProperty(const CSSProperty&); void addParsedProperty(const CSSProperty&);
// These expand shorthand properties into multiple properties. // These expand shorthand properties into multiple properties.
...@@ -222,7 +222,7 @@ private: ...@@ -222,7 +222,7 @@ private:
friend class StylePropertySet; friend class StylePropertySet;
Vector<CSSProperty, 4> m_propertyVector; WillBePersistentHeapVector<CSSProperty, 4> m_propertyVector;
}; };
DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable(), set.isMutable()); DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable(), set.isMutable());
......
...@@ -1224,7 +1224,7 @@ PassRefPtrWillBeRawPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const ...@@ -1224,7 +1224,7 @@ PassRefPtrWillBeRawPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const
return m_mediaList.release(); return m_mediaList.release();
} }
static inline void filterProperties(bool important, const CSSPropertyParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties) static inline void filterProperties(bool important, const WillBeHeapVector<CSSProperty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties)
{ {
// Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
for (int i = input.size() - 1; i >= 0; --i) { for (int i = input.size() - 1; i >= 0; --i) {
...@@ -1243,7 +1243,7 @@ PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePropertySet() ...@@ -1243,7 +1243,7 @@ PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePropertySet()
{ {
BitArray<numCSSProperties> seenProperties; BitArray<numCSSProperties> seenProperties;
size_t unusedEntries = m_parsedProperties.size(); size_t unusedEntries = m_parsedProperties.size();
Vector<CSSProperty, 256> results(unusedEntries); WillBeHeapVector<CSSProperty, 256> results(unusedEntries);
// Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found. // Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found.
filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties); filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties);
......
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
OwnPtr<CSSParserValueList> m_valueList; OwnPtr<CSSParserValueList> m_valueList;
bool m_supportsCondition; bool m_supportsCondition;
CSSPropertyParser::ParsedPropertyVector m_parsedProperties; WillBePersistentHeapVector<CSSProperty, 256> m_parsedProperties;
CSSSelectorList* m_selectorListForParseSelector; CSSSelectorList* m_selectorListForParseSelector;
unsigned m_numParsedPropertiesBeforeMarginBox; unsigned m_numParsedPropertiesBeforeMarginBox;
......
...@@ -168,7 +168,7 @@ private: ...@@ -168,7 +168,7 @@ private:
CSSPropertyParser::CSSPropertyParser(OwnPtr<CSSParserValueList>& valueList, CSSPropertyParser::CSSPropertyParser(OwnPtr<CSSParserValueList>& valueList,
const CSSParserContext& context, bool inViewport, bool savedImportant, const CSSParserContext& context, bool inViewport, bool savedImportant,
ParsedPropertyVector& parsedProperties, bool& hasFontFaceOnlyValues) WillBeHeapVector<CSSProperty, 256>& parsedProperties, bool& hasFontFaceOnlyValues)
: m_valueList(valueList) : m_valueList(valueList)
, m_context(context) , m_context(context)
, m_inViewport(inViewport) , m_inViewport(inViewport)
......
...@@ -62,12 +62,11 @@ class UseCounter; ...@@ -62,12 +62,11 @@ class UseCounter;
// Outputs: Vector of CSSProperties // Outputs: Vector of CSSProperties
class CSSPropertyParser { class CSSPropertyParser {
STACK_ALLOCATED();
public: public:
typedef Vector<CSSProperty, 256> ParsedPropertyVector;
CSSPropertyParser(OwnPtr<CSSParserValueList>&, CSSPropertyParser(OwnPtr<CSSParserValueList>&,
const CSSParserContext&, bool inViewport, bool savedImportant, const CSSParserContext&, bool inViewport, bool savedImportant,
ParsedPropertyVector&, bool& hasFontFaceOnlyValues); WillBeHeapVector<CSSProperty, 256>&, bool& hasFontFaceOnlyValues);
~CSSPropertyParser(); ~CSSPropertyParser();
// FIXME: Should this be on a separate ColorParser object? // FIXME: Should this be on a separate ColorParser object?
...@@ -380,14 +379,14 @@ private: ...@@ -380,14 +379,14 @@ private:
const bool m_important; // FIXME: This is only used by font-face-src and unicode-range and undoubtably wrong! const bool m_important; // FIXME: This is only used by font-face-src and unicode-range and undoubtably wrong!
// Outputs: // Outputs:
ParsedPropertyVector& m_parsedProperties; WillBeHeapVector<CSSProperty, 256>& m_parsedProperties;
bool m_hasFontFaceOnlyValues; bool m_hasFontFaceOnlyValues;
// Locals during parsing: // Locals during parsing:
int m_inParseShorthand; int m_inParseShorthand;
CSSPropertyID m_currentShorthand; CSSPropertyID m_currentShorthand;
bool m_implicitShorthand; bool m_implicitShorthand;
RefPtrWillBePersistent<CSSCalcValue> m_parsedCalculation; RefPtrWillBeRawPtr<CSSCalcValue> m_parsedCalculation;
// FIXME: There is probably a small set of APIs we could expose for these // FIXME: There is probably a small set of APIs we could expose for these
// classes w/o needing to make them friends. // classes w/o needing to make them friends.
......
...@@ -67,7 +67,7 @@ Length animatableValueToLength(const AnimatableValue* value, const StyleResolver ...@@ -67,7 +67,7 @@ Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
{ {
if (value->isLength()) if (value->isLength())
return toAnimatableLength(value)->toLength(state.cssToLengthConversionData(), range); return toAnimatableLength(value)->toLength(state.cssToLengthConversionData(), range);
RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData()); return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData());
} }
...@@ -78,7 +78,7 @@ BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu ...@@ -78,7 +78,7 @@ BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu
return BorderImageLength(toAnimatableLength(value)->toLength(state.cssToLengthConversionData(), NonNegativeValues)); return BorderImageLength(toAnimatableLength(value)->toLength(state.cssToLengthConversionData(), NonNegativeValues));
if (value->isDouble()) if (value->isDouble())
return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDouble(), 0)); return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDouble(), 0));
RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData())); return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData()));
} }
......
...@@ -42,7 +42,7 @@ class StyleImage; ...@@ -42,7 +42,7 @@ class StyleImage;
class TextLinkColors; class TextLinkColors;
typedef WillBePersistentHeapHashMap<FilterOperation*, RefPtrWillBeMember<CSSSVGDocumentValue> > PendingSVGDocumentMap; typedef WillBePersistentHeapHashMap<FilterOperation*, RefPtrWillBeMember<CSSSVGDocumentValue> > PendingSVGDocumentMap;
typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap; typedef WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<CSSValue> > PendingImagePropertyMap;
// Holds information about resources, requested by stylesheets. // Holds information about resources, requested by stylesheets.
// Lifetime: per-element style resolve. // Lifetime: per-element style resolve.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment