OLD | NEW |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 static String serializeShorthand(const StylePropertySet&, const AtomicString& cu
stomPropertyName) | 158 static String serializeShorthand(const StylePropertySet&, const AtomicString& cu
stomPropertyName) |
159 { | 159 { |
160 // Custom properties are never shorthands. | 160 // Custom properties are never shorthands. |
161 return ""; | 161 return ""; |
162 } | 162 } |
163 | 163 |
164 template<typename T> | 164 template<typename T> |
165 String StylePropertySet::getPropertyValue(T property) const | 165 String StylePropertySet::getPropertyValue(T property) const |
166 { | 166 { |
167 CSSValue* value = getPropertyCSSValue(property); | 167 const CSSValue* value = getPropertyCSSValue(property); |
168 if (value) | 168 if (value) |
169 return value->cssText(); | 169 return value->cssText(); |
170 return serializeShorthand(*this, property); | 170 return serializeShorthand(*this, property); |
171 } | 171 } |
172 template CORE_EXPORT String StylePropertySet::getPropertyValue<CSSPropertyID>(CS
SPropertyID) const; | 172 template CORE_EXPORT String StylePropertySet::getPropertyValue<CSSPropertyID>(CS
SPropertyID) const; |
173 template CORE_EXPORT String StylePropertySet::getPropertyValue<AtomicString>(Ato
micString) const; | 173 template CORE_EXPORT String StylePropertySet::getPropertyValue<AtomicString>(Ato
micString) const; |
174 | 174 |
175 template<typename T> | 175 template<typename T> |
176 CSSValue* StylePropertySet::getPropertyCSSValue(T property) const | 176 const CSSValue* StylePropertySet::getPropertyCSSValue(T property) const |
177 { | 177 { |
178 int foundPropertyIndex = findPropertyIndex(property); | 178 int foundPropertyIndex = findPropertyIndex(property); |
179 if (foundPropertyIndex == -1) | 179 if (foundPropertyIndex == -1) |
180 return nullptr; | 180 return nullptr; |
181 return propertyAt(foundPropertyIndex).value(); | 181 return propertyAt(foundPropertyIndex).value(); |
182 } | 182 } |
183 template CORE_EXPORT CSSValue* StylePropertySet::getPropertyCSSValue<CSSProperty
ID>(CSSPropertyID) const; | 183 template CORE_EXPORT const CSSValue* StylePropertySet::getPropertyCSSValue<CSSPr
opertyID>(CSSPropertyID) const; |
184 template CORE_EXPORT CSSValue* StylePropertySet::getPropertyCSSValue<AtomicStrin
g>(AtomicString) const; | 184 template CORE_EXPORT const CSSValue* StylePropertySet::getPropertyCSSValue<Atomi
cString>(AtomicString) const; |
185 | 185 |
186 DEFINE_TRACE(StylePropertySet) | 186 DEFINE_TRACE(StylePropertySet) |
187 { | 187 { |
188 if (m_isMutable) | 188 if (m_isMutable) |
189 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); | 189 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); |
190 else | 190 else |
191 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); | 191 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); |
192 } | 192 } |
193 | 193 |
194 void StylePropertySet::finalizeGarbageCollectedObject() | 194 void StylePropertySet::finalizeGarbageCollectedObject() |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 MutableStylePropertySet* StylePropertySet::mutableCopy() const | 494 MutableStylePropertySet* StylePropertySet::mutableCopy() const |
495 { | 495 { |
496 return new MutableStylePropertySet(*this); | 496 return new MutableStylePropertySet(*this); |
497 } | 497 } |
498 | 498 |
499 MutableStylePropertySet* StylePropertySet::copyPropertiesInSet(const Vector<CSSP
ropertyID>& properties) const | 499 MutableStylePropertySet* StylePropertySet::copyPropertiesInSet(const Vector<CSSP
ropertyID>& properties) const |
500 { | 500 { |
501 HeapVector<CSSProperty, 256> list; | 501 HeapVector<CSSProperty, 256> list; |
502 list.reserveInitialCapacity(properties.size()); | 502 list.reserveInitialCapacity(properties.size()); |
503 for (unsigned i = 0; i < properties.size(); ++i) { | 503 for (unsigned i = 0; i < properties.size(); ++i) { |
504 CSSValue* value = getPropertyCSSValue(properties[i]); | 504 const CSSValue* value = getPropertyCSSValue(properties[i]); |
505 if (value) | 505 if (value) |
506 list.append(CSSProperty(properties[i], *value, false)); | 506 list.append(CSSProperty(properties[i], *value, false)); |
507 } | 507 } |
508 return MutableStylePropertySet::create(list.data(), list.size()); | 508 return MutableStylePropertySet::create(list.data(), list.size()); |
509 } | 509 } |
510 | 510 |
511 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() | 511 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
512 { | 512 { |
513 // FIXME: get rid of this weirdness of a CSSStyleDeclaration inside of a | 513 // FIXME: get rid of this weirdness of a CSSStyleDeclaration inside of a |
514 // style property set. | 514 // style property set. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |