Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Unified Diff: Source/core/css/StylePropertySet.cpp

Issue 16161005: Reduce CSSProperty's StylePropertyMetadata memory footprint by half when used inside a ImmutableSty… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/StylePropertySet.cpp
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
index 3ae5c7ff49385b3ac4ce583e91f063ec13d9867f..c1cbe8b73fb70d80d0038df55816da455992ad99 100644
--- a/Source/core/css/StylePropertySet.cpp
+++ b/Source/core/css/StylePropertySet.cpp
@@ -258,21 +258,32 @@ void MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper
appendPrefixingVariantProperty(property);
}
+unsigned getShorthandIDForPrefixingVariant(const CSSProperty& property, CSSPropertyID prefixingVariant)
+{
+ unsigned shorthandID = 0;
+ if (property.isSetFromShorthand()) {
+ CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property.shorthandID());
+ shorthandID = indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForLonghand(prefixingVariant));
+ }
+ return 0;
+}
+
void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
{
m_propertyVector.append(property);
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
if (prefixingVariant == property.id())
return;
- m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit));
+
+ m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getShorthandIDForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit));
}
void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& property)
{
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
- if (toReplace)
- *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit);
+ if (toReplace && prefixingVariant != property.id())
+ *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getShorthandIDForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit);
}
bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID identifier, bool important)

Powered by Google App Engine
This is Rietveld 408576698