Changeset 106681 in webkit
- Timestamp:
- Feb 3, 2012 11:46:48 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106680 r106681 1 2012-02-03 Antti Koivisto <antti@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=77740 4 Split CSSMutableStyleDeclaration into separate internal and CSSOM types 5 6 Reviewed by Andreas Kling and Darin Adler. 7 8 Split the CSSMutableStyleDeclaration into an internal type (StylePropertySet) and a CSSOM implementation type (PropertySetCSSStyleDeclaration). 9 10 To keep things somewhat manageable, this patch does NOT 11 12 - rename or add any files (so files names won't match types) 13 - rename fields, methods or variables to match new type names (like CSSStyleRule::declaration() -> CSSStyleRule::propertySet()) 14 - try to realize any memory or performance gains (StylePropertySet loses the vptr but gains PropertySetCSSStyleDeclaration*) 15 16 * WebCore.exp.in: 17 * css/CSSComputedStyleDeclaration.cpp: 18 (WebCore::CSSComputedStyleDeclaration::copy): 19 (WebCore::CSSComputedStyleDeclaration::makeMutable): 20 (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): 21 * css/CSSComputedStyleDeclaration.h: 22 (WebCore): 23 (CSSComputedStyleDeclaration): 24 * css/CSSFontFaceRule.h: 25 (WebCore::CSSFontFaceRule::style): 26 (WebCore::CSSFontFaceRule::declaration): 27 (WebCore::CSSFontFaceRule::setDeclaration): 28 (CSSFontFaceRule): 29 * css/CSSFontSelector.cpp: 30 (WebCore::CSSFontSelector::addFontFaceRule): 31 * css/CSSMutableStyleDeclaration.cpp: 32 (PropertySetCSSStyleDeclaration): 33 (WebCore::PropertySetCSSStyleDeclaration::create): 34 (WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration): 35 (WebCore): 36 (WebCore::StylePropertySet::StylePropertySet): 37 (WebCore::StylePropertySet::~StylePropertySet): 38 (WebCore::StylePropertySet::deref): 39 (WebCore::StylePropertySet::contextStyleSheet): 40 (WebCore::StylePropertySet::copyPropertiesFrom): 41 (WebCore::StylePropertySet::getPropertyValue): 42 (WebCore::StylePropertySet::borderSpacingValue): 43 (WebCore::StylePropertySet::appendFontLonghandValueIfExplicit): 44 (WebCore::StylePropertySet::fontValue): 45 (WebCore::StylePropertySet::get4Values): 46 (WebCore::StylePropertySet::getLayeredShorthandValue): 47 (WebCore::StylePropertySet::getShorthandValue): 48 (WebCore::StylePropertySet::getCommonValue): 49 (WebCore::StylePropertySet::getPropertyCSSValue): 50 (WebCore::StylePropertySet::removeShorthandProperty): 51 (WebCore::StylePropertySet::removeProperty): 52 (WebCore::StylePropertySet::setNeedsStyleRecalc): 53 (WebCore::StylePropertySet::propertyIsImportant): 54 (WebCore::StylePropertySet::getPropertyShorthand): 55 (WebCore::StylePropertySet::isPropertyImplicit): 56 (WebCore::StylePropertySet::setProperty): 57 (WebCore::StylePropertySet::parseDeclaration): 58 (WebCore::StylePropertySet::addParsedProperties): 59 (WebCore::StylePropertySet::addParsedProperty): 60 (WebCore::StylePropertySet::asText): 61 (WebCore::StylePropertySet::merge): 62 (WebCore::StylePropertySet::addSubresourceStyleURLs): 63 (WebCore::StylePropertySet::copyBlockProperties): 64 (WebCore::StylePropertySet::removeBlockProperties): 65 (WebCore::StylePropertySet::removePropertiesInSet): 66 (WebCore::StylePropertySet::findPropertyWithId): 67 (WebCore::StylePropertySet::propertyMatches): 68 (WebCore::StylePropertySet::removeEquivalentProperties): 69 (WebCore::StylePropertySet::copy): 70 (WebCore::StylePropertySet::copyPropertiesInSet): 71 (WebCore::StylePropertySet::ensureCSSStyleDeclaration): 72 (WebCore::PropertySetCSSStyleDeclaration::length): 73 (WebCore::PropertySetCSSStyleDeclaration::item): 74 (WebCore::PropertySetCSSStyleDeclaration::parentRule): 75 (WebCore::PropertySetCSSStyleDeclaration::cssText): 76 (WebCore::PropertySetCSSStyleDeclaration::setCssText): 77 (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): 78 (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue): 79 (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): 80 (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand): 81 (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit): 82 (WebCore::PropertySetCSSStyleDeclaration::setProperty): 83 (WebCore::PropertySetCSSStyleDeclaration::removeProperty): 84 (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): 85 (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal): 86 (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): 87 (WebCore::PropertySetCSSStyleDeclaration::parentStyleSheet): 88 (WebCore::PropertySetCSSStyleDeclaration::copy): 89 (WebCore::PropertySetCSSStyleDeclaration::makeMutable): 90 (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches): 91 * css/CSSMutableStyleDeclaration.h: 92 (WebCore): 93 (StylePropertySet): 94 (WebCore::StylePropertySet::create): 95 (WebCore::StylePropertySet::createInline): 96 * css/CSSPageRule.h: 97 (WebCore): 98 * css/CSSParser.cpp: 99 (WebCore::parseColorValue): 100 (WebCore::parseSimpleLengthValue): 101 (WebCore::CSSParser::parseValue): 102 (WebCore::CSSParser::parseDeclaration): 103 (WebCore::CSSParser::createStyleRule): 104 (WebCore::CSSParser::createFontFaceRule): 105 (WebCore::CSSParser::createPageRule): 106 (WebCore::CSSParser::createKeyframeRule): 107 * css/CSSParser.h: 108 (WebCore): 109 (CSSParser): 110 * css/CSSStyleDeclaration.h: 111 (WebCore): 112 (CSSStyleDeclaration): 113 * css/CSSStyleRule.h: 114 (WebCore::CSSStyleRule::style): 115 (WebCore::CSSStyleRule::setDeclaration): 116 (WebCore::CSSStyleRule::declaration): 117 (CSSStyleRule): 118 * css/CSSStyleSelector.cpp: 119 (WebCore::leftToRightDeclaration): 120 (WebCore::rightToLeftDeclaration): 121 (WebCore::CSSStyleSelector::addMatchedDeclaration): 122 (WebCore::CSSStyleSelector::collectMatchingRulesForList): 123 (WebCore::CSSStyleSelector::matchAllRules): 124 (WebCore::CSSStyleSelector::styleForKeyframe): 125 (WebCore::isInsideRegionRule): 126 (WebCore::CSSStyleSelector::applyDeclaration): 127 (WebCore::CSSStyleSelector::applyDeclarations): 128 (WebCore::CSSStyleSelector::matchPageRulesForList): 129 * css/CSSStyleSelector.h: 130 (CSSStyleSelector): 131 (MatchedStyleDeclaration): 132 * css/WebKitCSSKeyframeRule.cpp: 133 (WebCore::WebKitCSSKeyframeRule::setDeclaration): 134 * css/WebKitCSSKeyframeRule.h: 135 (WebCore::WebKitCSSKeyframeRule::style): 136 (WebCore::WebKitCSSKeyframeRule::declaration): 137 (WebKitCSSKeyframeRule): 138 * css/WebKitCSSMatrix.cpp: 139 (WebCore::WebKitCSSMatrix::setMatrixValue): 140 * dom/Attr.h: 141 (WebCore::Attr::style): 142 * dom/Attribute.h: 143 (WebCore::Attribute::decl): 144 * dom/CSSMappedAttributeDeclaration.h: 145 (WebCore::CSSMappedAttributeDeclaration::declaration): 146 (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): 147 (CSSMappedAttributeDeclaration): 148 * dom/Document.cpp: 149 (WebCore::Document::createCSSStyleDeclaration): 150 * dom/ElementAttributeData.h: 151 (ElementAttributeData): 152 * dom/NamedNodeMap.cpp: 153 (WebCore::NamedNodeMap::ensureInlineStyleDecl): 154 * dom/NamedNodeMap.h: 155 (WebCore::NamedNodeMap::inlineStyleDecl): 156 (NamedNodeMap): 157 * dom/StyledElement.cpp: 158 (WebCore::StyledElement::updateStyleAttribute): 159 (WebCore::StyledElement::copyNonAttributeProperties): 160 (WebCore::StyledElement::addSubresourceAttributeURLs): 161 * dom/StyledElement.h: 162 (WebCore::StyledElement::additionalAttributeStyle): 163 (WebCore::StyledElement::inlineStyleDecl): 164 (WebCore::StyledElement::ensureInlineStyleDecl): 165 * editing/ApplyStyleCommand.cpp: 166 (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): 167 (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock): 168 (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): 169 (WebCore::ApplyStyleCommand::removeCSSStyle): 170 (WebCore::ApplyStyleCommand::addBlockStyle): 171 (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): 172 * editing/DeleteButtonController.cpp: 173 (WebCore::DeleteButtonController::createDeletionUI): 174 * editing/EditingStyle.cpp: 175 (WebCore::copyEditingProperties): 176 (WebCore::editingStyleFromComputedStyle): 177 (WebCore): 178 (WebCore::HTMLElementEquivalent::propertyExistsInStyle): 179 (HTMLElementEquivalent): 180 (WebCore::HTMLElementEquivalent::valueIsPresentInStyle): 181 (HTMLTextDecorationEquivalent): 182 (WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle): 183 (WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle): 184 (HTMLAttributeEquivalent): 185 (WebCore::HTMLAttributeEquivalent::valueIsPresentInStyle): 186 (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue): 187 (WebCore::EditingStyle::EditingStyle): 188 (WebCore::getRGBAFontColor): 189 (WebCore::EditingStyle::setProperty): 190 (WebCore::EditingStyle::setStyle): 191 (WebCore::EditingStyle::overrideWithStyle): 192 (WebCore::EditingStyle::extractAndRemoveTextDirection): 193 (WebCore::EditingStyle::removeStyleAddedByNode): 194 (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode): 195 (WebCore::EditingStyle::triStateOfStyle): 196 (WebCore::EditingStyle::conflictsWithInlineStyleOfElement): 197 (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent): 198 (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl): 199 (WebCore::EditingStyle::mergeStyle): 200 (WebCore::styleFromMatchedRulesForElement): 201 (WebCore::EditingStyle::mergeStyleFromRules): 202 (WebCore::EditingStyle::mergeStyleFromRulesForSerialization): 203 (WebCore::removePropertiesInStyle): 204 (WebCore::EditingStyle::removeStyleFromRulesAndContext): 205 (WebCore::EditingStyle::removePropertiesInElementDefaultStyle): 206 (WebCore::EditingStyle::forceInline): 207 (WebCore::reconcileTextDecorationProperties): 208 (WebCore::StyleChange::StyleChange): 209 (WebCore::setTextDecorationProperty): 210 (WebCore::StyleChange::extractTextStyles): 211 (WebCore::diffTextDecorations): 212 (WebCore::fontWeightIsBold): 213 (WebCore::getTextAlignment): 214 (WebCore::getPropertiesNotIn): 215 (WebCore::getIdentifierValue): 216 (WebCore::isTransparentColorValue): 217 (WebCore::hasTransparentBackgroundColor): 218 * editing/EditingStyle.h: 219 (WebCore): 220 (WebCore::EditingStyle::create): 221 (EditingStyle): 222 (WebCore::EditingStyle::style): 223 (StyleChange): 224 * editing/Editor.cpp: 225 (WebCore::Editor::setBaseWritingDirection): 226 (WebCore::Editor::applyEditingStyleToElement): 227 * editing/EditorCommand.cpp: 228 (WebCore::applyCommandToFrame): 229 (WebCore::executeApplyStyle): 230 (WebCore::executeToggleStyleInList): 231 (WebCore::executeApplyParagraphStyle): 232 (WebCore::executeMakeTextWritingDirectionLeftToRight): 233 (WebCore::executeMakeTextWritingDirectionNatural): 234 (WebCore::executeMakeTextWritingDirectionRightToLeft): 235 * editing/FrameSelection.cpp: 236 (WebCore::FrameSelection::copyTypingStyle): 237 * editing/FrameSelection.h: 238 (WebCore): 239 * editing/RemoveCSSPropertyCommand.cpp: 240 (WebCore::RemoveCSSPropertyCommand::doApply): 241 (WebCore::RemoveCSSPropertyCommand::doUnapply): 242 * editing/ReplaceSelectionCommand.cpp: 243 (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): 244 * editing/ReplaceSelectionCommand.h: 245 (WebCore): 246 * editing/markup.cpp: 247 (WebCore): 248 (StyledMarkupAccumulator): 249 (WebCore::StyledMarkupAccumulator::wrapWithStyleNode): 250 (WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag): 251 (WebCore::propertyMissingOrEqualToNone): 252 * html/HTMLTableCellElement.cpp: 253 (WebCore::HTMLTableCellElement::additionalAttributeStyle): 254 * html/HTMLTableCellElement.h: 255 (HTMLTableCellElement): 256 * html/HTMLTableColElement.cpp: 257 (WebCore::HTMLTableColElement::additionalAttributeStyle): 258 * html/HTMLTableColElement.h: 259 (HTMLTableColElement): 260 * html/HTMLTableElement.cpp: 261 (WebCore::leakBorderStyle): 262 (WebCore::HTMLTableElement::additionalAttributeStyle): 263 (WebCore::HTMLTableElement::createSharedCellStyle): 264 (WebCore::HTMLTableElement::additionalCellStyle): 265 (WebCore::leakGroupBorderStyle): 266 (WebCore::HTMLTableElement::additionalGroupStyle): 267 * html/HTMLTableElement.h: 268 (HTMLTableElement): 269 * html/HTMLTableSectionElement.cpp: 270 (WebCore::HTMLTableSectionElement::additionalAttributeStyle): 271 * html/HTMLTableSectionElement.h: 272 (HTMLTableSectionElement): 273 * html/ValidationMessage.cpp: 274 (WebCore::adjustBubblePosition): 275 * html/canvas/CanvasRenderingContext2D.cpp: 276 (WebCore::CanvasRenderingContext2D::setFont): 277 * html/shadow/MediaControlElements.cpp: 278 (WebCore::MediaControlPanelElement::setPosition): 279 (WebCore::MediaControlPanelElement::resetPosition): 280 (WebCore::MediaControlPanelElement::makeOpaque): 281 (WebCore::MediaControlPanelElement::makeTransparent): 282 * html/shadow/SliderThumbElement.cpp: 283 (WebCore::TrackLimiterElement::create): 284 * inspector/InspectorCSSAgent.cpp: 285 (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): 286 * inspector/InspectorStyleSheet.cpp: 287 (WebCore::InspectorStyle::setPropertyText): 288 (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): 289 * page/DragController.cpp: 290 (WebCore::DragController::concludeEditDrag): 291 * page/PageSerializer.cpp: 292 (WebCore::PageSerializer::retrieveResourcesForCSSDeclaration): 293 * page/PageSerializer.h: 294 (WebCore): 295 (PageSerializer): 296 * rendering/RenderLayer.cpp: 297 (WebCore::RenderLayer::resize): 298 * rendering/RenderTreeAsText.cpp: 299 (WebCore::isEmptyOrUnstyledAppleStyleSpan): 300 * svg/SVGFontFaceElement.cpp: 301 (WebCore::SVGFontFaceElement::SVGFontFaceElement): 302 1 303 2012-02-03 Jochen Eisinger <jochen@chromium.org> 2 304 -
trunk/Source/WebCore/WebCore.exp.in
r106678 r106681 519 519 __ZN7WebCore16ScriptController21processingUserGestureEv 520 520 __ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE 521 __ZN7WebCore16StylePropertySet5derefEv 521 522 __ZN7WebCore16ThreadGlobalData10staticDataE 522 523 __ZN7WebCore16ThreadGlobalDataC1Ev … … 674 675 __ZN7WebCore25contextMenuItemTagOutlineEv 675 676 __ZN7WebCore25windowsKeyCodeForKeyEventEP7NSEvent 676 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev677 677 __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv 678 678 __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv … … 1297 1297 __ZNK7WebCore16IconDatabaseBase12databasePathEv 1298 1298 __ZNK7WebCore16ResourceResponse13nsURLResponseEv 1299 __ZNK7WebCore16StylePropertySet25ensureCSSStyleDeclarationEv 1299 1300 __ZNK7WebCore16VisibleSelection17isContentEditableEv 1300 1301 __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r106568 r106681 2515 2515 } 2516 2516 2517 PassRefPtr< CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const2517 PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copy() const 2518 2518 { 2519 2519 return copyPropertiesInSet(computedProperties, numComputedProperties); 2520 2520 } 2521 2521 2522 PassRefPtr< CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable()2522 PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::makeMutable() 2523 2523 { 2524 2524 return copy(); … … 2563 2563 } 2564 2564 2565 PassRefPtr< CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const2565 PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const 2566 2566 { 2567 2567 Vector<CSSProperty> list; … … 2572 2572 list.append(CSSProperty(set[i], value.release(), false)); 2573 2573 } 2574 return CSSMutableStyleDeclaration::create(list);2574 return StylePropertySet::create(list); 2575 2575 } 2576 2576 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h
r106568 r106681 29 29 namespace WebCore { 30 30 31 class Color;32 class CSSMutableStyleDeclaration;33 31 class CSSPrimitiveValue; 34 32 class CSSValueList; 35 33 class CSSValuePool; 34 class Color; 36 35 class Node; 37 36 class RenderStyle; 37 class SVGPaint; 38 38 class ShadowData; 39 class S VGPaint;39 class StylePropertySet; 40 40 41 41 #if ENABLE(CSS_SHADERS) … … 55 55 bool getPropertyPriority(int propertyID) const; 56 56 57 virtual PassRefPtr< CSSMutableStyleDeclaration> copy() const;58 virtual PassRefPtr< CSSMutableStyleDeclaration> makeMutable();57 virtual PassRefPtr<StylePropertySet> copy() const; 58 virtual PassRefPtr<StylePropertySet> makeMutable(); 59 59 60 60 PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const; … … 65 65 #endif 66 66 67 PassRefPtr< CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;67 PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const; 68 68 69 69 private: -
trunk/Source/WebCore/css/CSSFontFaceRule.h
r106393 r106681 43 43 ~CSSFontFaceRule(); 44 44 45 CSSStyleDeclaration* style() const { return m_style .get(); }45 CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); } 46 46 47 47 String cssText() const; 48 48 49 CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }50 void setDeclaration(PassRefPtr< CSSMutableStyleDeclaration> style) { m_style = style; }49 StylePropertySet* declaration() const { return m_style.get(); } 50 void setDeclaration(PassRefPtr<StylePropertySet> style) { m_style = style; } 51 51 52 52 void addSubresourceStyleURLs(ListHashSet<KURL>& urls); … … 55 55 CSSFontFaceRule(CSSStyleSheet* parent); 56 56 57 RefPtr< CSSMutableStyleDeclaration> m_style;57 RefPtr<StylePropertySet> m_style; 58 58 }; 59 59 -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r106393 r106681 87 87 { 88 88 // Obtain the font-family property and the src property. Both must be defined. 89 const CSSMutableStyleDeclaration* style = fontFaceRule->declaration();89 const StylePropertySet* style = fontFaceRule->declaration(); 90 90 RefPtr<CSSValue> fontFamily = style->getPropertyCSSValue(CSSPropertyFontFamily); 91 91 RefPtr<CSSValue> src = style->getPropertyCSSValue(CSSPropertySrc); -
trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp
r106568 r106681 46 46 namespace WebCore { 47 47 48 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { 49 public: 50 static PassRefPtr<PropertySetCSSStyleDeclaration> create(PassRefPtr<StylePropertySet> propertySet) 51 { 52 return adoptRef(new PropertySetCSSStyleDeclaration(propertySet)); 53 } 54 55 private: 56 PropertySetCSSStyleDeclaration(PassRefPtr<StylePropertySet> propertySet) : m_propertySet(propertySet) { } 57 58 virtual CSSRule* parentRule() const OVERRIDE; 59 virtual unsigned length() const OVERRIDE; 60 virtual String item(unsigned index) const; 61 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) OVERRIDE; 62 virtual String getPropertyValue(const String& propertyName) OVERRIDE; 63 virtual String getPropertyPriority(const String& propertyName) OVERRIDE; 64 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE; 65 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE; 66 virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) OVERRIDE; 67 virtual String removeProperty(const String& propertyName, ExceptionCode&) OVERRIDE; 68 virtual String cssText() const OVERRIDE; 69 virtual void setCssText(const String&, ExceptionCode&); 70 virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) OVERRIDE; 71 virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE; 72 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE; 73 74 virtual bool cssPropertyMatches(const CSSProperty*) const OVERRIDE; 75 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; 76 virtual PassRefPtr<StylePropertySet> copy() const OVERRIDE; 77 virtual PassRefPtr<StylePropertySet> makeMutable() OVERRIDE; 78 79 RefPtr<StylePropertySet> m_propertySet; 80 }; 81 48 82 namespace { 49 83 … … 51 85 WTF_MAKE_NONCOPYABLE(StyleAttributeMutationScope); 52 86 public: 53 StyleAttributeMutationScope( CSSMutableStyleDeclaration* decl)87 StyleAttributeMutationScope(StylePropertySet* decl) 54 88 { 55 89 ++s_scopeCount; … … 93 127 } 94 128 // We have to clear internal state before calling Inspector's code. 95 CSSMutableStyleDeclaration* localCopyStyleDecl = s_currentDecl;129 StylePropertySet* localCopyStyleDecl = s_currentDecl; 96 130 s_currentDecl = 0; 97 131 s_shouldNotifyInspector = false; … … 115 149 private: 116 150 static unsigned s_scopeCount; 117 static CSSMutableStyleDeclaration* s_currentDecl;151 static StylePropertySet* s_currentDecl; 118 152 static bool s_shouldNotifyInspector; 119 153 #if ENABLE(MUTATION_OBSERVERS) … … 126 160 127 161 unsigned StyleAttributeMutationScope::s_scopeCount = 0; 128 CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0;162 StylePropertySet* StyleAttributeMutationScope::s_currentDecl = 0; 129 163 bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; 130 164 #if ENABLE(MUTATION_OBSERVERS) … … 134 168 } // namespace 135 169 136 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()170 StylePropertySet::StylePropertySet() 137 171 : m_strictParsing(false) 138 172 , m_isInlineStyleDeclaration(false) … … 141 175 } 142 176 143 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule)177 StylePropertySet::StylePropertySet(CSSRule* parentRule) 144 178 : m_strictParsing(!parentRule || parentRule->useStrictParsing()) 145 179 , m_isInlineStyleDeclaration(false) … … 148 182 } 149 183 150 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>& properties)184 StylePropertySet::StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>& properties) 151 185 : m_properties(properties) 152 186 , m_strictParsing(!parentRule || parentRule->useStrictParsing()) … … 155 189 { 156 190 m_properties.shrinkToFit(); 157 // FIXME: This allows duplicate properties. 158 } 159 160 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const * properties, int numProperties) 191 } 192 193 StylePropertySet::StylePropertySet(CSSRule* parentRule, const CSSProperty* const * properties, int numProperties) 161 194 : m_strictParsing(!parentRule || parentRule->useStrictParsing()) 162 195 , m_isInlineStyleDeclaration(false) … … 182 215 } 183 216 184 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(StyledElement* parentElement)217 StylePropertySet::StylePropertySet(StyledElement* parentElement) 185 218 : m_strictParsing(false) 186 219 , m_isInlineStyleDeclaration(true) … … 189 222 } 190 223 191 CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration() 192 { 193 } 194 195 CSSStyleSheet* CSSMutableStyleDeclaration::contextStyleSheet() const 224 StylePropertySet::~StylePropertySet() 225 { 226 } 227 228 void StylePropertySet::deref() 229 { 230 if (derefBase()) { 231 delete this; 232 return; 233 } 234 // StylePropertySet and CSSStyleDeclaration ref each other. When we have a declaration and 235 // our refcount drops to one we know it is the only thing keeping us alive. 236 if (m_cssStyleDeclaration && hasOneRef()) 237 m_cssStyleDeclaration.clear(); 238 } 239 240 CSSStyleSheet* StylePropertySet::contextStyleSheet() const 196 241 { 197 242 if (m_isInlineStyleDeclaration) { … … 202 247 } 203 248 204 void CSSMutableStyleDeclaration::copyPropertiesFrom(const CSSMutableStyleDeclaration& other)249 void StylePropertySet::copyPropertiesFrom(const StylePropertySet& other) 205 250 { 206 251 m_properties = other.m_properties; 207 252 } 208 253 209 String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const254 String StylePropertySet::getPropertyValue(int propertyID) const 210 255 { 211 256 RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); … … 378 423 } 379 424 380 String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) const425 String StylePropertySet::borderSpacingValue(const int properties[2]) const 381 426 { 382 427 RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(properties[0]); … … 394 439 } 395 440 396 bool CSSMutableStyleDeclaration::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const441 bool StylePropertySet::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const 397 442 { 398 443 const CSSProperty* property = findPropertyWithId(propertyId); … … 425 470 } 426 471 427 String CSSMutableStyleDeclaration::fontValue() const472 String StylePropertySet::fontValue() const 428 473 { 429 474 const CSSProperty* fontSizeProperty = findPropertyWithId(CSSPropertyFontSize); … … 450 495 } 451 496 452 String CSSMutableStyleDeclaration::get4Values(const int* properties) const497 String StylePropertySet::get4Values(const int* properties) const 453 498 { 454 499 // Assume the properties are in the usual order top, right, bottom, left. … … 477 522 } 478 523 479 String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* properties, size_t size) const524 String StylePropertySet::getLayeredShorthandValue(const int* properties, size_t size) const 480 525 { 481 526 String res; … … 578 623 } 579 624 580 String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size_t size) const625 String StylePropertySet::getShorthandValue(const int* properties, size_t size) const 581 626 { 582 627 String res; … … 596 641 597 642 // only returns a non-null value if all properties have the same, non-null value 598 String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t size) const643 String StylePropertySet::getCommonValue(const int* properties, size_t size) const 599 644 { 600 645 String res; … … 614 659 } 615 660 616 PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(int propertyID) const661 PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(int propertyID) const 617 662 { 618 663 const CSSProperty* property = findPropertyWithId(propertyID); … … 620 665 } 621 666 622 bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool notifyChanged)667 bool StylePropertySet::removeShorthandProperty(int propertyID, bool notifyChanged) 623 668 { 624 669 CSSPropertyLonghand longhand = longhandForProperty(propertyID); … … 628 673 } 629 674 630 String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyChanged, bool returnText)675 String StylePropertySet::removeProperty(int propertyID, bool notifyChanged, bool returnText) 631 676 { 632 677 #if ENABLE(MUTATION_OBSERVERS) … … 659 704 } 660 705 661 void CSSMutableStyleDeclaration::setNeedsStyleRecalc()706 void StylePropertySet::setNeedsStyleRecalc() 662 707 { 663 708 if (isInlineStyleDeclaration()) { … … 671 716 } 672 717 673 if (CSSStyleSheet* styleSheet = parentStyleSheet()) {718 if (CSSStyleSheet* styleSheet = contextStyleSheet()) { 674 719 if (Document* document = styleSheet->findDocument()) 675 720 document->styleSelectorChanged(DeferRecalcStyle); … … 677 722 } 678 723 679 bool CSSMutableStyleDeclaration::propertyIsImportant(int propertyID) const724 bool StylePropertySet::propertyIsImportant(int propertyID) const 680 725 { 681 726 const CSSProperty* property = findPropertyWithId(propertyID); … … 694 739 } 695 740 696 int CSSMutableStyleDeclaration::getPropertyShorthand(int propertyID) const741 int StylePropertySet::getPropertyShorthand(int propertyID) const 697 742 { 698 743 const CSSProperty* property = findPropertyWithId(propertyID); … … 700 745 } 701 746 702 bool CSSMutableStyleDeclaration::isPropertyImplicit(int propertyID) const747 bool StylePropertySet::isPropertyImplicit(int propertyID) const 703 748 { 704 749 const CSSProperty* property = findPropertyWithId(propertyID); … … 706 751 } 707 752 708 bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, bool notifyChanged)753 bool StylePropertySet::setProperty(int propertyID, const String& value, bool important, bool notifyChanged) 709 754 { 710 755 #if ENABLE(MUTATION_OBSERVERS) … … 738 783 } 739 784 740 void CSSMutableStyleDeclaration::setProperty(const CSSProperty& property, CSSProperty* slot)785 void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot) 741 786 { 742 787 #if ENABLE(MUTATION_OBSERVERS) … … 758 803 } 759 804 760 bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool important, bool notifyChanged)805 bool StylePropertySet::setProperty(int propertyID, int value, bool important, bool notifyChanged) 761 806 { 762 807 CSSProperty property(propertyID, CSSPrimitiveValue::createIdentifier(value), important); … … 767 812 } 768 813 769 bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged)814 bool StylePropertySet::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged) 770 815 { 771 816 CSSProperty property(propertyID, CSSPrimitiveValue::create(value, unit), important); … … 776 821 } 777 822 778 void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration)823 void StylePropertySet::parseDeclaration(const String& styleDeclaration) 779 824 { 780 825 #if ENABLE(MUTATION_OBSERVERS) … … 793 838 } 794 839 795 void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* properties, int numProperties)840 void StylePropertySet::addParsedProperties(const CSSProperty* const* properties, int numProperties) 796 841 { 797 842 #if ENABLE(MUTATION_OBSERVERS) … … 811 856 } 812 857 813 void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property)858 void StylePropertySet::addParsedProperty(const CSSProperty& property) 814 859 { 815 860 #if ENABLE(MUTATION_OBSERVERS) … … 828 873 } 829 874 830 unsigned CSSMutableStyleDeclaration::length() const 831 { 832 return propertyCount(); 833 } 834 835 String CSSMutableStyleDeclaration::item(unsigned i) const 836 { 837 if (i >= m_properties.size()) 838 return ""; 839 return getPropertyName(static_cast<CSSPropertyID>(m_properties[i].id())); 840 } 841 842 String CSSMutableStyleDeclaration::asText() const 875 String StylePropertySet::asText() const 843 876 { 844 877 String result = ""; … … 902 935 } 903 936 904 void CSSMutableStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) 905 { 906 ec = 0; 907 // FIXME: Detect syntax errors and set ec. 908 parseDeclaration(text); 909 } 910 911 void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, bool argOverridesOnConflict) 937 void StylePropertySet::merge(const StylePropertySet* other, bool argOverridesOnConflict) 912 938 { 913 939 #if ENABLE(MUTATION_OBSERVERS) … … 935 961 } 936 962 937 void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls)938 { 939 CSSStyleSheet* sheet = parentStyleSheet();963 void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls) 964 { 965 CSSStyleSheet* sheet = contextStyleSheet(); 940 966 size_t size = m_properties.size(); 941 967 for (size_t i = 0; i < size; ++i) … … 971 997 const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties); 972 998 973 PassRefPtr< CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyBlockProperties() const999 PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const 974 1000 { 975 1001 return copyPropertiesInSet(blockProperties, numBlockProperties); 976 1002 } 977 1003 978 void CSSMutableStyleDeclaration::removeBlockProperties()1004 void StylePropertySet::removeBlockProperties() 979 1005 { 980 1006 removePropertiesInSet(blockProperties, numBlockProperties); 981 1007 } 982 1008 983 bool CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged)1009 bool StylePropertySet::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged) 984 1010 { 985 1011 if (m_properties.isEmpty()) … … 1022 1048 } 1023 1049 1024 PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::makeMutable() 1025 { 1026 return this; 1027 } 1028 1029 PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copy() const 1030 { 1031 return adoptRef(new CSSMutableStyleDeclaration(0, m_properties)); 1032 } 1033 1034 const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) const 1050 const CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) const 1035 1051 { 1036 1052 for (int n = m_properties.size() - 1 ; n >= 0; --n) { … … 1041 1057 } 1042 1058 1043 CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID)1059 CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) 1044 1060 { 1045 1061 for (int n = m_properties.size() - 1 ; n >= 0; --n) { … … 1049 1065 return 0; 1050 1066 } 1051 1052 CSSRule* CSSMutableStyleDeclaration::parentRule() const 1053 { 1054 return parentRuleInternal(); 1055 } 1056 1057 String CSSMutableStyleDeclaration::cssText() const 1058 { 1059 return asText(); 1060 } 1061 1062 PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(const String& propertyName) 1063 { 1064 int propertyID = cssPropertyID(propertyName); 1065 if (!propertyID) 1066 return 0; 1067 return getPropertyCSSValue(propertyID); 1068 } 1069 1070 String CSSMutableStyleDeclaration::getPropertyValue(const String &propertyName) 1071 { 1072 int propertyID = cssPropertyID(propertyName); 1073 if (!propertyID) 1074 return String(); 1075 return getPropertyValue(propertyID); 1076 } 1077 1078 String CSSMutableStyleDeclaration::getPropertyPriority(const String& propertyName) 1079 { 1080 int propertyID = cssPropertyID(propertyName); 1081 if (!propertyID) 1082 return String(); 1083 return propertyIsImportant(propertyID) ? "important" : ""; 1084 } 1085 1086 String CSSMutableStyleDeclaration::getPropertyShorthand(const String& propertyName) 1087 { 1088 int propertyID = cssPropertyID(propertyName); 1089 if (!propertyID) 1090 return String(); 1091 int shorthandID = getPropertyShorthand(propertyID); 1092 if (!shorthandID) 1093 return String(); 1094 return getPropertyName(static_cast<CSSPropertyID>(shorthandID)); 1095 } 1096 1097 bool CSSMutableStyleDeclaration::isPropertyImplicit(const String& propertyName) 1098 { 1099 int propertyID = cssPropertyID(propertyName); 1100 if (!propertyID) 1101 return false; 1102 return isPropertyImplicit(propertyID); 1103 } 1104 1105 void CSSMutableStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) 1106 { 1107 int propertyID = cssPropertyID(propertyName); 1108 if (!propertyID) 1109 return; 1110 bool important = priority.find("important", 0, false) != notFound; 1111 ec = 0; 1112 setProperty(propertyID, value, important, true); 1113 } 1114 1115 String CSSMutableStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec) 1116 { 1117 int propertyID = cssPropertyID(propertyName); 1118 if (!propertyID) 1119 return String(); 1120 ec = 0; 1121 return removeProperty(propertyID, true, true); 1122 } 1123 1124 PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) 1125 { 1126 return getPropertyCSSValue(propertyID); 1127 } 1128 1129 String CSSMutableStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID) 1130 { 1131 return getPropertyValue(propertyID); 1132 } 1133 1134 void CSSMutableStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) 1135 { 1136 ec = 0; 1137 setProperty(propertyID, value, important, true); 1138 } 1139 1140 PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const 1141 { 1142 Vector<CSSProperty> list; 1143 list.reserveInitialCapacity(length); 1144 for (unsigned i = 0; i < length; ++i) { 1145 RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); 1146 if (value) 1147 list.append(CSSProperty(set[i], value.release(), false)); 1148 } 1149 return CSSMutableStyleDeclaration::create(list); 1150 } 1151 1152 bool CSSMutableStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const 1067 1068 bool StylePropertySet::propertyMatches(const CSSProperty* property) const 1153 1069 { 1154 1070 RefPtr<CSSValue> value = getPropertyCSSValue(property->id()); 1155 1071 return value && value->cssText() == property->value()->cssText(); 1156 1072 } 1157 1158 void CSSMutableStyleDeclaration::removeEquivalentProperties(const CSSStyleDeclaration* style) 1073 1074 void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style) 1075 { 1076 Vector<int> propertiesToRemove; 1077 size_t size = m_properties.size(); 1078 for (size_t i = 0; i < size; ++i) { 1079 const CSSProperty& property = m_properties[i]; 1080 if (style->propertyMatches(&property)) 1081 propertiesToRemove.append(property.id()); 1082 } 1083 // FIXME: This should use mass removal. 1084 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) 1085 removeProperty(propertiesToRemove[i]); 1086 } 1087 1088 void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style) 1159 1089 { 1160 1090 Vector<int> propertiesToRemove; … … 1170 1100 } 1171 1101 1102 PassRefPtr<StylePropertySet> StylePropertySet::copy() const 1103 { 1104 return adoptRef(new StylePropertySet(0, m_properties)); 1105 } 1106 1107 PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const int* set, unsigned length) const 1108 { 1109 Vector<CSSProperty> list; 1110 list.reserveInitialCapacity(length); 1111 for (unsigned i = 0; i < length; ++i) { 1112 RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); 1113 if (value) 1114 list.append(CSSProperty(set[i], value.release(), false)); 1115 } 1116 return StylePropertySet::create(list); 1117 } 1118 1119 CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() const 1120 { 1121 if (!m_cssStyleDeclaration) 1122 m_cssStyleDeclaration = PropertySetCSSStyleDeclaration::create(const_cast<StylePropertySet*>(this)); 1123 return m_cssStyleDeclaration.get(); 1124 } 1125 1126 unsigned PropertySetCSSStyleDeclaration::length() const 1127 { 1128 return m_propertySet->propertyCount(); 1129 } 1130 1131 String PropertySetCSSStyleDeclaration::item(unsigned i) const 1132 { 1133 if (i >= m_propertySet->propertyCount()) 1134 return ""; 1135 return getPropertyName(static_cast<CSSPropertyID>(m_propertySet->propertyAt(i).id())); 1136 } 1137 1138 CSSRule* PropertySetCSSStyleDeclaration::parentRule() const 1139 { 1140 return m_propertySet->parentRuleInternal(); 1141 } 1142 1143 String PropertySetCSSStyleDeclaration::cssText() const 1144 { 1145 return m_propertySet->asText(); 1146 } 1147 1148 void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) 1149 { 1150 ec = 0; 1151 // FIXME: Detect syntax errors and set ec. 1152 m_propertySet->parseDeclaration(text); 1153 } 1154 1155 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const String& propertyName) 1156 { 1157 int propertyID = cssPropertyID(propertyName); 1158 if (!propertyID) 1159 return 0; 1160 return m_propertySet->getPropertyCSSValue(propertyID); 1161 } 1162 1163 String PropertySetCSSStyleDeclaration::getPropertyValue(const String &propertyName) 1164 { 1165 int propertyID = cssPropertyID(propertyName); 1166 if (!propertyID) 1167 return String(); 1168 return m_propertySet->getPropertyValue(propertyID); 1169 } 1170 1171 String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName) 1172 { 1173 int propertyID = cssPropertyID(propertyName); 1174 if (!propertyID) 1175 return String(); 1176 return m_propertySet->propertyIsImportant(propertyID) ? "important" : ""; 1177 } 1178 1179 String PropertySetCSSStyleDeclaration::getPropertyShorthand(const String& propertyName) 1180 { 1181 int propertyID = cssPropertyID(propertyName); 1182 if (!propertyID) 1183 return String(); 1184 int shorthandID = m_propertySet->getPropertyShorthand(propertyID); 1185 if (!shorthandID) 1186 return String(); 1187 return getPropertyName(static_cast<CSSPropertyID>(shorthandID)); 1188 } 1189 1190 bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyName) 1191 { 1192 int propertyID = cssPropertyID(propertyName); 1193 if (!propertyID) 1194 return false; 1195 return m_propertySet->isPropertyImplicit(propertyID); 1196 } 1197 1198 void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) 1199 { 1200 int propertyID = cssPropertyID(propertyName); 1201 if (!propertyID) 1202 return; 1203 bool important = priority.find("important", 0, false) != notFound; 1204 ec = 0; 1205 m_propertySet->setProperty(propertyID, value, important, true); 1206 } 1207 1208 String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec) 1209 { 1210 int propertyID = cssPropertyID(propertyName); 1211 if (!propertyID) 1212 return String(); 1213 ec = 0; 1214 return m_propertySet->removeProperty(propertyID, true, true); 1215 } 1216 1217 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) 1218 { 1219 return m_propertySet->getPropertyCSSValue(propertyID); 1220 } 1221 1222 String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID) 1223 { 1224 return m_propertySet->getPropertyValue(propertyID); 1225 } 1226 1227 void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) 1228 { 1229 ec = 0; 1230 m_propertySet->setProperty(propertyID, value, important, true); 1231 } 1232 1233 CSSStyleSheet* PropertySetCSSStyleDeclaration::parentStyleSheet() const 1234 { 1235 return m_propertySet->contextStyleSheet(); 1236 } 1237 1238 PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const 1239 { 1240 return m_propertySet->copy(); 1241 } 1242 1243 PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable() 1244 { 1245 ASSERT(m_propertySet->m_cssStyleDeclaration == this || (!m_propertySet->m_cssStyleDeclaration && m_propertySet->hasOneRef())); 1246 if (!m_propertySet->m_cssStyleDeclaration) 1247 m_propertySet->m_cssStyleDeclaration = this; 1248 return m_propertySet; 1249 } 1250 1251 bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const 1252 { 1253 return m_propertySet->propertyMatches(property); 1254 } 1255 1172 1256 } // namespace WebCore -
trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h
r106568 r106681 32 32 namespace WebCore { 33 33 34 class PropertySetCSSStyleDeclaration; 34 35 class StyledElement; 35 36 36 class CSSMutableStyleDeclaration : public CSSStyleDeclaration{37 class StylePropertySet : public WTF::RefCountedBase { 37 38 public: 38 virtual ~CSSMutableStyleDeclaration();39 ~StylePropertySet(); 39 40 40 static PassRefPtr< CSSMutableStyleDeclaration> create()41 static PassRefPtr<StylePropertySet> create() 41 42 { 42 return adoptRef(new CSSMutableStyleDeclaration);43 return adoptRef(new StylePropertySet); 43 44 } 44 static PassRefPtr< CSSMutableStyleDeclaration> create(CSSRule* parentRule)45 static PassRefPtr<StylePropertySet> create(CSSRule* parentRule) 45 46 { 46 return adoptRef(new CSSMutableStyleDeclaration(parentRule));47 return adoptRef(new StylePropertySet(parentRule)); 47 48 } 48 static PassRefPtr< CSSMutableStyleDeclaration> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties)49 static PassRefPtr<StylePropertySet> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties) 49 50 { 50 return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties));51 return adoptRef(new StylePropertySet(parentRule, properties, numProperties)); 51 52 } 52 static PassRefPtr< CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties)53 static PassRefPtr<StylePropertySet> create(const Vector<CSSProperty>& properties) 53 54 { 54 return adoptRef(new CSSMutableStyleDeclaration(0, properties));55 return adoptRef(new StylePropertySet(0, properties)); 55 56 } 56 static PassRefPtr< CSSMutableStyleDeclaration> createInline(StyledElement* element)57 static PassRefPtr<StylePropertySet> createInline(StyledElement* element) 57 58 { 58 return adoptRef(new CSSMutableStyleDeclaration(element));59 return adoptRef(new StylePropertySet(element)); 59 60 } 61 62 void deref(); 60 63 61 64 unsigned propertyCount() const { return m_properties.size(); } … … 68 71 int getPropertyShorthand(int propertyID) const; 69 72 bool isPropertyImplicit(int propertyID) const; 70 71 virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;72 73 73 74 bool setProperty(int propertyID, int value, bool important = false) { return setProperty(propertyID, value, important, true); } … … 88 89 void addParsedProperty(const CSSProperty&); 89 90 90 PassRefPtr< CSSMutableStyleDeclaration> copyBlockProperties() const;91 PassRefPtr<StylePropertySet> copyBlockProperties() const; 91 92 void removeBlockProperties(); 92 93 void removePropertiesInSet(const int* set, unsigned length) { removePropertiesInSet(set, length, true); } 93 94 94 void merge(const CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);95 void merge(const StylePropertySet*, bool argOverridesOnConflict = true); 95 96 96 97 void setStrictParsing(bool b) { m_strictParsing = b; } … … 100 101 void addSubresourceStyleURLs(ListHashSet<KURL>&); 101 102 103 PassRefPtr<StylePropertySet> copy() const; 102 104 // Used by StyledElement::copyNonAttributeProperties(). 103 void copyPropertiesFrom(const CSSMutableStyleDeclaration&);105 void copyPropertiesFrom(const StylePropertySet&); 104 106 107 void removeEquivalentProperties(const StylePropertySet*); 105 108 void removeEquivalentProperties(const CSSStyleDeclaration*); 106 109 107 PassRefPtr< CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;110 PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const; 108 111 109 112 CSSRule* parentRuleInternal() const { return m_isInlineStyleDeclaration ? 0 : m_parent.rule; } … … 116 119 117 120 String asText() const; 121 122 CSSStyleDeclaration* ensureCSSStyleDeclaration() const; 118 123 119 124 private: 120 CSSMutableStyleDeclaration(); 121 CSSMutableStyleDeclaration(CSSRule* parentRule); 122 CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&); 123 CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties); 124 CSSMutableStyleDeclaration(StyledElement*); 125 126 virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable(); 127 128 // CSSOM functions. Don't make these public. 129 virtual CSSRule* parentRule() const; 130 virtual unsigned length() const; 131 virtual String item(unsigned index) const; 132 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName); 133 virtual String getPropertyValue(const String& propertyName); 134 virtual String getPropertyPriority(const String& propertyName); 135 virtual String getPropertyShorthand(const String& propertyName); 136 virtual bool isPropertyImplicit(const String& propertyName); 137 virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&); 138 virtual String removeProperty(const String& propertyName, ExceptionCode&); 139 virtual String cssText() const; 140 virtual void setCssText(const String&, ExceptionCode&); 141 virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID); 142 virtual String getPropertyValueInternal(CSSPropertyID); 143 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&); 125 StylePropertySet(); 126 StylePropertySet(CSSRule* parentRule); 127 StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>&); 128 StylePropertySet(CSSRule* parentRule, const CSSProperty* const *, int numProperties); 129 StylePropertySet(StyledElement*); 144 130 145 131 void setNeedsStyleRecalc(); … … 162 148 bool removeShorthandProperty(int propertyID, bool notifyChanged); 163 149 bool removePropertiesInSet(const int* set, unsigned length, bool notifyChanged); 164 165 virtual bool cssPropertyMatches(const CSSProperty*) const; 166 virtual CSSStyleSheet* parentStyleSheet() const { return contextStyleSheet(); } 150 bool propertyMatches(const CSSProperty*) const; 167 151 168 152 const CSSProperty* findPropertyWithId(int propertyId) const; … … 179 163 CSSRule* rule; 180 164 StyledElement* element; 181 } m_parent; 165 } m_parent; 166 167 mutable RefPtr<PropertySetCSSStyleDeclaration> m_cssStyleDeclaration; 168 169 friend class PropertySetCSSStyleDeclaration; 182 170 }; 183 171 -
trunk/Source/WebCore/css/CSSPageRule.h
r99708 r106681 29 29 namespace WebCore { 30 30 31 class CSSMutableStyleDeclaration;32 31 class CSSSelector; 33 32 class CSSSelectorList; -
trunk/Source/WebCore/css/CSSParser.cpp
r106568 r106681 327 327 } 328 328 329 static bool parseColorValue( CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)329 static bool parseColorValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0) 330 330 { 331 331 if (!string.length()) … … 410 410 } 411 411 412 static bool parseSimpleLengthValue( CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)412 static bool parseSimpleLengthValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0) 413 413 { 414 414 bool acceptsNegativeNumbers; … … 499 499 } 500 500 501 bool CSSParser::parseValue( CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict)501 bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict) 502 502 { 503 503 if (parseSimpleLengthValue(declaration, propertyId, string, important, strict)) … … 509 509 } 510 510 511 bool CSSParser::parseValue( CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)511 bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet) 512 512 { 513 513 if (contextStyleSheet) … … 609 609 } 610 610 611 bool CSSParser::parseDeclaration( CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet)611 bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet) 612 612 { 613 613 // Length of the "@-webkit-decls{" prefix. … … 8848 8848 if (m_hasFontFaceOnlyValues) 8849 8849 deleteFontFaceOnlyValues(); 8850 rule->setDeclaration( CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));8850 rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); 8851 8851 result = rule.get(); 8852 8852 m_parsedRules.append(rule.release()); … … 8887 8887 } 8888 8888 RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet); 8889 rule->setDeclaration( CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));8889 rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); 8890 8890 clearProperties(); 8891 8891 CSSFontFaceRule* result = rule.get(); … … 8958 8958 selectorVector.append(pageSelector); 8959 8959 rule->adoptSelectorVector(selectorVector); 8960 rule->setDeclaration( CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));8960 rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); 8961 8961 pageRule = rule.get(); 8962 8962 m_parsedRules.append(rule.release()); … … 9042 9042 RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(m_styleSheet); 9043 9043 keyframe->setKeyText(keyString); 9044 keyframe->setDeclaration( CSSMutableStyleDeclaration::create(keyframe.get(), m_parsedProperties, m_numParsedProperties));9044 keyframe->setDeclaration(StylePropertySet::create(keyframe.get(), m_parsedProperties, m_numParsedProperties)); 9045 9045 9046 9046 clearProperties(); -
trunk/Source/WebCore/css/CSSParser.h
r106217 r106681 45 45 class CSSBorderImageSliceValue; 46 46 class CSSMappedAttributeDeclaration; 47 class CSSMutableStyleDeclaration;48 47 class CSSPrimitiveValue; 49 48 class CSSValuePool; … … 59 58 class MediaList; 60 59 class MediaQueryExp; 60 class StylePropertySet; 61 61 class StyledElement; 62 62 class WebKitCSSKeyframeRule; … … 71 71 PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&); 72 72 PassRefPtr<WebKitCSSKeyframeRule> parseKeyframeRule(CSSStyleSheet*, const String&); 73 static bool parseValue( CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict);73 static bool parseValue(StylePropertySet*, int propId, const String&, bool important, bool strict); 74 74 static bool parseColor(RGBA32& color, const String&, bool strict = false); 75 75 static bool parseSystemColor(RGBA32& color, const String&, Document*); 76 76 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*); 77 bool parseDeclaration( CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0);77 bool parseDeclaration(StylePropertySet*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0); 78 78 bool parseMediaQuery(MediaList*, const String&); 79 79 … … 359 359 bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&); 360 360 361 bool parseValue( CSSMutableStyleDeclaration*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0);361 bool parseValue(StylePropertySet*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0); 362 362 363 363 enum SizeParameterType { -
trunk/Source/WebCore/css/CSSStyleDeclaration.h
r106568 r106681 28 28 namespace WebCore { 29 29 30 class CSSMutableStyleDeclaration;31 30 class CSSProperty; 32 31 class CSSStyleSheet; 33 32 class CSSValue; 33 class StylePropertySet; 34 34 class StyledElement; 35 35 … … 60 60 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0; 61 61 62 virtual PassRefPtr< CSSMutableStyleDeclaration> copy() const = 0;63 virtual PassRefPtr< CSSMutableStyleDeclaration> makeMutable() = 0;62 virtual PassRefPtr<StylePropertySet> copy() const = 0; 63 virtual PassRefPtr<StylePropertySet> makeMutable() = 0; 64 64 65 65 virtual bool cssPropertyMatches(const CSSProperty*) const = 0; -
trunk/Source/WebCore/css/CSSStyleRule.h
r106568 r106681 44 44 void setSelectorText(const String&); 45 45 46 CSSStyleDeclaration* style() const { return m_style .get(); }46 CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); } 47 47 48 48 String cssText() const; 49 49 50 50 void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); } 51 void setDeclaration(PassRefPtr< CSSMutableStyleDeclaration> style) { ASSERT(style->parentRuleInternal() == this); m_style = style; }51 void setDeclaration(PassRefPtr<StylePropertySet> style) { ASSERT(style->parentRuleInternal() == this); m_style = style; } 52 52 53 53 const CSSSelectorList& selectorList() const { return m_selectorList; } 54 CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }54 StylePropertySet* declaration() const { return m_style.get(); } 55 55 56 56 void addSubresourceStyleURLs(ListHashSet<KURL>& urls); … … 65 65 String generateSelectorText() const; 66 66 67 RefPtr< CSSMutableStyleDeclaration> m_style;67 RefPtr<StylePropertySet> m_style; 68 68 CSSSelectorList m_selectorList; 69 69 }; -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r106632 r106681 298 298 } 299 299 300 static CSSMutableStyleDeclaration* leftToRightDeclaration()301 { 302 DEFINE_STATIC_LOCAL(RefPtr< CSSMutableStyleDeclaration>, leftToRightDecl, (CSSMutableStyleDeclaration::create()));300 static StylePropertySet* leftToRightDeclaration() 301 { 302 DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, leftToRightDecl, (StylePropertySet::create())); 303 303 if (leftToRightDecl->isEmpty()) 304 304 leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr); … … 306 306 } 307 307 308 static CSSMutableStyleDeclaration* rightToLeftDeclaration()309 { 310 DEFINE_STATIC_LOCAL(RefPtr< CSSMutableStyleDeclaration>, rightToLeftDecl, (CSSMutableStyleDeclaration::create()));308 static StylePropertySet* rightToLeftDeclaration() 309 { 310 DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, rightToLeftDecl, (StylePropertySet::create())); 311 311 if (rightToLeftDecl->isEmpty()) 312 312 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); … … 748 748 } 749 749 750 void CSSStyleSelector::addMatchedDeclaration( CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType)750 void CSSStyleSelector::addMatchedDeclaration(StylePropertySet* styleDeclaration, unsigned linkMatchType) 751 751 { 752 752 m_matchedDecls.grow(m_matchedDecls.size() + 1); … … 941 941 } 942 942 // If the rule has no properties to apply, then ignore it in the non-debug mode. 943 CSSMutableStyleDeclaration* decl = rule->declaration();943 StylePropertySet* decl = rule->declaration(); 944 944 if (!decl || (decl->isEmpty() && !includeEmptyRules)) { 945 945 InspectorInstrumentation::didMatchRule(cookie, false); … … 1014 1014 // Tables and table cells share an additional mapped rule that must be applied 1015 1015 // after all attributes, since their mapped style depends on the values of multiple attributes. 1016 if (RefPtr< CSSMutableStyleDeclaration> additionalStyle = m_styledElement->additionalAttributeStyle()) {1016 if (RefPtr<StylePropertySet> additionalStyle = m_styledElement->additionalAttributeStyle()) { 1017 1017 if (result.ranges.firstAuthorRule == -1) 1018 1018 result.ranges.firstAuthorRule = m_matchedDecls.size(); … … 1036 1036 // Now check our inline style attribute. 1037 1037 if (m_matchAuthorAndUserStyles && m_styledElement) { 1038 CSSMutableStyleDeclaration* inlineDecl = m_styledElement->inlineStyleDecl();1038 StylePropertySet* inlineDecl = m_styledElement->inlineStyleDecl(); 1039 1039 if (inlineDecl) { 1040 1040 result.ranges.lastAuthorRule = m_matchedDecls.size(); … … 1531 1531 PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeValue& keyframe) 1532 1532 { 1533 if (keyframeRule-> style())1533 if (keyframeRule->declaration()) 1534 1534 addMatchedDeclaration(keyframeRule->declaration()); 1535 1535 … … 1571 1571 1572 1572 // Add all the animating properties to the keyframe. 1573 if ( CSSMutableStyleDeclaration* styleDeclaration = keyframeRule->declaration()) {1573 if (StylePropertySet* styleDeclaration = keyframeRule->declaration()) { 1574 1574 unsigned propertyCount = styleDeclaration->propertyCount(); 1575 1575 for (unsigned i = 0; i < propertyCount; ++i) { … … 2436 2436 } 2437 2437 2438 static inline bool isInsideRegionRule( CSSMutableStyleDeclaration* styleDeclaration)2438 static inline bool isInsideRegionRule(StylePropertySet* styleDeclaration) 2439 2439 { 2440 2440 ASSERT(styleDeclaration); … … 2450 2450 2451 2451 template <bool applyFirst> 2452 void CSSStyleSelector::applyDeclaration( CSSMutableStyleDeclaration* styleDeclaration, bool isImportant, bool inheritedOnly)2452 void CSSStyleSelector::applyDeclaration(StylePropertySet* styleDeclaration, bool isImportant, bool inheritedOnly) 2453 2453 { 2454 2454 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), styleDeclaration->parentRuleInternal()); … … 2502 2502 if (m_style->insideLink() != NotInsideLink) { 2503 2503 for (int i = startIndex; i <= endIndex; ++i) { 2504 CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration.get();2504 StylePropertySet* styleDeclaration = m_matchedDecls[i].styleDeclaration.get(); 2505 2505 unsigned linkMatchType = m_matchedDecls[i].linkMatchType; 2506 2506 // FIXME: It would be nicer to pass these as arguments but that requires changes in many places. … … 2721 2721 2722 2722 // If the rule has no properties to apply, then ignore it. 2723 CSSMutableStyleDeclaration* decl = rule->declaration();2723 StylePropertySet* decl = rule->declaration(); 2724 2724 if (!decl || decl->isEmpty()) 2725 2725 continue; -
trunk/Source/WebCore/css/CSSStyleSelector.h
r106351 r106681 39 39 40 40 class CSSFontSelector; 41 class CSSMutableStyleDeclaration;42 41 class CSSPageRule; 43 42 class CSSPrimitiveValue; … … 71 70 class StyleImage; 72 71 class StylePendingImage; 72 class StylePropertySet; 73 73 class StyleShader; 74 74 class StyleSheet; … … 260 260 261 261 void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); } 262 void addMatchedDeclaration( CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll);262 void addMatchedDeclaration(StylePropertySet*, unsigned linkMatchType = SelectorChecker::MatchAll); 263 263 264 264 struct MatchRanges { … … 295 295 void applyDeclarations(bool important, int startIndex, int endIndex, bool inheritedOnly); 296 296 template <bool firstPass> 297 void applyDeclaration( CSSMutableStyleDeclaration*, bool isImportant, bool inheritedOnly);297 void applyDeclaration(StylePropertySet*, bool isImportant, bool inheritedOnly); 298 298 299 299 static bool isValidRegionStyleProperty(int id); … … 376 376 MatchedStyleDeclaration() : possiblyPaddedMember(0) { } 377 377 378 RefPtr< CSSMutableStyleDeclaration> styleDeclaration;378 RefPtr<StylePropertySet> styleDeclaration; 379 379 union { 380 380 unsigned linkMatchType; -
trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp
r106568 r106681 53 53 } 54 54 55 void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr< CSSMutableStyleDeclaration> style)55 void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<StylePropertySet> style) 56 56 { 57 57 ASSERT(style->parentRuleInternal() == this); -
trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h
r106393 r106681 54 54 void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } 55 55 56 CSSStyleDeclaration* style() const { return m_style .get(); }56 CSSStyleDeclaration* style() const { return m_style ? m_style->ensureCSSStyleDeclaration() : 0; } 57 57 58 58 String cssText() const; 59 59 60 CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }61 void setDeclaration(PassRefPtr< CSSMutableStyleDeclaration>);60 StylePropertySet* declaration() const { return m_style.get(); } 61 void setDeclaration(PassRefPtr<StylePropertySet>); 62 62 63 63 private: … … 66 66 WebKitCSSKeyframeRule(CSSStyleSheet* parent); 67 67 68 RefPtr< CSSMutableStyleDeclaration> m_style;68 RefPtr<StylePropertySet> m_style; 69 69 String m_key; // comma separated list of keys 70 70 }; -
trunk/Source/WebCore/css/WebKitCSSMatrix.cpp
r97854 r106681 53 53 void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) 54 54 { 55 RefPtr< CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create();55 RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(); 56 56 if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, true)) { 57 57 // Convert to TransformOperations. This can fail if a property -
trunk/Source/WebCore/dom/Attr.h
r105739 r106681 57 57 58 58 // An extension to get presentational information for attributes. 59 CSSStyleDeclaration* style() { return m_attribute->decl() ; }59 CSSStyleDeclaration* style() { return m_attribute->decl()->ensureCSSStyleDeclaration(); } 60 60 61 61 void setSpecified(bool specified) { m_specified = specified; } -
trunk/Source/WebCore/dom/Attribute.h
r106471 r106681 70 70 PassRefPtr<Attribute> clone() const; 71 71 72 CSSMutableStyleDeclaration* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; }72 StylePropertySet* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; } 73 73 74 74 CSSMappedAttributeDeclaration* mappedAttributeDeclaration() const { return m_mappedAttributeDeclaration.get(); } -
trunk/Source/WebCore/dom/CSSMappedAttributeDeclaration.h
r106471 r106681 59 59 void removeMappedProperty(StyledElement*, int propertyId); 60 60 61 CSSMutableStyleDeclaration* declaration() const { return m_declaration.get(); }61 StylePropertySet* declaration() const { return m_declaration.get(); } 62 62 63 63 private: 64 64 CSSMappedAttributeDeclaration() 65 : m_declaration( CSSMutableStyleDeclaration::create())65 : m_declaration(StylePropertySet::create()) 66 66 , m_entryType(eNone) 67 67 , m_attrName(anyQName()) … … 71 71 void setNeedsStyleRecalc(StyledElement*); 72 72 73 RefPtr< CSSMutableStyleDeclaration> m_declaration;73 RefPtr<StylePropertySet> m_declaration; 74 74 MappedAttributeEntry m_entryType; 75 75 QualifiedName m_attrName; -
trunk/Source/WebCore/dom/Document.cpp
r106632 r106681 812 812 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() 813 813 { 814 return CSSMutableStyleDeclaration::create();814 return StylePropertySet::create()->ensureCSSStyleDeclaration(); 815 815 } 816 816 -
trunk/Source/WebCore/dom/ElementAttributeData.h
r106435 r106681 50 50 } 51 51 52 RefPtr< CSSMutableStyleDeclaration> m_inlineStyleDecl;52 RefPtr<StylePropertySet> m_inlineStyleDecl; 53 53 SpaceSplitString m_classNames; 54 54 AtomicString m_idForStyleResolution; -
trunk/Source/WebCore/dom/NamedNodeMap.cpp
r106515 r106681 322 322 } 323 323 324 CSSMutableStyleDeclaration* NamedNodeMap::ensureInlineStyleDecl()324 StylePropertySet* NamedNodeMap::ensureInlineStyleDecl() 325 325 { 326 326 if (!attributeData()->m_inlineStyleDecl) { 327 327 ASSERT(m_element->isStyledElement()); 328 attributeData()->m_inlineStyleDecl = CSSMutableStyleDeclaration::createInline(static_cast<StyledElement*>(m_element));328 attributeData()->m_inlineStyleDecl = StylePropertySet::createInline(static_cast<StyledElement*>(m_element)); 329 329 attributeData()->m_inlineStyleDecl->setStrictParsing(m_element->isHTMLElement() && !m_element->document()->inQuirksMode()); 330 330 } -
trunk/Source/WebCore/dom/NamedNodeMap.h
r106435 r106681 100 100 const ElementAttributeData* attributeData() const { return &m_attributeData; } 101 101 102 CSSMutableStyleDeclaration* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); }103 CSSMutableStyleDeclaration* ensureInlineStyleDecl();102 StylePropertySet* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); } 103 StylePropertySet* ensureInlineStyleDecl(); 104 104 void destroyInlineStyleDecl(); 105 105 -
trunk/Source/WebCore/dom/StyledElement.cpp
r106471 r106681 113 113 setIsStyleAttributeValid(); 114 114 setIsSynchronizingStyleAttribute(); 115 if ( CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())115 if (StylePropertySet* inlineStyle = inlineStyleDecl()) 116 116 const_cast<StyledElement*>(this)->setAttribute(styleAttr, inlineStyle->asText()); 117 117 clearIsSynchronizingStyleAttribute(); … … 406 406 return; 407 407 408 CSSMutableStyleDeclaration* inlineStyle = ensureInlineStyleDecl();408 StylePropertySet* inlineStyle = ensureInlineStyleDecl(); 409 409 inlineStyle->copyPropertiesFrom(*source->inlineStyleDecl()); 410 410 inlineStyle->setStrictParsing(source->inlineStyleDecl()->useStrictParsing()); … … 418 418 void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 419 419 { 420 if ( CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())420 if (StylePropertySet* inlineStyle = inlineStyleDecl()) 421 421 inlineStyle->addSubresourceStyleURLs(urls); 422 422 } -
trunk/Source/WebCore/dom/StyledElement.h
r106435 r106681 56 56 static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*); 57 57 58 virtual PassRefPtr< CSSMutableStyleDeclaration> additionalAttributeStyle() { return 0; }58 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() { return 0; } 59 59 void invalidateStyleAttribute(); 60 60 61 CSSMutableStyleDeclaration* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; }62 CSSMutableStyleDeclaration* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); }63 virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl() ; }61 StylePropertySet* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; } 62 StylePropertySet* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); } 63 virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl()->ensureCSSStyleDeclaration(); } 64 64 65 65 const SpaceSplitString& classNames() const; -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r106515 r106681 385 385 lastStyledNode = node; 386 386 387 CSSMutableStyleDeclaration* inlineStyleDecl = element->ensureInlineStyleDecl();387 StylePropertySet* inlineStyleDecl = element->ensureInlineStyleDecl(); 388 388 float currentFontSize = computedFontSize(node); 389 389 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta()); … … 512 512 removeNodeAttribute(element, dirAttr); 513 513 } else { 514 RefPtr< CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy();514 RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy(); 515 515 inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); 516 516 inlineStyle->removeProperty(CSSPropertyDirection); … … 726 726 // Add to this element's inline style and skip over its contents. 727 727 HTMLElement* element = toHTMLElement(node); 728 RefPtr< CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy();728 RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy(); 729 729 inlineStyle->merge(style->style()); 730 730 setNodeAttribute(element, styleAttr, inlineStyle->asText()); … … 891 891 return false; 892 892 893 CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();893 StylePropertySet* inlineStyle = element->inlineStyleDecl(); 894 894 ASSERT(inlineStyle); 895 895 // FIXME: We should use a mass-removal function here but we don't have an undoable one yet. … … 1311 1311 1312 1312 String cssText = styleChange.cssStyle(); 1313 if ( CSSMutableStyleDeclaration* decl = block->inlineStyleDecl())1313 if (StylePropertySet* decl = block->inlineStyleDecl()) 1314 1314 cssText += decl->asText(); 1315 1315 setNodeAttribute(block, styleAttr, cssText); … … 1376 1376 if (styleChange.cssStyle().length()) { 1377 1377 if (styleContainer) { 1378 if ( CSSMutableStyleDeclaration* existingStyle = styleContainer->inlineStyleDecl())1378 if (StylePropertySet* existingStyle = styleContainer->inlineStyleDecl()) 1379 1379 setNodeAttribute(styleContainer, styleAttr, existingStyle->asText() + styleChange.cssStyle()); 1380 1380 else -
trunk/Source/WebCore/editing/DeleteButtonController.cpp
r105642 r106681 206 206 container->setIdAttribute(containerElementIdentifier); 207 207 208 CSSMutableStyleDeclaration* style = container->ensureInlineStyleDecl();208 StylePropertySet* style = container->ensureInlineStyleDecl(); 209 209 style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone); 210 210 style->setProperty(CSSPropertyWebkitUserSelect, CSSValueNone); -
trunk/Source/WebCore/editing/EditingStyle.cpp
r106490 r106681 84 84 85 85 template <class StyleDeclarationType> 86 static PassRefPtr< CSSMutableStyleDeclaration> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties)86 static PassRefPtr<StylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties) 87 87 { 88 88 if (type == AllEditingProperties) … … 100 100 } 101 101 102 static PassRefPtr< CSSMutableStyleDeclaration> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties)102 static PassRefPtr<StylePropertySet> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties) 103 103 { 104 104 if (!style) 105 return CSSMutableStyleDeclaration::create();105 return StylePropertySet::create(); 106 106 return copyEditingProperties(style.get(), type); 107 107 } 108 108 109 static RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle);109 static PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); 110 110 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelValuesMatch }; 111 111 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode); 112 static bool isTransparentColorValue(CSSValue*); 112 113 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); 114 static bool hasTransparentBackgroundColor(StylePropertySet*); 113 115 static PassRefPtr<CSSValue> backgroundColorInEffect(Node*); 114 116 … … 123 125 virtual bool matches(const Element* element) const { return !m_tagName || element->hasTagName(*m_tagName); } 124 126 virtual bool hasAttribute() const { return false; } 125 virtual bool propertyExistsInStyle( CSSMutableStyleDeclaration* style) const { return style && style->getPropertyCSSValue(m_propertyID); }126 virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;127 virtual bool propertyExistsInStyle(StylePropertySet* style) const { return style && style->getPropertyCSSValue(m_propertyID); } 128 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; 127 129 virtual void addToStyle(Element*, EditingStyle*) const; 128 130 … … 156 158 } 157 159 158 bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const160 bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const 159 161 { 160 162 RefPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID); … … 173 175 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName)); 174 176 } 175 virtual bool propertyExistsInStyle( CSSMutableStyleDeclaration*) const;176 virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;177 virtual bool propertyExistsInStyle(StylePropertySet*) const; 178 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; 177 179 178 180 private: … … 186 188 } 187 189 188 bool HTMLTextDecorationEquivalent::propertyExistsInStyle( CSSMutableStyleDeclaration* style) const190 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(StylePropertySet* style) const 189 191 { 190 192 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) || style->getPropertyCSSValue(CSSPropertyTextDecoration); 191 193 } 192 194 193 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const195 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const 194 196 { 195 197 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); … … 212 214 bool matches(const Element* elem) const { return HTMLElementEquivalent::matches(elem) && elem->hasAttribute(m_attrName); } 213 215 virtual bool hasAttribute() const { return true; } 214 virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;216 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; 215 217 virtual void addToStyle(Element*, EditingStyle*) const; 216 218 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; … … 235 237 } 236 238 237 bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const239 bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const 238 240 { 239 241 RefPtr<CSSValue> value = attributeValueAsCSSValue(element); … … 257 259 return 0; 258 260 259 RefPtr< CSSMutableStyleDeclaration> dummyStyle;260 dummyStyle = CSSMutableStyleDeclaration::create();261 RefPtr<StylePropertySet> dummyStyle; 262 dummyStyle = StylePropertySet::create(); 261 263 dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName)); 262 264 return dummyStyle->getPropertyCSSValue(m_propertyID); … … 311 313 { 312 314 init(position.deprecatedNode(), propertiesToInclude); 315 } 316 317 EditingStyle::EditingStyle(const StylePropertySet* style) 318 : m_mutableStyle(style ? style->copy() : 0) 319 , m_shouldUseFixedDefaultFontSize(false) 320 , m_fontSizeDelta(NoFontDelta) 321 { 322 extractFontSizeDelta(); 313 323 } 314 324 … … 352 362 } 353 363 364 static inline RGBA32 getRGBAFontColor(StylePropertySet* style) 365 { 366 return cssValueToRGBA(style->getPropertyCSSValue(CSSPropertyColor).get()); 367 } 368 354 369 static inline RGBA32 rgbaBackgroundColorInEffect(Node* node) 355 370 { … … 398 413 { 399 414 if (!m_mutableStyle) 400 m_mutableStyle = CSSMutableStyleDeclaration::create();415 m_mutableStyle = StylePropertySet::create(); 401 416 402 417 m_mutableStyle->setProperty(propertyID, value, important); … … 470 485 } 471 486 472 void EditingStyle::setStyle(PassRefPtr< CSSMutableStyleDeclaration> style)487 void EditingStyle::setStyle(PassRefPtr<StylePropertySet> style) 473 488 { 474 489 m_mutableStyle = style; … … 479 494 } 480 495 481 void EditingStyle::overrideWithStyle(const CSSMutableStyleDeclaration* style)496 void EditingStyle::overrideWithStyle(const StylePropertySet* style) 482 497 { 483 498 if (!style || style->isEmpty()) 484 499 return; 485 500 if (!m_mutableStyle) 486 m_mutableStyle = CSSMutableStyleDeclaration::create();501 m_mutableStyle = StylePropertySet::create(); 487 502 m_mutableStyle->merge(style); 488 503 extractFontSizeDelta(); … … 521 536 { 522 537 RefPtr<EditingStyle> textDirection = EditingStyle::create(); 523 textDirection->m_mutableStyle = CSSMutableStyleDeclaration::create();538 textDirection->m_mutableStyle = StylePropertySet::create(); 524 539 textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); 525 540 textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableStyle->getPropertyValue(CSSPropertyDirection), … … 544 559 if (!node || !node->parentNode()) 545 560 return; 546 RefPtr< CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);547 RefPtr< CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);548 nodeStyle->removeEquivalentProperties(parentStyle .get());549 m_mutableStyle->removeEquivalentProperties(nodeStyle .get());561 RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); 562 RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); 563 nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration()); 564 m_mutableStyle->removeEquivalentProperties(nodeStyle->ensureCSSStyleDeclaration()); 550 565 } 551 566 … … 555 570 return; 556 571 557 RefPtr< CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);558 RefPtr< CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);559 nodeStyle->removeEquivalentProperties(parentStyle .get());572 RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); 573 RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); 574 nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration()); 560 575 561 576 unsigned propertyCount = nodeStyle->propertyCount(); … … 599 614 if (!style || !style->m_mutableStyle) 600 615 return FalseTriState; 601 return triStateOfStyle(style->m_mutableStyle .get(), DoNotIgnoreTextOnlyProperties);616 return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), DoNotIgnoreTextOnlyProperties); 602 617 } 603 618 604 619 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const 605 620 { 606 RefPtr< CSSMutableStyleDeclaration> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare);621 RefPtr<StylePropertySet> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare); 607 622 608 623 if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) … … 649 664 ASSERT(!conflictingProperties || conflictingProperties->isEmpty()); 650 665 651 CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();666 StylePropertySet* inlineStyle = element->inlineStyleDecl(); 652 667 if (!m_mutableStyle || !inlineStyle) 653 668 return false; … … 836 851 837 852 if (element->hasAttribute(HTMLNames::styleAttr)) { 838 if ( CSSMutableStyleDeclaration* style = element->inlineStyleDecl()) {853 if (StylePropertySet* style = element->inlineStyleDecl()) { 839 854 unsigned propertyCount = style->propertyCount(); 840 855 for (unsigned i = 0; i < propertyCount; ++i) { … … 915 930 916 931 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLElementEquivalent* equivalent, const StyledElement* element, 917 EditingStyle::CSSPropertyOverrideMode mode, CSSMutableStyleDeclaration* style)932 EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) 918 933 { 919 934 return equivalent->matches(element) && !equivalent->propertyExistsInStyle(element->inlineStyleDecl()) … … 983 998 } 984 999 985 void EditingStyle::mergeStyle( CSSMutableStyleDeclaration* style, CSSPropertyOverrideMode mode)1000 void EditingStyle::mergeStyle(StylePropertySet* style, CSSPropertyOverrideMode mode) 986 1001 { 987 1002 if (!style) … … 1012 1027 } 1013 1028 1014 static PassRefPtr< CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude)1015 { 1016 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();1029 static PassRefPtr<StylePropertySet> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude) 1030 { 1031 RefPtr<StylePropertySet> style = StylePropertySet::create(); 1017 1032 RefPtr<CSSRuleList> matchedRules = element->document()->styleSelector()->styleRulesForElement(element, rulesToInclude); 1018 1033 if (matchedRules) { 1019 1034 for (unsigned i = 0; i < matchedRules->length(); i++) { 1020 1035 if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) { 1021 RefPtr< CSSMutableStyleDeclaration> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration();1036 RefPtr<StylePropertySet> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration(); 1022 1037 style->merge(s.get(), true); 1023 1038 } … … 1030 1045 void EditingStyle::mergeStyleFromRules(StyledElement* element) 1031 1046 { 1032 RefPtr< CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element,1047 RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element, 1033 1048 CSSStyleSelector::AuthorCSSRules | CSSStyleSelector::CrossOriginCSSRules); 1034 1049 // Styles from the inline style declaration, held in the variable "style", take precedence … … 1049 1064 // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot copy/paste fidelity problem 1050 1065 RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = computedStyle(element); 1051 RefPtr< CSSMutableStyleDeclaration> fromComputedStyle = CSSMutableStyleDeclaration::create();1066 RefPtr<StylePropertySet> fromComputedStyle = StylePropertySet::create(); 1052 1067 { 1053 1068 unsigned propertyCount = m_mutableStyle->propertyCount(); … … 1066 1081 } 1067 1082 1068 static void removePropertiesInStyle( CSSMutableStyleDeclaration* styleToRemovePropertiesFrom, CSSMutableStyleDeclaration* style)1083 static void removePropertiesInStyle(StylePropertySet* styleToRemovePropertiesFrom, StylePropertySet* style) 1069 1084 { 1070 1085 unsigned propertyCount = style->propertyCount(); … … 1083 1098 1084 1099 // 1. Remove style from matched rules because style remain without repeating it in inline style declaration 1085 RefPtr< CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules);1100 RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules); 1086 1101 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) 1087 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules .get());1102 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules->ensureCSSStyleDeclaration()); 1088 1103 1089 1104 // 2. Remove style present in context and not overriden by matched rules. … … 1094 1109 1095 1110 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMatchedRules.get()); 1096 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle .get());1111 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle->ensureCSSStyleDeclaration()); 1097 1112 } 1098 1113 … … 1112 1127 return; 1113 1128 1114 RefPtr< CSSMutableStyleDeclaration> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules);1129 RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules); 1115 1130 1116 1131 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); … … 1120 1135 { 1121 1136 if (!m_mutableStyle) 1122 m_mutableStyle = CSSMutableStyleDeclaration::create();1137 m_mutableStyle = StylePropertySet::create(); 1123 1138 const bool propertyIsImportant = true; 1124 1139 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsImportant); … … 1169 1184 } 1170 1185 1171 static void reconcileTextDecorationProperties( CSSMutableStyleDeclaration* style)1186 static void reconcileTextDecorationProperties(StylePropertySet* style) 1172 1187 { 1173 1188 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); … … 1200 1215 RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle(); 1201 1216 // FIXME: take care of background-color in effect 1202 RefPtr< CSSMutableStyleDeclaration> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());1217 RefPtr<StylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get()); 1203 1218 1204 1219 reconcileTextDecorationProperties(mutableStyle.get()); … … 1219 1234 } 1220 1235 1221 static void setTextDecorationProperty( CSSMutableStyleDeclaration* style, const CSSValueList* newTextDecoration, int propertyID)1236 static void setTextDecorationProperty(StylePropertySet* style, const CSSValueList* newTextDecoration, int propertyID) 1222 1237 { 1223 1238 if (newTextDecoration->length()) … … 1230 1245 } 1231 1246 1232 void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclaration* style, bool shouldUseFixedFontDefaultSize)1247 void StyleChange::extractTextStyles(Document* document, StylePropertySet* style, bool shouldUseFixedFontDefaultSize) 1233 1248 { 1234 1249 ASSERT(style); … … 1293 1308 } 1294 1309 1295 static void diffTextDecorations( CSSMutableStyleDeclaration* style, int propertID, CSSValue* refTextDecoration)1310 static void diffTextDecorations(StylePropertySet* style, int propertID, CSSValue* refTextDecoration) 1296 1311 { 1297 1312 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(propertID); … … 1308 1323 } 1309 1324 1310 static bool fontWeightIsBold(CSSStyleDeclaration* style) 1311 { 1312 ASSERT(style); 1313 RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight); 1314 1325 static bool fontWeightIsBold(CSSValue* fontWeight) 1326 { 1315 1327 if (!fontWeight) 1316 1328 return false; … … 1320 1332 // Because b tag can only bold text, there are only two states in plain html: bold and not bold. 1321 1333 // Collapse all other values to either one of these two states for editing purposes. 1322 switch (static_cast<CSSPrimitiveValue*>(fontWeight .get())->getIdent()) {1334 switch (static_cast<CSSPrimitiveValue*>(fontWeight)->getIdent()) { 1323 1335 case CSSValue100: 1324 1336 case CSSValue200: … … 1337 1349 1338 1350 ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter 1339 return false; // Make compiler happy 1340 } 1341 1342 static int getTextAlignment(CSSStyleDeclaration* style) 1343 { 1344 int textAlign = getIdentifierValue(style, CSSPropertyTextAlign); 1345 switch (textAlign) { 1351 return false; 1352 } 1353 1354 static bool fontWeightIsBold(CSSStyleDeclaration* style) 1355 { 1356 ASSERT(style); 1357 RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight); 1358 return fontWeightIsBold(fontWeight.get()); 1359 } 1360 1361 static bool fontWeightIsBold(StylePropertySet* style) 1362 { 1363 ASSERT(style); 1364 RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight); 1365 return fontWeightIsBold(fontWeight.get()); 1366 } 1367 1368 static int getTextAlignment(int textAlignIdentifierValue) 1369 { 1370 switch (textAlignIdentifierValue) { 1346 1371 case CSSValueCenter: 1347 1372 case CSSValueWebkitCenter: … … 1359 1384 } 1360 1385 1361 RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) 1386 static int getTextAlignment(CSSStyleDeclaration* style) 1387 { 1388 return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign)); 1389 } 1390 1391 static int getTextAlignment(StylePropertySet* style) 1392 { 1393 return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign)); 1394 } 1395 1396 PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) 1362 1397 { 1363 1398 ASSERT(styleWithRedundantProperties); 1364 1399 ASSERT(baseStyle); 1365 RefPtr< CSSMutableStyleDeclaration> result = styleWithRedundantProperties->copy();1400 RefPtr<StylePropertySet> result = styleWithRedundantProperties->copy(); 1366 1401 1367 1402 result->removeEquivalentProperties(baseStyle); … … 1383 1418 } 1384 1419 1385 int getIdentifierValue( CSSStyleDeclaration* style, CSSPropertyID propertyID)1420 int getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) 1386 1421 { 1387 1422 if (!style) 1388 1423 return 0; 1389 1424 RefPtr<CSSValue> value = style->getPropertyCSSValue(propertyID); 1425 if (!value || !value->isPrimitiveValue()) 1426 return 0; 1427 return static_cast<CSSPrimitiveValue*>(value.get())->getIdent(); 1428 } 1429 1430 int getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID propertyID) 1431 { 1432 if (!style) 1433 return 0; 1390 1434 RefPtr<CSSValue> value = style->getPropertyCSSValueInternal(propertyID); 1391 1435 if (!value || !value->isPrimitiveValue()) 1392 1436 return 0; 1393 1394 1437 return static_cast<CSSPrimitiveValue*>(value.get())->getIdent(); 1395 1438 } … … 1419 1462 } 1420 1463 1421 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) 1422 { 1423 RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor); 1464 bool isTransparentColorValue(CSSValue* cssValue) 1465 { 1424 1466 if (!cssValue) 1425 return true; 1426 1467 return true; 1427 1468 if (!cssValue->isPrimitiveValue()) 1428 1469 return false; 1429 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue.get()); 1470 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue); 1471 if (value->isRGBColor()) 1472 return !alphaChannel(value->getRGBA32Value()); 1473 return value->getIdent() == CSSValueTransparent; 1474 } 1475 1476 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) 1477 { 1478 RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor); 1479 return isTransparentColorValue(cssValue.get()); 1480 } 1430 1481 1431 if (value->isRGBColor())1432 return !alphaChannel(value->getRGBA32Value()); 1433 1434 return value->getIdent() == CSSValueTransparent;1482 bool hasTransparentBackgroundColor(StylePropertySet* style) 1483 { 1484 RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundColor); 1485 return isTransparentColorValue(cssValue.get()); 1435 1486 } 1436 1487 -
trunk/Source/WebCore/editing/EditingStyle.h
r106247 r106681 44 44 class CSSStyleDeclaration; 45 45 class CSSComputedStyleDeclaration; 46 class CSSMutableStyleDeclaration;47 46 class CSSPrimitiveValue; 48 47 class CSSValue; … … 54 53 class QualifiedName; 55 54 class RenderStyle; 55 class StylePropertySet; 56 56 class StyledElement; 57 57 class VisibleSelection; … … 82 82 } 83 83 84 static PassRefPtr<EditingStyle> create(const StylePropertySet* style) 85 { 86 return adoptRef(new EditingStyle(style)); 87 } 88 84 89 static PassRefPtr<EditingStyle> create(const CSSStyleDeclaration* style) 85 90 { … … 94 99 ~EditingStyle(); 95 100 96 CSSMutableStyleDeclaration* style() { return m_mutableStyle.get(); }101 StylePropertySet* style() { return m_mutableStyle.get(); } 97 102 bool textDirection(WritingDirection&) const; 98 103 bool isEmpty() const; 99 void setStyle(PassRefPtr< CSSMutableStyleDeclaration>);100 void overrideWithStyle(const CSSMutableStyleDeclaration*);104 void setStyle(PassRefPtr<StylePropertySet>); 105 void overrideWithStyle(const StylePropertySet*); 101 106 void clear(); 102 107 PassRefPtr<EditingStyle> copy() const; … … 145 150 EditingStyle(Node*, PropertiesToInclude); 146 151 EditingStyle(const Position&, PropertiesToInclude); 152 EditingStyle(const StylePropertySet*); 147 153 EditingStyle(const CSSStyleDeclaration*); 148 154 EditingStyle(int propertyID, const String& value); … … 155 161 bool conflictsWithInlineStyleOfElement(StyledElement*, EditingStyle* extractedStyle, Vector<CSSPropertyID>* conflictingProperties) const; 156 162 void mergeInlineAndImplicitStyleOfElement(StyledElement*, CSSPropertyOverrideMode, PropertiesToInclude); 157 void mergeStyle( CSSMutableStyleDeclaration*, CSSPropertyOverrideMode);158 159 RefPtr< CSSMutableStyleDeclaration> m_mutableStyle;163 void mergeStyle(StylePropertySet*, CSSPropertyOverrideMode); 164 165 RefPtr<StylePropertySet> m_mutableStyle; 160 166 bool m_shouldUseFixedDefaultFontSize; 161 167 float m_fontSizeDelta; … … 202 208 } 203 209 private: 204 void extractTextStyles(Document*, CSSMutableStyleDeclaration*, bool shouldUseFixedFontDefaultSize);210 void extractTextStyles(Document*, StylePropertySet*, bool shouldUseFixedFontDefaultSize); 205 211 206 212 String m_cssStyle; … … 218 224 // FIXME: Remove these functions or make them non-global to discourage using CSSStyleDeclaration directly. 219 225 int getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); 226 int getIdentifierValue(StylePropertySet*, CSSPropertyID); 220 227 221 228 } // namespace WebCore -
trunk/Source/WebCore/editing/Editor.cpp
r106248 r106681 1347 1347 } 1348 1348 1349 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();1349 RefPtr<StylePropertySet> style = StylePropertySet::create(); 1350 1350 style->setProperty(CSSPropertyDirection, direction == LeftToRightWritingDirection ? "ltr" : direction == RightToLeftWritingDirection ? "rtl" : "inherit", false); 1351 applyParagraphStyleToSelection(style .get(), EditActionSetWritingDirection);1351 applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); 1352 1352 } 1353 1353 … … 2746 2746 if (!element->isStyledElement()) 2747 2747 return; 2748 CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();2748 StylePropertySet* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); 2749 2749 style->setProperty(CSSPropertyWordWrap, "break-word", false); 2750 2750 style->setProperty(CSSPropertyWebkitNbspMode, "space", false); -
trunk/Source/WebCore/editing/EditorCommand.cpp
r103302 r106681 99 99 } 100 100 101 static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style)101 static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, StylePropertySet* style) 102 102 { 103 103 // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that? 104 104 switch (source) { 105 105 case CommandFromMenuOrKeyBinding: 106 frame->editor()->applyStyleToSelection(style , action);106 frame->editor()->applyStyleToSelection(style->ensureCSSStyleDeclaration(), action); 107 107 return true; 108 108 case CommandFromDOM: 109 109 case CommandFromDOMWithUserInterface: 110 frame->editor()->applyStyle(style );110 frame->editor()->applyStyle(style->ensureCSSStyleDeclaration()); 111 111 return true; 112 112 } … … 117 117 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue) 118 118 { 119 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();119 RefPtr<StylePropertySet> style = StylePropertySet::create(); 120 120 style->setProperty(propertyID, propertyValue); 121 121 return applyCommandToFrame(frame, source, action, style.get()); … … 124 124 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue) 125 125 { 126 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();126 RefPtr<StylePropertySet> style = StylePropertySet::create(); 127 127 style->setProperty(propertyID, propertyValue); 128 128 return applyCommandToFrame(frame, source, action, style.get()); … … 152 152 153 153 // FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue. 154 RefPtr< CSSMutableStyleDeclaration> newMutableStyle = CSSMutableStyleDeclaration::create();154 RefPtr<StylePropertySet> newMutableStyle = StylePropertySet::create(); 155 155 newMutableStyle->setProperty(propertyID, newStyle, ec); 156 156 return applyCommandToFrame(frame, source, action, newMutableStyle.get()); … … 175 175 static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue) 176 176 { 177 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();177 RefPtr<StylePropertySet> style = StylePropertySet::create(); 178 178 style->setProperty(propertyID, propertyValue); 179 179 // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that? 180 180 switch (source) { 181 181 case CommandFromMenuOrKeyBinding: 182 frame->editor()->applyParagraphStyleToSelection(style .get(), action);182 frame->editor()->applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), action); 183 183 return true; 184 184 case CommandFromDOM: 185 185 case CommandFromDOMWithUserInterface: 186 frame->editor()->applyParagraphStyle(style .get());186 frame->editor()->applyParagraphStyle(style->ensureCSSStyleDeclaration()); 187 187 return true; 188 188 } … … 581 581 static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&) 582 582 { 583 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();583 RefPtr<StylePropertySet> style = StylePropertySet::create(); 584 584 style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); 585 585 style->setProperty(CSSPropertyDirection, CSSValueLtr); 586 frame->editor()->applyStyle(style .get(), EditActionSetWritingDirection);586 frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); 587 587 return true; 588 588 } … … 590 590 static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&) 591 591 { 592 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();592 RefPtr<StylePropertySet> style = StylePropertySet::create(); 593 593 style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); 594 frame->editor()->applyStyle(style .get(), EditActionSetWritingDirection);594 frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); 595 595 return true; 596 596 } … … 598 598 static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&) 599 599 { 600 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();600 RefPtr<StylePropertySet> style = StylePropertySet::create(); 601 601 style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); 602 602 style->setProperty(CSSPropertyDirection, CSSValueRtl); 603 frame->editor()->applyStyle(style .get(), EditActionSetWritingDirection);603 frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); 604 604 return true; 605 605 } -
trunk/Source/WebCore/editing/FrameSelection.cpp
r105473 r106681 1838 1838 } 1839 1839 1840 PassRefPtr< CSSMutableStyleDeclaration> FrameSelection::copyTypingStyle() const1840 PassRefPtr<StylePropertySet> FrameSelection::copyTypingStyle() const 1841 1841 { 1842 1842 if (!m_typingStyle || !m_typingStyle->style()) -
trunk/Source/WebCore/editing/FrameSelection.h
r103365 r106681 39 39 40 40 class CharacterData; 41 class CSSMutableStyleDeclaration;42 41 class Frame; 43 42 class GraphicsContext; … … 46 45 class RenderView; 47 46 class Settings; 47 class StylePropertySet; 48 48 class VisiblePosition; 49 49 … … 236 236 237 237 EditingStyle* typingStyle() const; 238 PassRefPtr< CSSMutableStyleDeclaration> copyTypingStyle() const;238 PassRefPtr<StylePropertySet> copyTypingStyle() const; 239 239 void setTypingStyle(PassRefPtr<EditingStyle>); 240 240 void clearTypingStyle(); -
trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp
r106490 r106681 43 43 void RemoveCSSPropertyCommand::doApply() 44 44 { 45 CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl();45 StylePropertySet* style = m_element->inlineStyleDecl(); 46 46 m_oldValue = style->getPropertyValue(m_property); 47 47 m_important = style->propertyIsImportant(m_property); … … 51 51 void RemoveCSSPropertyCommand::doUnapply() 52 52 { 53 CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl();53 StylePropertySet* style = m_element->inlineStyleDecl(); 54 54 style->setProperty(m_property, m_oldValue, m_important); 55 55 } -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r106247 r106681 482 482 StyledElement* element = static_cast<StyledElement*>(node.get()); 483 483 484 CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();484 StylePropertySet* inlineStyle = element->inlineStyleDecl(); 485 485 RefPtr<EditingStyle> newInlineStyle = EditingStyle::create(inlineStyle); 486 486 if (inlineStyle) { -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.h
r102846 r106681 31 31 namespace WebCore { 32 32 33 class CSSMutableStyleDeclaration;34 33 class DocumentFragment; 35 34 class EditingStyle; 36 35 class Node; 37 36 class ReplacementFragment; 37 class StylePropertySet; 38 38 39 39 class ReplaceSelectionCommand : public CompositeEditCommand { -
trunk/Source/WebCore/editing/markup.cpp
r106515 r106681 70 70 using namespace HTMLNames; 71 71 72 static bool propertyMissingOrEqualToNone( CSSMutableStyleDeclaration*, int propertyID);72 static bool propertyMissingOrEqualToNone(StylePropertySet*, int propertyID); 73 73 74 74 class AttributeChange { … … 130 130 virtual void appendString(const String& s) { return MarkupAccumulator::appendString(s); } 131 131 void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySelectsNode = DoesFullySelectNode); 132 void wrapWithStyleNode( CSSMutableStyleDeclaration*, Document*, bool isBlock = false);132 void wrapWithStyleNode(StylePropertySet*, Document*, bool isBlock = false); 133 133 String takeResults(); 134 134 135 135 private: 136 void appendStyleNodeOpenTag(StringBuilder&, CSSMutableStyleDeclaration*, Document*, bool isBlock = false);136 void appendStyleNodeOpenTag(StringBuilder&, StylePropertySet*, Document*, bool isBlock = false); 137 137 const String styleNodeCloseTag(bool isBlock = false); 138 138 virtual void appendText(StringBuilder& out, Text*); … … 179 179 } 180 180 181 void StyledMarkupAccumulator::wrapWithStyleNode( CSSMutableStyleDeclaration* style, Document* document, bool isBlock)181 void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style, Document* document, bool isBlock) 182 182 { 183 183 StringBuilder openTag; … … 187 187 } 188 188 189 void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, CSSMutableStyleDeclaration* style, Document* document, bool isBlock)189 void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, StylePropertySet* style, Document* document, bool isBlock) 190 190 { 191 191 // wrappingStyleForSerialization should have removed -webkit-text-decorations-in-effect … … 468 468 } 469 469 470 static bool propertyMissingOrEqualToNone( CSSMutableStyleDeclaration* style, int propertyID)470 static bool propertyMissingOrEqualToNone(StylePropertySet* style, int propertyID) 471 471 { 472 472 if (!style) -
trunk/Source/WebCore/html/HTMLTableCellElement.cpp
r106015 r106681 119 119 } 120 120 121 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableCellElement::additionalAttributeStyle()121 PassRefPtr<StylePropertySet> HTMLTableCellElement::additionalAttributeStyle() 122 122 { 123 123 ContainerNode* p = parentNode(); -
trunk/Source/WebCore/html/HTMLTableCellElement.h
r106015 r106681 57 57 virtual void parseMappedAttribute(Attribute*); 58 58 59 virtual PassRefPtr< CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;59 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE; 60 60 61 61 virtual bool isURLAttribute(Attribute*) const; -
trunk/Source/WebCore/html/HTMLTableColElement.cpp
r106015 r106681 78 78 } 79 79 80 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableColElement::additionalAttributeStyle()80 PassRefPtr<StylePropertySet> HTMLTableColElement::additionalAttributeStyle() 81 81 { 82 82 if (!hasLocalName(colgroupTag)) -
trunk/Source/WebCore/html/HTMLTableColElement.h
r106015 r106681 45 45 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; 46 46 virtual void parseMappedAttribute(Attribute*); 47 virtual PassRefPtr< CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;47 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE; 48 48 49 49 int m_span; -
trunk/Source/WebCore/html/HTMLTableElement.cpp
r106015 r106681 446 446 } 447 447 448 static CSSMutableStyleDeclaration* leakBorderStyle(int value)449 { 450 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();448 static StylePropertySet* leakBorderStyle(int value) 449 { 450 RefPtr<StylePropertySet> style = StylePropertySet::create(); 451 451 style->setProperty(CSSPropertyBorderTopStyle, value); 452 452 style->setProperty(CSSPropertyBorderBottomStyle, value); … … 456 456 } 457 457 458 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableElement::additionalAttributeStyle()458 PassRefPtr<StylePropertySet> HTMLTableElement::additionalAttributeStyle() 459 459 { 460 460 if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr) … … 462 462 463 463 if (m_borderColorAttr) { 464 static CSSMutableStyleDeclaration* solidBorderStyle = leakBorderStyle(CSSValueSolid);464 static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueSolid); 465 465 return solidBorderStyle; 466 466 } 467 static CSSMutableStyleDeclaration* outsetBorderStyle = leakBorderStyle(CSSValueOutset);467 static StylePropertySet* outsetBorderStyle = leakBorderStyle(CSSValueOutset); 468 468 return outsetBorderStyle; 469 469 } … … 492 492 } 493 493 494 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle()495 { 496 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();494 PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle() 495 { 496 RefPtr<StylePropertySet> style = StylePropertySet::create(); 497 497 498 498 switch (cellBorders()) { … … 543 543 } 544 544 545 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableElement::additionalCellStyle()545 PassRefPtr<StylePropertySet> HTMLTableElement::additionalCellStyle() 546 546 { 547 547 if (!m_sharedCellStyle) … … 550 550 } 551 551 552 static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows)553 { 554 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();552 static StylePropertySet* leakGroupBorderStyle(int rows) 553 { 554 RefPtr<StylePropertySet> style = StylePropertySet::create(); 555 555 if (rows) { 556 556 style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin); … … 567 567 } 568 568 569 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableElement::additionalGroupStyle(bool rows)569 PassRefPtr<StylePropertySet> HTMLTableElement::additionalGroupStyle(bool rows) 570 570 { 571 571 if (m_rulesAttr != GroupsRules) … … 573 573 574 574 if (rows) { 575 static CSSMutableStyleDeclaration* rowBorderStyle = leakGroupBorderStyle(true);575 static StylePropertySet* rowBorderStyle = leakGroupBorderStyle(true); 576 576 return rowBorderStyle; 577 577 } 578 static CSSMutableStyleDeclaration* columnBorderStyle = leakGroupBorderStyle(false);578 static StylePropertySet* columnBorderStyle = leakGroupBorderStyle(false); 579 579 return columnBorderStyle; 580 580 } -
trunk/Source/WebCore/html/HTMLTableElement.h
r106015 r106681 67 67 virtual void attach(); 68 68 69 PassRefPtr< CSSMutableStyleDeclaration> additionalCellStyle();70 PassRefPtr< CSSMutableStyleDeclaration> additionalGroupStyle(bool rows);69 PassRefPtr<StylePropertySet> additionalCellStyle(); 70 PassRefPtr<StylePropertySet> additionalGroupStyle(bool rows); 71 71 72 72 private: … … 78 78 79 79 // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes. 80 virtual PassRefPtr< CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;80 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE; 81 81 82 82 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; … … 87 87 CellBorders cellBorders() const; 88 88 89 PassRefPtr< CSSMutableStyleDeclaration> createSharedCellStyle();89 PassRefPtr<StylePropertySet> createSharedCellStyle(); 90 90 91 91 HTMLTableSectionElement* lastBody() const; … … 99 99 unsigned short m_padding; 100 100 OwnPtr<HTMLTableRowsCollection> m_rowsCollection; 101 RefPtr< CSSMutableStyleDeclaration> m_sharedCellStyle;101 RefPtr<StylePropertySet> m_sharedCellStyle; 102 102 }; 103 103 -
trunk/Source/WebCore/html/HTMLTableSectionElement.cpp
r106015 r106681 48 48 } 49 49 50 PassRefPtr< CSSMutableStyleDeclaration> HTMLTableSectionElement::additionalAttributeStyle()50 PassRefPtr<StylePropertySet> HTMLTableSectionElement::additionalAttributeStyle() 51 51 { 52 52 ContainerNode* p = parentNode(); -
trunk/Source/WebCore/html/HTMLTableSectionElement.h
r106015 r106681 57 57 HTMLTableSectionElement(const QualifiedName& tagName, Document*); 58 58 59 virtual PassRefPtr< CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;59 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE; 60 60 }; 61 61 -
trunk/Source/WebCore/html/ValidationMessage.cpp
r105642 r106681 120 120 } 121 121 122 CSSMutableStyleDeclaration* style = bubble->ensureInlineStyleDecl();122 StylePropertySet* style = bubble->ensureInlineStyleDecl(); 123 123 style->setProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX); 124 124 // The 'left' value of ::-webkit-validation-bubble-arrow. -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r106415 r106681 1990 1990 void CanvasRenderingContext2D::setFont(const String& newFont) 1991 1991 { 1992 RefPtr< CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create();1992 RefPtr<StylePropertySet> tempDecl = StylePropertySet::create(); 1993 1993 CSSParser parser(!m_usesCSSCompatibilityParseMode); 1994 1994 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r105642 r106681 176 176 void MediaControlPanelElement::setPosition(const LayoutPoint& position) 177 177 { 178 CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();178 StylePropertySet* style = ensureInlineStyleDecl(); 179 179 180 180 double left = position.x(); … … 194 194 void MediaControlPanelElement::resetPosition() 195 195 { 196 CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();196 StylePropertySet* style = ensureInlineStyleDecl(); 197 197 198 198 style->removeProperty(CSSPropertyLeft); … … 212 212 double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeInDuration() : 0; 213 213 214 CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();214 StylePropertySet* style = ensureInlineStyleDecl(); 215 215 style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); 216 216 style->setProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S); … … 225 225 return; 226 226 227 CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();227 StylePropertySet* style = ensureInlineStyleDecl(); 228 228 style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); 229 229 style->setProperty(CSSPropertyWebkitTransitionDuration, document()->page()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); -
trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp
r105642 r106681 335 335 RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document)); 336 336 337 CSSMutableStyleDeclaration* style = element->ensureInlineStyleDecl();337 StylePropertySet* style = element->ensureInlineStyleDecl(); 338 338 style->setProperty(CSSPropertyVisibility, CSSValueHidden); 339 339 style->setProperty(CSSPropertyPosition, CSSValueStatic); -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r106515 r106681 728 728 RefPtr<InspectorObject> attrStyleObject = InspectorObject::create(); 729 729 String attributeName = attribute->localName(); 730 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl() , 0);730 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl()->ensureCSSStyleDeclaration(), 0); 731 731 attrStyleObject->setString("name", attributeName.utf8().data()); 732 732 attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle()); -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r106393 r106681 295 295 296 296 if (propertyText.stripWhiteSpace().length()) { 297 RefPtr< CSSMutableStyleDeclaration> tempMutableStyle = CSSMutableStyleDeclaration::create();297 RefPtr<StylePropertySet> tempMutableStyle = StylePropertySet::create(); 298 298 RefPtr<CSSStyleSourceData> sourceData = CSSStyleSourceData::create(); 299 299 CSSParser p; … … 1318 1318 } 1319 1319 1320 RefPtr< CSSMutableStyleDeclaration> tempDeclaration = CSSMutableStyleDeclaration::create();1320 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); 1321 1321 CSSParser p; 1322 1322 p.parseDeclaration(tempDeclaration.get(), m_styleText, result, m_element->document()->elementSheet()); -
trunk/Source/WebCore/page/DragController.cpp
r106530 r106681 448 448 return false; 449 449 RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange(); 450 RefPtr< CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();450 RefPtr<StylePropertySet> style = StylePropertySet::create(); 451 451 style->setProperty(CSSPropertyColor, color.serialized(), false); 452 if (!innerFrame->editor()->shouldApplyStyle(style .get(), innerRange.get()))452 if (!innerFrame->editor()->shouldApplyStyle(style->ensureCSSStyleDeclaration(), innerRange.get())) 453 453 return false; 454 454 m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData); 455 innerFrame->editor()->applyStyle(style .get(), EditActionSetColor);455 innerFrame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetColor); 456 456 return true; 457 457 } -
trunk/Source/WebCore/page/PageSerializer.cpp
r106568 r106681 308 308 } 309 309 310 void PageSerializer::retrieveResourcesForCSSDeclaration( CSSMutableStyleDeclaration* styleDeclaration, Document* document)310 void PageSerializer::retrieveResourcesForCSSDeclaration(StylePropertySet* styleDeclaration, Document* document) 311 311 { 312 312 if (!styleDeclaration) -
trunk/Source/WebCore/page/PageSerializer.h
r106568 r106681 42 42 43 43 class CachedImage; 44 class CSSMutableStyleDeclaration;45 44 class CSSStyleRule; 46 45 class CSSStyleSheet; … … 49 48 class Page; 50 49 class RenderObject; 50 class StylePropertySet; 51 51 52 52 // This class is used to serialize a page contents back to text (typically HTML). … … 79 79 80 80 void addImageToResources(CachedImage*, RenderObject*, const KURL&); 81 void retrieveResourcesForCSSDeclaration( CSSMutableStyleDeclaration*, Document*);81 void retrieveResourcesForCSSDeclaration(StylePropertySet*, Document*); 82 82 void retrieveResourcesForCSSRule(CSSStyleRule*, Document*); 83 83 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r106554 r106681 1708 1708 1709 1709 ASSERT(element->isStyledElement()); 1710 CSSMutableStyleDeclaration* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();1710 StylePropertySet* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); 1711 1711 bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX; 1712 1712 -
trunk/Source/WebCore/rendering/RenderTreeAsText.cpp
r106247 r106681 184 184 return true; 185 185 186 CSSMutableStyleDeclaration* inlineStyleDecl = elem->inlineStyleDecl();186 StylePropertySet* inlineStyleDecl = elem->inlineStyleDecl(); 187 187 return (!inlineStyleDecl || inlineStyleDecl->isEmpty()); 188 188 } -
trunk/Source/WebCore/svg/SVGFontFaceElement.cpp
r106393 r106681 52 52 { 53 53 ASSERT(hasTagName(font_faceTag)); 54 RefPtr< CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(m_fontFaceRule.get());54 RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(m_fontFaceRule.get()); 55 55 styleDeclaration->setStrictParsing(true); 56 56 m_fontFaceRule->setDeclaration(styleDeclaration.release()); -
trunk/Source/WebKit/mac/ChangeLog
r106678 r106681 1 2012-02-03 Antti Koivisto <antti@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=77740 4 Split CSSMutableStyleDeclaration into separate internal and CSSOM types 5 6 Reviewed by Andreas Kling and Darin Adler. 7 8 * WebView/WebFrame.mm: 9 (-[WebFrame _typingStyle]): 10 1 11 2012-02-03 Beth Dakin <bdakin@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r105698 r106681 56 56 #import <WebCore/AccessibilityObject.h> 57 57 #import <WebCore/AnimationController.h> 58 #import <WebCore/CSS MutableStyleDeclaration.h>58 #import <WebCore/CSSStyleDeclaration.h> 59 59 #import <WebCore/CachedResourceLoader.h> 60 60 #import <WebCore/Chrome.h> … … 792 792 if (!_private->coreFrame) 793 793 return nil; 794 RefPtr<CSS MutableStyleDeclaration> typingStyle = _private->coreFrame->selection()->copyTypingStyle();794 RefPtr<CSSStyleDeclaration> typingStyle = _private->coreFrame->selection()->copyTypingStyle()->ensureCSSStyleDeclaration(); 795 795 if (!typingStyle) 796 796 return nil; -
trunk/Source/WebKit/qt/Api/qwebelement.cpp
r106515 r106681 845 845 return QString(); 846 846 847 CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();847 StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); 848 848 849 849 if (strategy == InlineStyle) … … 910 910 911 911 int propID = cssPropertyID(name); 912 CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();912 StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); 913 913 if (!propID || !style) 914 914 return; -
trunk/Source/WebKit/qt/ChangeLog
r106659 r106681 1 2012-02-03 Antti Koivisto <antti@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=77740 4 Split CSSMutableStyleDeclaration into separate internal and CSSOM types 5 6 Reviewed by Andreas Kling and Darin Adler. 7 8 * Api/qwebelement.cpp: 9 (QWebElement::styleProperty): 10 1 11 2012-02-03 No'am Rosenthal <noam.rosenthal@nokia.com> 2 12
Note: See TracChangeset
for help on using the changeset viewer.