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

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
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/StylePropertyShorthand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 getIndexInShorthandVectorForPrefixingVariant(const CSSProperty& propert y, CSSPropertyID prefixingVariant)
262 {
263 if (!property.isSetFromShorthand())
264 return 0;
265
266 CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property.sho rthandID());
267 return indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForL onghand(prefixingVariant));
268 }
269
261 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) 270 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
262 { 271 {
263 m_propertyVector.append(property); 272 m_propertyVector.append(property);
264 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() ); 273 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() );
265 if (prefixingVariant == property.id()) 274 if (prefixingVariant == property.id())
266 return; 275 return;
267 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), prop erty.isImportant(), property.shorthandID(), property.metadata().m_implicit)); 276
277 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), prop erty.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForP refixingVariant(property, prefixingVariant), property.metadata().m_implicit));
268 } 278 }
269 279
270 void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& pro perty) 280 void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& pro perty)
271 { 281 {
272 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() ); 282 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() );
273 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant); 283 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
274 if (toReplace) 284 if (toReplace && prefixingVariant != property.id())
275 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is Important(), property.shorthandID(), property.metadata().m_implicit); 285 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is Important(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixin gVariant(property, prefixingVariant), property.metadata().m_implicit);
276 } 286 }
277 287
278 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID i dentifier, bool important) 288 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID i dentifier, bool important)
279 { 289 {
280 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide ntifier), important)); 290 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide ntifier), important));
281 return true; 291 return true;
282 } 292 }
283 293
284 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSPropertyI D identifier, bool important) 294 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSPropertyI D identifier, bool important)
285 { 295 {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 result.appendLiteral(": "); 606 result.appendLiteral(": ");
597 result.append(propertyValue()->cssText()); 607 result.append(propertyValue()->cssText());
598 if (isImportant()) 608 if (isImportant())
599 result.appendLiteral(" !important"); 609 result.appendLiteral(" !important");
600 result.append(';'); 610 result.append(';');
601 return result.toString(); 611 return result.toString();
602 } 612 }
603 613
604 614
605 } // namespace WebCore 615 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/StylePropertyShorthand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698