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

Side by Side Diff: Source/core/css/StylePropertySet.cpp

Issue 16021003: Move StylePropertySet::createImmutable() to ImmutableStylePropertySet. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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') | no next file » | 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 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 { 49 {
50 DEFINE_STATIC_LOCAL(PropertySetCSSOMWrapperMap, propertySetCSSOMWrapperMapIn stance, ()); 50 DEFINE_STATIC_LOCAL(PropertySetCSSOMWrapperMap, propertySetCSSOMWrapperMapIn stance, ());
51 return propertySetCSSOMWrapperMapInstance; 51 return propertySetCSSOMWrapperMapInstance;
52 } 52 }
53 53
54 static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) 54 static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count)
55 { 55 {
56 return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count; 56 return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count;
57 } 57 }
58 58
59 PassRefPtr<StylePropertySet> StylePropertySet::createImmutable(const CSSProperty * properties, unsigned count, CSSParserMode cssParserMode) 59 PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CS SProperty* properties, unsigned count, CSSParserMode cssParserMode)
60 { 60 {
61 void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCou nt(count)); 61 void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCou nt(count));
62 return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssP arserMode)); 62 return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssP arserMode));
63 } 63 }
64 64
65 PassRefPtr<StylePropertySet> StylePropertySet::immutableCopyIfNeeded() const 65 PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() const
66 { 66 {
67 if (!isMutable()) 67 if (!isMutable())
68 return const_cast<StylePropertySet*>(this); 68 return static_cast<ImmutableStylePropertySet*>(const_cast<StylePropertyS et*>(this));
69 return createImmutable(mutablePropertyVector().data(), mutablePropertyVector ().size(), cssParserMode()); 69 return ImmutableStylePropertySet::create(mutablePropertyVector().data(), mut ablePropertyVector().size(), cssParserMode());
70 } 70 }
71 71
72 MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length) 72 MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length)
73 : StylePropertySet(CSSStrictMode) 73 : StylePropertySet(CSSStrictMode)
74 { 74 {
75 m_propertyVector.reserveInitialCapacity(length); 75 m_propertyVector.reserveInitialCapacity(length);
76 for (unsigned i = 0; i < length; ++i) 76 for (unsigned i = 0; i < length; ++i)
77 m_propertyVector.uncheckedAppend(properties[i]); 77 m_propertyVector.uncheckedAppend(properties[i]);
78 } 78 }
79 79
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 result.appendLiteral(": "); 602 result.appendLiteral(": ");
603 result.append(propertyValue()->cssText()); 603 result.append(propertyValue()->cssText());
604 if (isImportant()) 604 if (isImportant())
605 result.appendLiteral(" !important"); 605 result.appendLiteral(" !important");
606 result.append(';'); 606 result.append(';');
607 return result.toString(); 607 return result.toString();
608 } 608 }
609 609
610 610
611 } // namespace WebCore 611 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698