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

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

Issue 2032613007: Change ImmutableStylePropertySet to store const CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@+make_elementstyleresources_store_const
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/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, 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 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 { 70 {
71 m_propertyVector.reserveInitialCapacity(length); 71 m_propertyVector.reserveInitialCapacity(length);
72 for (unsigned i = 0; i < length; ++i) 72 for (unsigned i = 0; i < length; ++i)
73 m_propertyVector.uncheckedAppend(properties[i]); 73 m_propertyVector.uncheckedAppend(properties[i]);
74 } 74 }
75 75
76 ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti es, unsigned length, CSSParserMode cssParserMode) 76 ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti es, unsigned length, CSSParserMode cssParserMode)
77 : StylePropertySet(cssParserMode, length) 77 : StylePropertySet(cssParserMode, length)
78 { 78 {
79 StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(th is->metadataArray()); 79 StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(th is->metadataArray());
80 Member<CSSValue>* valueArray = const_cast<Member<CSSValue>*>(this->valueArra y()); 80 Member<const CSSValue>* valueArray = const_cast<Member<const CSSValue>*>(thi s->valueArray());
81 for (unsigned i = 0; i < m_arraySize; ++i) { 81 for (unsigned i = 0; i < m_arraySize; ++i) {
82 metadataArray[i] = properties[i].metadata(); 82 metadataArray[i] = properties[i].metadata();
83 valueArray[i] = properties[i].value(); 83 valueArray[i] = properties[i].value();
84 } 84 }
85 } 85 }
86 86
87 ImmutableStylePropertySet::~ImmutableStylePropertySet() 87 ImmutableStylePropertySet::~ImmutableStylePropertySet()
88 { 88 {
89 } 89 }
90 90
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return n; 125 return n;
126 } 126 }
127 127
128 return -1; 128 return -1;
129 } 129 }
130 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex(CSSPropert yID) const; 130 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex(CSSPropert yID) const;
131 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex(AtomicStri ng) const; 131 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex(AtomicStri ng) const;
132 132
133 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) 133 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet)
134 { 134 {
135 const Member<CSSValue>* values = valueArray(); 135 const Member<const CSSValue>* values = valueArray();
136 for (unsigned i = 0; i < m_arraySize; i++) 136 for (unsigned i = 0; i < m_arraySize; i++)
137 visitor->trace(values[i]); 137 visitor->trace(values[i]);
138 StylePropertySet::traceAfterDispatch(visitor); 138 StylePropertySet::traceAfterDispatch(visitor);
139 } 139 }
140 140
141 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) 141 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other)
142 : StylePropertySet(other.cssParserMode()) 142 : StylePropertySet(other.cssParserMode())
143 { 143 {
144 if (other.isMutable()) { 144 if (other.isMutable()) {
145 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; 145 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 { 568 {
569 return new MutableStylePropertySet(cssParserMode); 569 return new MutableStylePropertySet(cssParserMode);
570 } 570 }
571 571
572 MutableStylePropertySet* MutableStylePropertySet::create(const CSSProperty* prop erties, unsigned count) 572 MutableStylePropertySet* MutableStylePropertySet::create(const CSSProperty* prop erties, unsigned count)
573 { 573 {
574 return new MutableStylePropertySet(properties, count); 574 return new MutableStylePropertySet(properties, count);
575 } 575 }
576 576
577 } // namespace blink 577 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698