OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 CSSStyleDeclaration* StyledElement::style() | 144 CSSStyleDeclaration* StyledElement::style() |
145 { | 145 { |
146 return ensureMutableInlineStyle()->ensureInlineCSSStyleDeclaration(this); | 146 return ensureMutableInlineStyle()->ensureInlineCSSStyleDeclaration(this); |
147 } | 147 } |
148 | 148 |
149 MutableStylePropertySet* StyledElement::ensureMutableInlineStyle() | 149 MutableStylePropertySet* StyledElement::ensureMutableInlineStyle() |
150 { | 150 { |
151 RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData()->m_inlineS
tyle; | 151 RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData()->m_inlineS
tyle; |
152 if (!inlineStyle) | 152 if (!inlineStyle) |
153 inlineStyle = StylePropertySet::create(strictToCSSParserMode(isHTMLEleme
nt() && !document()->inQuirksMode())); | 153 inlineStyle = MutableStylePropertySet::create(strictToCSSParserMode(isHT
MLElement() && !document()->inQuirksMode())); |
154 else if (!inlineStyle->isMutable()) | 154 else if (!inlineStyle->isMutable()) |
155 inlineStyle = inlineStyle->mutableCopy(); | 155 inlineStyle = inlineStyle->mutableCopy(); |
156 ASSERT(inlineStyle->isMutable()); | 156 ASSERT(inlineStyle->isMutable()); |
157 return static_cast<MutableStylePropertySet*>(inlineStyle.get()); | 157 return static_cast<MutableStylePropertySet*>(inlineStyle.get()); |
158 } | 158 } |
159 | 159 |
160 void StyledElement::attributeChanged(const QualifiedName& name, const AtomicStri
ng& newValue, AttributeModificationReason reason) | 160 void StyledElement::attributeChanged(const QualifiedName& name, const AtomicStri
ng& newValue, AttributeModificationReason reason) |
161 { | 161 { |
162 if (name == styleAttr) | 162 if (name == styleAttr) |
163 styleAttributeChanged(newValue, reason); | 163 styleAttributeChanged(newValue, reason); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (cacheIterator->value && cacheIterator->value->key != cacheKey) | 326 if (cacheIterator->value && cacheIterator->value->key != cacheKey) |
327 cacheHash = 0; | 327 cacheHash = 0; |
328 } else | 328 } else |
329 cacheIterator = presentationAttributeCache().end(); | 329 cacheIterator = presentationAttributeCache().end(); |
330 | 330 |
331 RefPtr<StylePropertySet> style; | 331 RefPtr<StylePropertySet> style; |
332 if (cacheHash && cacheIterator->value) { | 332 if (cacheHash && cacheIterator->value) { |
333 style = cacheIterator->value->value; | 333 style = cacheIterator->value->value; |
334 presentationAttributeCacheCleaner().didHitPresentationAttributeCache(); | 334 presentationAttributeCacheCleaner().didHitPresentationAttributeCache(); |
335 } else { | 335 } else { |
336 style = StylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSS
QuirksMode); | 336 style = MutableStylePropertySet::create(isSVGElement() ? SVGAttributeMod
e : CSSQuirksMode); |
337 unsigned size = attributeCount(); | 337 unsigned size = attributeCount(); |
338 for (unsigned i = 0; i < size; ++i) { | 338 for (unsigned i = 0; i < size; ++i) { |
339 const Attribute* attribute = attributeItem(i); | 339 const Attribute* attribute = attributeItem(i); |
340 collectStyleForPresentationAttribute(attribute->name(), attribute->v
alue(), static_cast<MutableStylePropertySet*>(style.get())); | 340 collectStyleForPresentationAttribute(attribute->name(), attribute->v
alue(), static_cast<MutableStylePropertySet*>(style.get())); |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 // ShareableElementData doesn't store presentation attribute style, so make
sure we have a UniqueElementData. | 344 // ShareableElementData doesn't store presentation attribute style, so make
sure we have a UniqueElementData. |
345 UniqueElementData* elementData = ensureUniqueElementData(); | 345 UniqueElementData* elementData = ensureUniqueElementData(); |
346 | 346 |
(...skipping 25 matching lines...) Expand all Loading... |
372 { | 372 { |
373 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); | 373 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); |
374 } | 374 } |
375 | 375 |
376 void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperty
Set* style, CSSPropertyID propertyID, const String& value) | 376 void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperty
Set* style, CSSPropertyID propertyID, const String& value) |
377 { | 377 { |
378 style->setProperty(propertyID, value, false, document()->elementSheet()->con
tents()); | 378 style->setProperty(propertyID, value, false, document()->elementSheet()->con
tents()); |
379 } | 379 } |
380 | 380 |
381 } | 381 } |
OLD | NEW |