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

Side by Side Diff: Source/core/dom/StyledElement.cpp

Issue 15864004: Move create() methods from StylePropertySet to MutableStylePropertySet. (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/dom/Document.cpp ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | 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 * 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
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698