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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id ()); 251 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id ());
252 if (toReplace) { 252 if (toReplace) {
253 *toReplace = property; 253 *toReplace = property;
254 setPrefixingVariantProperty(property); 254 setPrefixingVariantProperty(property);
255 return; 255 return;
256 } 256 }
257 } 257 }
258 appendPrefixingVariantProperty(property); 258 appendPrefixingVariantProperty(property);
259 } 259 }
260 260
261 unsigned getShorthandIDForPrefixingVariant(const CSSProperty& property, CSSPrope rtyID prefixingVariant)
262 {
263 unsigned shorthandID = 0;
264 if (property.isSetFromShorthand()) {
265 CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property .shorthandID());
266 shorthandID = indexOfShorthandForLonghand(prefixedShorthand, matchingSho rthandsForLonghand(prefixingVariant));
Julien - ping for review 2013/06/14 17:38:27 shorthandID is not used (only written to but never
267 }
268 return 0;
269 }
270
261 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) 271 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
262 { 272 {
263 m_propertyVector.append(property); 273 m_propertyVector.append(property);
264 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() ); 274 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() );
265 if (prefixingVariant == property.id()) 275 if (prefixingVariant == property.id())
266 return; 276 return;
267 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), prop erty.isImportant(), property.shorthandID(), property.metadata().m_implicit)); 277
278 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), prop erty.isImportant(), property.isSetFromShorthand(), getShorthandIDForPrefixingVar iant(property, prefixingVariant), property.metadata().m_implicit));
268 } 279 }
269 280
270 void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& pro perty) 281 void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& pro perty)
271 { 282 {
272 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() ); 283 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() );
273 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant); 284 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
274 if (toReplace) 285 if (toReplace && prefixingVariant != property.id())
275 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is Important(), property.shorthandID(), property.metadata().m_implicit); 286 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is Important(), property.isSetFromShorthand(), getShorthandIDForPrefixingVariant(pr operty, prefixingVariant), property.metadata().m_implicit);
276 } 287 }
277 288
278 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID i dentifier, bool important) 289 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID i dentifier, bool important)
279 { 290 {
280 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide ntifier), important)); 291 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide ntifier), important));
281 return true; 292 return true;
282 } 293 }
283 294
284 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSPropertyI D identifier, bool important) 295 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSPropertyI D identifier, bool important)
285 { 296 {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 result.appendLiteral(": "); 607 result.appendLiteral(": ");
597 result.append(propertyValue()->cssText()); 608 result.append(propertyValue()->cssText());
598 if (isImportant()) 609 if (isImportant())
599 result.appendLiteral(" !important"); 610 result.appendLiteral(" !important");
600 result.append(';'); 611 result.append(';');
601 return result.toString(); 612 return result.toString();
602 } 613 }
603 614
604 615
605 } // namespace WebCore 616 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698