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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; | 130 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; |
131 } else { | 131 } else { |
132 m_propertyVector.reserveInitialCapacity(other.propertyCount()); | 132 m_propertyVector.reserveInitialCapacity(other.propertyCount()); |
133 for (unsigned i = 0; i < other.propertyCount(); ++i) | 133 for (unsigned i = 0; i < other.propertyCount(); ++i) |
134 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); | 134 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const | 138 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const |
139 { | 139 { |
140 NullableCSSValue value = getPropertyCSSValue(propertyID); | 140 const NullableCSSValue& value = getPropertyCSSValue(propertyID); |
141 if (value) | 141 if (value) |
142 return value->cssText(); | 142 return value->cssText(); |
143 | 143 |
144 return StylePropertySerializer(*this).getPropertyValue(propertyID); | 144 return StylePropertySerializer(*this).getPropertyValue(propertyID); |
145 } | 145 } |
146 | 146 |
147 NullableCSSValue StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID)
const | 147 const NullableCSSValue StylePropertySet::getPropertyCSSValue(CSSPropertyID prope
rtyID) const |
148 { | 148 { |
149 int foundPropertyIndex = findPropertyIndex(propertyID); | 149 int foundPropertyIndex = findPropertyIndex(propertyID); |
150 if (foundPropertyIndex == -1) | 150 if (foundPropertyIndex == -1) |
151 return nullptr; | 151 return nullptr; |
152 return propertyAt(foundPropertyIndex).value(); | 152 return *reinterpret_cast<const NullableCSSValue*>(&propertyAt(foundPropertyI
ndex).value()); |
153 } | 153 } |
154 | 154 |
155 DEFINE_TRACE(StylePropertySet) | 155 DEFINE_TRACE(StylePropertySet) |
156 { | 156 { |
157 if (m_isMutable) | 157 if (m_isMutable) |
158 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); | 158 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); |
159 else | 159 else |
160 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); | 160 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); |
161 } | 161 } |
162 | 162 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::mutableCopy()
const | 432 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::mutableCopy()
const |
433 { | 433 { |
434 return adoptRefWillBeNoop(new MutableStylePropertySet(*this)); | 434 return adoptRefWillBeNoop(new MutableStylePropertySet(*this)); |
435 } | 435 } |
436 | 436 |
437 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyProperties
InSet(const Vector<CSSPropertyID>& properties) const | 437 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyProperties
InSet(const Vector<CSSPropertyID>& properties) const |
438 { | 438 { |
439 WillBeHeapVector<CSSProperty, 256> list; | 439 WillBeHeapVector<CSSProperty, 256> list; |
440 list.reserveInitialCapacity(properties.size()); | 440 list.reserveInitialCapacity(properties.size()); |
441 for (unsigned i = 0; i < properties.size(); ++i) { | 441 for (unsigned i = 0; i < properties.size(); ++i) { |
442 NullableCSSValue value = getPropertyCSSValue(properties[i]); | 442 const NullableCSSValue& value = getPropertyCSSValue(properties[i]); |
443 if (value) | 443 if (value) |
444 list.append(CSSProperty(properties[i], *value, false)); | 444 list.append(CSSProperty(properties[i], *value, false)); |
445 } | 445 } |
446 return MutableStylePropertySet::create(list.data(), list.size()); | 446 return MutableStylePropertySet::create(list.data(), list.size()); |
447 } | 447 } |
448 | 448 |
449 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() | 449 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
450 { | 450 { |
451 // FIXME: get rid of this weirdness of a CSSStyleDeclaration inside of a | 451 // FIXME: get rid of this weirdness of a CSSStyleDeclaration inside of a |
452 // style property set. | 452 // style property set. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 { | 513 { |
514 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode)); | 514 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode)); |
515 } | 515 } |
516 | 516 |
517 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
const CSSProperty* properties, unsigned count) | 517 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
const CSSProperty* properties, unsigned count) |
518 { | 518 { |
519 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count)); | 519 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count)); |
520 } | 520 } |
521 | 521 |
522 } // namespace blink | 522 } // namespace blink |
OLD | NEW |