https://bugs.webkit.org/show_bug.cgi?id=77740
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 19:46:48 +0000 (19:46 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 19:46:48 +0000 (19:46 +0000)
Split CSSMutableStyleDeclaration into separate internal and CSSOM types

Reviewed by Andreas Kling and Darin Adler.

Source/WebCore:

Split the CSSMutableStyleDeclaration into an internal type (StylePropertySet) and a CSSOM implementation type (PropertySetCSSStyleDeclaration).

To keep things somewhat manageable, this patch does NOT

- rename or add any files (so files names won't match types)
- rename fields, methods or variables to match new type names (like CSSStyleRule::declaration() -> CSSStyleRule::propertySet())
- try to realize any memory or performance gains (StylePropertySet loses the vptr but gains PropertySetCSSStyleDeclaration*)

* WebCore.exp.in:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::copy):
(WebCore::CSSComputedStyleDeclaration::makeMutable):
(WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet):
* css/CSSComputedStyleDeclaration.h:
(WebCore):
(CSSComputedStyleDeclaration):
* css/CSSFontFaceRule.h:
(WebCore::CSSFontFaceRule::style):
(WebCore::CSSFontFaceRule::declaration):
(WebCore::CSSFontFaceRule::setDeclaration):
(CSSFontFaceRule):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSMutableStyleDeclaration.cpp:
(PropertySetCSSStyleDeclaration):
(WebCore::PropertySetCSSStyleDeclaration::create):
(WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration):
(WebCore):
(WebCore::StylePropertySet::StylePropertySet):
(WebCore::StylePropertySet::~StylePropertySet):
(WebCore::StylePropertySet::deref):
(WebCore::StylePropertySet::contextStyleSheet):
(WebCore::StylePropertySet::copyPropertiesFrom):
(WebCore::StylePropertySet::getPropertyValue):
(WebCore::StylePropertySet::borderSpacingValue):
(WebCore::StylePropertySet::appendFontLonghandValueIfExplicit):
(WebCore::StylePropertySet::fontValue):
(WebCore::StylePropertySet::get4Values):
(WebCore::StylePropertySet::getLayeredShorthandValue):
(WebCore::StylePropertySet::getShorthandValue):
(WebCore::StylePropertySet::getCommonValue):
(WebCore::StylePropertySet::getPropertyCSSValue):
(WebCore::StylePropertySet::removeShorthandProperty):
(WebCore::StylePropertySet::removeProperty):
(WebCore::StylePropertySet::setNeedsStyleRecalc):
(WebCore::StylePropertySet::propertyIsImportant):
(WebCore::StylePropertySet::getPropertyShorthand):
(WebCore::StylePropertySet::isPropertyImplicit):
(WebCore::StylePropertySet::setProperty):
(WebCore::StylePropertySet::parseDeclaration):
(WebCore::StylePropertySet::addParsedProperties):
(WebCore::StylePropertySet::addParsedProperty):
(WebCore::StylePropertySet::asText):
(WebCore::StylePropertySet::merge):
(WebCore::StylePropertySet::addSubresourceStyleURLs):
(WebCore::StylePropertySet::copyBlockProperties):
(WebCore::StylePropertySet::removeBlockProperties):
(WebCore::StylePropertySet::removePropertiesInSet):
(WebCore::StylePropertySet::findPropertyWithId):
(WebCore::StylePropertySet::propertyMatches):
(WebCore::StylePropertySet::removeEquivalentProperties):
(WebCore::StylePropertySet::copy):
(WebCore::StylePropertySet::copyPropertiesInSet):
(WebCore::StylePropertySet::ensureCSSStyleDeclaration):
(WebCore::PropertySetCSSStyleDeclaration::length):
(WebCore::PropertySetCSSStyleDeclaration::item):
(WebCore::PropertySetCSSStyleDeclaration::parentRule):
(WebCore::PropertySetCSSStyleDeclaration::cssText):
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand):
(WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::removeProperty):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
(WebCore::PropertySetCSSStyleDeclaration::parentStyleSheet):
(WebCore::PropertySetCSSStyleDeclaration::copy):
(WebCore::PropertySetCSSStyleDeclaration::makeMutable):
(WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches):
* css/CSSMutableStyleDeclaration.h:
(WebCore):
(StylePropertySet):
(WebCore::StylePropertySet::create):
(WebCore::StylePropertySet::createInline):
* css/CSSPageRule.h:
(WebCore):
* css/CSSParser.cpp:
(WebCore::parseColorValue):
(WebCore::parseSimpleLengthValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseDeclaration):
(WebCore::CSSParser::createStyleRule):
(WebCore::CSSParser::createFontFaceRule):
(WebCore::CSSParser::createPageRule):
(WebCore::CSSParser::createKeyframeRule):
* css/CSSParser.h:
(WebCore):
(CSSParser):
* css/CSSStyleDeclaration.h:
(WebCore):
(CSSStyleDeclaration):
* css/CSSStyleRule.h:
(WebCore::CSSStyleRule::style):
(WebCore::CSSStyleRule::setDeclaration):
(WebCore::CSSStyleRule::declaration):
(CSSStyleRule):
* css/CSSStyleSelector.cpp:
(WebCore::leftToRightDeclaration):
(WebCore::rightToLeftDeclaration):
(WebCore::CSSStyleSelector::addMatchedDeclaration):
(WebCore::CSSStyleSelector::collectMatchingRulesForList):
(WebCore::CSSStyleSelector::matchAllRules):
(WebCore::CSSStyleSelector::styleForKeyframe):
(WebCore::isInsideRegionRule):
(WebCore::CSSStyleSelector::applyDeclaration):
(WebCore::CSSStyleSelector::applyDeclarations):
(WebCore::CSSStyleSelector::matchPageRulesForList):
* css/CSSStyleSelector.h:
(CSSStyleSelector):
(MatchedStyleDeclaration):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::WebKitCSSKeyframeRule::setDeclaration):
* css/WebKitCSSKeyframeRule.h:
(WebCore::WebKitCSSKeyframeRule::style):
(WebCore::WebKitCSSKeyframeRule::declaration):
(WebKitCSSKeyframeRule):
* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::setMatrixValue):
* dom/Attr.h:
(WebCore::Attr::style):
* dom/Attribute.h:
(WebCore::Attribute::decl):
* dom/CSSMappedAttributeDeclaration.h:
(WebCore::CSSMappedAttributeDeclaration::declaration):
(WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration):
(CSSMappedAttributeDeclaration):
* dom/Document.cpp:
(WebCore::Document::createCSSStyleDeclaration):
* dom/ElementAttributeData.h:
(ElementAttributeData):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::ensureInlineStyleDecl):
* dom/NamedNodeMap.h:
(WebCore::NamedNodeMap::inlineStyleDecl):
(NamedNodeMap):
* dom/StyledElement.cpp:
(WebCore::StyledElement::updateStyleAttribute):
(WebCore::StyledElement::copyNonAttributeProperties):
(WebCore::StyledElement::addSubresourceAttributeURLs):
* dom/StyledElement.h:
(WebCore::StyledElement::additionalAttributeStyle):
(WebCore::StyledElement::inlineStyleDecl):
(WebCore::StyledElement::ensureInlineStyleDecl):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::removeCSSStyle):
(WebCore::ApplyStyleCommand::addBlockStyle):
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::createDeletionUI):
* editing/EditingStyle.cpp:
(WebCore::copyEditingProperties):
(WebCore::editingStyleFromComputedStyle):
(WebCore):
(WebCore::HTMLElementEquivalent::propertyExistsInStyle):
(HTMLElementEquivalent):
(WebCore::HTMLElementEquivalent::valueIsPresentInStyle):
(HTMLTextDecorationEquivalent):
(WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle):
(WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle):
(HTMLAttributeEquivalent):
(WebCore::HTMLAttributeEquivalent::valueIsPresentInStyle):
(WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
(WebCore::EditingStyle::EditingStyle):
(WebCore::getRGBAFontColor):
(WebCore::EditingStyle::setProperty):
(WebCore::EditingStyle::setStyle):
(WebCore::EditingStyle::overrideWithStyle):
(WebCore::EditingStyle::extractAndRemoveTextDirection):
(WebCore::EditingStyle::removeStyleAddedByNode):
(WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
(WebCore::EditingStyle::triStateOfStyle):
(WebCore::EditingStyle::conflictsWithInlineStyleOfElement):
(WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
(WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
(WebCore::EditingStyle::mergeStyle):
(WebCore::styleFromMatchedRulesForElement):
(WebCore::EditingStyle::mergeStyleFromRules):
(WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
(WebCore::removePropertiesInStyle):
(WebCore::EditingStyle::removeStyleFromRulesAndContext):
(WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
(WebCore::EditingStyle::forceInline):
(WebCore::reconcileTextDecorationProperties):
(WebCore::StyleChange::StyleChange):
(WebCore::setTextDecorationProperty):
(WebCore::StyleChange::extractTextStyles):
(WebCore::diffTextDecorations):
(WebCore::fontWeightIsBold):
(WebCore::getTextAlignment):
(WebCore::getPropertiesNotIn):
(WebCore::getIdentifierValue):
(WebCore::isTransparentColorValue):
(WebCore::hasTransparentBackgroundColor):
* editing/EditingStyle.h:
(WebCore):
(WebCore::EditingStyle::create):
(EditingStyle):
(WebCore::EditingStyle::style):
(StyleChange):
* editing/Editor.cpp:
(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::applyEditingStyleToElement):
* editing/EditorCommand.cpp:
(WebCore::applyCommandToFrame):
(WebCore::executeApplyStyle):
(WebCore::executeToggleStyleInList):
(WebCore::executeApplyParagraphStyle):
(WebCore::executeMakeTextWritingDirectionLeftToRight):
(WebCore::executeMakeTextWritingDirectionNatural):
(WebCore::executeMakeTextWritingDirectionRightToLeft):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::copyTypingStyle):
* editing/FrameSelection.h:
(WebCore):
* editing/RemoveCSSPropertyCommand.cpp:
(WebCore::RemoveCSSPropertyCommand::doApply):
(WebCore::RemoveCSSPropertyCommand::doUnapply):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
* editing/ReplaceSelectionCommand.h:
(WebCore):
* editing/markup.cpp:
(WebCore):
(StyledMarkupAccumulator):
(WebCore::StyledMarkupAccumulator::wrapWithStyleNode):
(WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag):
(WebCore::propertyMissingOrEqualToNone):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::additionalAttributeStyle):
* html/HTMLTableCellElement.h:
(HTMLTableCellElement):
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::additionalAttributeStyle):
* html/HTMLTableColElement.h:
(HTMLTableColElement):
* html/HTMLTableElement.cpp:
(WebCore::leakBorderStyle):
(WebCore::HTMLTableElement::additionalAttributeStyle):
(WebCore::HTMLTableElement::createSharedCellStyle):
(WebCore::HTMLTableElement::additionalCellStyle):
(WebCore::leakGroupBorderStyle):
(WebCore::HTMLTableElement::additionalGroupStyle):
* html/HTMLTableElement.h:
(HTMLTableElement):
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::additionalAttributeStyle):
* html/HTMLTableSectionElement.h:
(HTMLTableSectionElement):
* html/ValidationMessage.cpp:
(WebCore::adjustBubblePosition):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::setPosition):
(WebCore::MediaControlPanelElement::resetPosition):
(WebCore::MediaControlPanelElement::makeOpaque):
(WebCore::MediaControlPanelElement::makeTransparent):
* html/shadow/SliderThumbElement.cpp:
(WebCore::TrackLimiterElement::create):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildArrayForAttributeStyles):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::setPropertyText):
(WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::retrieveResourcesForCSSDeclaration):
* page/PageSerializer.h:
(WebCore):
(PageSerializer):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
* rendering/RenderTreeAsText.cpp:
(WebCore::isEmptyOrUnstyledAppleStyleSpan):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::SVGFontFaceElement):

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _typingStyle]):

Source/WebKit/qt:

* Api/qwebelement.cpp:
(QWebElement::styleProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

63 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.h
Source/WebCore/css/CSSFontFaceRule.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSMutableStyleDeclaration.cpp
Source/WebCore/css/CSSMutableStyleDeclaration.h
Source/WebCore/css/CSSPageRule.h
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSStyleDeclaration.h
Source/WebCore/css/CSSStyleRule.h
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSStyleSelector.h
Source/WebCore/css/WebKitCSSKeyframeRule.cpp
Source/WebCore/css/WebKitCSSKeyframeRule.h
Source/WebCore/css/WebKitCSSMatrix.cpp
Source/WebCore/dom/Attr.h
Source/WebCore/dom/Attribute.h
Source/WebCore/dom/CSSMappedAttributeDeclaration.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/ElementAttributeData.h
Source/WebCore/dom/NamedNodeMap.cpp
Source/WebCore/dom/NamedNodeMap.h
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/DeleteButtonController.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/EditingStyle.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/FrameSelection.h
Source/WebCore/editing/RemoveCSSPropertyCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.h
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLTableCellElement.cpp
Source/WebCore/html/HTMLTableCellElement.h
Source/WebCore/html/HTMLTableColElement.cpp
Source/WebCore/html/HTMLTableColElement.h
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableSectionElement.cpp
Source/WebCore/html/HTMLTableSectionElement.h
Source/WebCore/html/ValidationMessage.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/PageSerializer.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderTreeAsText.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/qt/Api/qwebelement.cpp
Source/WebKit/qt/ChangeLog

index 6baf2d9..6be51a5 100644 (file)
@@ -1,3 +1,305 @@
+2012-02-03  Antti Koivisto  <antti@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77740
+        Split CSSMutableStyleDeclaration into separate internal and CSSOM types 
+
+        Reviewed by Andreas Kling and Darin Adler.
+
+        Split the CSSMutableStyleDeclaration into an internal type (StylePropertySet) and a CSSOM implementation type (PropertySetCSSStyleDeclaration).
+        
+        To keep things somewhat manageable, this patch does NOT
+
+        - rename or add any files (so files names won't match types)
+        - rename fields, methods or variables to match new type names (like CSSStyleRule::declaration() -> CSSStyleRule::propertySet())
+        - try to realize any memory or performance gains (StylePropertySet loses the vptr but gains PropertySetCSSStyleDeclaration*)
+
+        * WebCore.exp.in:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::copy):
+        (WebCore::CSSComputedStyleDeclaration::makeMutable):
+        (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet):
+        * css/CSSComputedStyleDeclaration.h:
+        (WebCore):
+        (CSSComputedStyleDeclaration):
+        * css/CSSFontFaceRule.h:
+        (WebCore::CSSFontFaceRule::style):
+        (WebCore::CSSFontFaceRule::declaration):
+        (WebCore::CSSFontFaceRule::setDeclaration):
+        (CSSFontFaceRule):
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::addFontFaceRule):
+        * css/CSSMutableStyleDeclaration.cpp:
+        (PropertySetCSSStyleDeclaration):
+        (WebCore::PropertySetCSSStyleDeclaration::create):
+        (WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration):
+        (WebCore):
+        (WebCore::StylePropertySet::StylePropertySet):
+        (WebCore::StylePropertySet::~StylePropertySet):
+        (WebCore::StylePropertySet::deref):
+        (WebCore::StylePropertySet::contextStyleSheet):
+        (WebCore::StylePropertySet::copyPropertiesFrom):
+        (WebCore::StylePropertySet::getPropertyValue):
+        (WebCore::StylePropertySet::borderSpacingValue):
+        (WebCore::StylePropertySet::appendFontLonghandValueIfExplicit):
+        (WebCore::StylePropertySet::fontValue):
+        (WebCore::StylePropertySet::get4Values):
+        (WebCore::StylePropertySet::getLayeredShorthandValue):
+        (WebCore::StylePropertySet::getShorthandValue):
+        (WebCore::StylePropertySet::getCommonValue):
+        (WebCore::StylePropertySet::getPropertyCSSValue):
+        (WebCore::StylePropertySet::removeShorthandProperty):
+        (WebCore::StylePropertySet::removeProperty):
+        (WebCore::StylePropertySet::setNeedsStyleRecalc):
+        (WebCore::StylePropertySet::propertyIsImportant):
+        (WebCore::StylePropertySet::getPropertyShorthand):
+        (WebCore::StylePropertySet::isPropertyImplicit):
+        (WebCore::StylePropertySet::setProperty):
+        (WebCore::StylePropertySet::parseDeclaration):
+        (WebCore::StylePropertySet::addParsedProperties):
+        (WebCore::StylePropertySet::addParsedProperty):
+        (WebCore::StylePropertySet::asText):
+        (WebCore::StylePropertySet::merge):
+        (WebCore::StylePropertySet::addSubresourceStyleURLs):
+        (WebCore::StylePropertySet::copyBlockProperties):
+        (WebCore::StylePropertySet::removeBlockProperties):
+        (WebCore::StylePropertySet::removePropertiesInSet):
+        (WebCore::StylePropertySet::findPropertyWithId):
+        (WebCore::StylePropertySet::propertyMatches):
+        (WebCore::StylePropertySet::removeEquivalentProperties):
+        (WebCore::StylePropertySet::copy):
+        (WebCore::StylePropertySet::copyPropertiesInSet):
+        (WebCore::StylePropertySet::ensureCSSStyleDeclaration):
+        (WebCore::PropertySetCSSStyleDeclaration::length):
+        (WebCore::PropertySetCSSStyleDeclaration::item):
+        (WebCore::PropertySetCSSStyleDeclaration::parentRule):
+        (WebCore::PropertySetCSSStyleDeclaration::cssText):
+        (WebCore::PropertySetCSSStyleDeclaration::setCssText):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand):
+        (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit):
+        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
+        (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+        (WebCore::PropertySetCSSStyleDeclaration::parentStyleSheet):
+        (WebCore::PropertySetCSSStyleDeclaration::copy):
+        (WebCore::PropertySetCSSStyleDeclaration::makeMutable):
+        (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches):
+        * css/CSSMutableStyleDeclaration.h:
+        (WebCore):
+        (StylePropertySet):
+        (WebCore::StylePropertySet::create):
+        (WebCore::StylePropertySet::createInline):
+        * css/CSSPageRule.h:
+        (WebCore):
+        * css/CSSParser.cpp:
+        (WebCore::parseColorValue):
+        (WebCore::parseSimpleLengthValue):
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseDeclaration):
+        (WebCore::CSSParser::createStyleRule):
+        (WebCore::CSSParser::createFontFaceRule):
+        (WebCore::CSSParser::createPageRule):
+        (WebCore::CSSParser::createKeyframeRule):
+        * css/CSSParser.h:
+        (WebCore):
+        (CSSParser):
+        * css/CSSStyleDeclaration.h:
+        (WebCore):
+        (CSSStyleDeclaration):
+        * css/CSSStyleRule.h:
+        (WebCore::CSSStyleRule::style):
+        (WebCore::CSSStyleRule::setDeclaration):
+        (WebCore::CSSStyleRule::declaration):
+        (CSSStyleRule):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::leftToRightDeclaration):
+        (WebCore::rightToLeftDeclaration):
+        (WebCore::CSSStyleSelector::addMatchedDeclaration):
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+        (WebCore::CSSStyleSelector::matchAllRules):
+        (WebCore::CSSStyleSelector::styleForKeyframe):
+        (WebCore::isInsideRegionRule):
+        (WebCore::CSSStyleSelector::applyDeclaration):
+        (WebCore::CSSStyleSelector::applyDeclarations):
+        (WebCore::CSSStyleSelector::matchPageRulesForList):
+        * css/CSSStyleSelector.h:
+        (CSSStyleSelector):
+        (MatchedStyleDeclaration):
+        * css/WebKitCSSKeyframeRule.cpp:
+        (WebCore::WebKitCSSKeyframeRule::setDeclaration):
+        * css/WebKitCSSKeyframeRule.h:
+        (WebCore::WebKitCSSKeyframeRule::style):
+        (WebCore::WebKitCSSKeyframeRule::declaration):
+        (WebKitCSSKeyframeRule):
+        * css/WebKitCSSMatrix.cpp:
+        (WebCore::WebKitCSSMatrix::setMatrixValue):
+        * dom/Attr.h:
+        (WebCore::Attr::style):
+        * dom/Attribute.h:
+        (WebCore::Attribute::decl):
+        * dom/CSSMappedAttributeDeclaration.h:
+        (WebCore::CSSMappedAttributeDeclaration::declaration):
+        (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration):
+        (CSSMappedAttributeDeclaration):
+        * dom/Document.cpp:
+        (WebCore::Document::createCSSStyleDeclaration):
+        * dom/ElementAttributeData.h:
+        (ElementAttributeData):
+        * dom/NamedNodeMap.cpp:
+        (WebCore::NamedNodeMap::ensureInlineStyleDecl):
+        * dom/NamedNodeMap.h:
+        (WebCore::NamedNodeMap::inlineStyleDecl):
+        (NamedNodeMap):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::updateStyleAttribute):
+        (WebCore::StyledElement::copyNonAttributeProperties):
+        (WebCore::StyledElement::addSubresourceAttributeURLs):
+        * dom/StyledElement.h:
+        (WebCore::StyledElement::additionalAttributeStyle):
+        (WebCore::StyledElement::inlineStyleDecl):
+        (WebCore::StyledElement::ensureInlineStyleDecl):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+        (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
+        (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+        (WebCore::ApplyStyleCommand::removeCSSStyle):
+        (WebCore::ApplyStyleCommand::addBlockStyle):
+        (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
+        * editing/DeleteButtonController.cpp:
+        (WebCore::DeleteButtonController::createDeletionUI):
+        * editing/EditingStyle.cpp:
+        (WebCore::copyEditingProperties):
+        (WebCore::editingStyleFromComputedStyle):
+        (WebCore):
+        (WebCore::HTMLElementEquivalent::propertyExistsInStyle):
+        (HTMLElementEquivalent):
+        (WebCore::HTMLElementEquivalent::valueIsPresentInStyle):
+        (HTMLTextDecorationEquivalent):
+        (WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle):
+        (WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle):
+        (HTMLAttributeEquivalent):
+        (WebCore::HTMLAttributeEquivalent::valueIsPresentInStyle):
+        (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
+        (WebCore::EditingStyle::EditingStyle):
+        (WebCore::getRGBAFontColor):
+        (WebCore::EditingStyle::setProperty):
+        (WebCore::EditingStyle::setStyle):
+        (WebCore::EditingStyle::overrideWithStyle):
+        (WebCore::EditingStyle::extractAndRemoveTextDirection):
+        (WebCore::EditingStyle::removeStyleAddedByNode):
+        (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
+        (WebCore::EditingStyle::triStateOfStyle):
+        (WebCore::EditingStyle::conflictsWithInlineStyleOfElement):
+        (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
+        (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
+        (WebCore::EditingStyle::mergeStyle):
+        (WebCore::styleFromMatchedRulesForElement):
+        (WebCore::EditingStyle::mergeStyleFromRules):
+        (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
+        (WebCore::removePropertiesInStyle):
+        (WebCore::EditingStyle::removeStyleFromRulesAndContext):
+        (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
+        (WebCore::EditingStyle::forceInline):
+        (WebCore::reconcileTextDecorationProperties):
+        (WebCore::StyleChange::StyleChange):
+        (WebCore::setTextDecorationProperty):
+        (WebCore::StyleChange::extractTextStyles):
+        (WebCore::diffTextDecorations):
+        (WebCore::fontWeightIsBold):
+        (WebCore::getTextAlignment):
+        (WebCore::getPropertiesNotIn):
+        (WebCore::getIdentifierValue):
+        (WebCore::isTransparentColorValue):
+        (WebCore::hasTransparentBackgroundColor):
+        * editing/EditingStyle.h:
+        (WebCore):
+        (WebCore::EditingStyle::create):
+        (EditingStyle):
+        (WebCore::EditingStyle::style):
+        (StyleChange):
+        * editing/Editor.cpp:
+        (WebCore::Editor::setBaseWritingDirection):
+        (WebCore::Editor::applyEditingStyleToElement):
+        * editing/EditorCommand.cpp:
+        (WebCore::applyCommandToFrame):
+        (WebCore::executeApplyStyle):
+        (WebCore::executeToggleStyleInList):
+        (WebCore::executeApplyParagraphStyle):
+        (WebCore::executeMakeTextWritingDirectionLeftToRight):
+        (WebCore::executeMakeTextWritingDirectionNatural):
+        (WebCore::executeMakeTextWritingDirectionRightToLeft):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::copyTypingStyle):
+        * editing/FrameSelection.h:
+        (WebCore):
+        * editing/RemoveCSSPropertyCommand.cpp:
+        (WebCore::RemoveCSSPropertyCommand::doApply):
+        (WebCore::RemoveCSSPropertyCommand::doUnapply):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
+        * editing/ReplaceSelectionCommand.h:
+        (WebCore):
+        * editing/markup.cpp:
+        (WebCore):
+        (StyledMarkupAccumulator):
+        (WebCore::StyledMarkupAccumulator::wrapWithStyleNode):
+        (WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag):
+        (WebCore::propertyMissingOrEqualToNone):
+        * html/HTMLTableCellElement.cpp:
+        (WebCore::HTMLTableCellElement::additionalAttributeStyle):
+        * html/HTMLTableCellElement.h:
+        (HTMLTableCellElement):
+        * html/HTMLTableColElement.cpp:
+        (WebCore::HTMLTableColElement::additionalAttributeStyle):
+        * html/HTMLTableColElement.h:
+        (HTMLTableColElement):
+        * html/HTMLTableElement.cpp:
+        (WebCore::leakBorderStyle):
+        (WebCore::HTMLTableElement::additionalAttributeStyle):
+        (WebCore::HTMLTableElement::createSharedCellStyle):
+        (WebCore::HTMLTableElement::additionalCellStyle):
+        (WebCore::leakGroupBorderStyle):
+        (WebCore::HTMLTableElement::additionalGroupStyle):
+        * html/HTMLTableElement.h:
+        (HTMLTableElement):
+        * html/HTMLTableSectionElement.cpp:
+        (WebCore::HTMLTableSectionElement::additionalAttributeStyle):
+        * html/HTMLTableSectionElement.h:
+        (HTMLTableSectionElement):
+        * html/ValidationMessage.cpp:
+        (WebCore::adjustBubblePosition):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setFont):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlPanelElement::setPosition):
+        (WebCore::MediaControlPanelElement::resetPosition):
+        (WebCore::MediaControlPanelElement::makeOpaque):
+        (WebCore::MediaControlPanelElement::makeTransparent):
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::TrackLimiterElement::create):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyle::setPropertyText):
+        (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
+        * page/DragController.cpp:
+        (WebCore::DragController::concludeEditDrag):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::retrieveResourcesForCSSDeclaration):
+        * page/PageSerializer.h:
+        (WebCore):
+        (PageSerializer):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::resize):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::isEmptyOrUnstyledAppleStyleSpan):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::SVGFontFaceElement):
+
 2012-02-03  Jochen Eisinger  <jochen@chromium.org>
 
         Remove unneccesary canExecuteScripts check from v8 bindings, and correctly indeicate when we're about to execute a script
index 1bb7357..8c76892 100644 (file)
@@ -518,6 +518,7 @@ __ZN7WebCore16ScriptController18windowScriptObjectEv
 __ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKN3WTF6StringEb
 __ZN7WebCore16ScriptController21processingUserGestureEv
 __ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE
+__ZN7WebCore16StylePropertySet5derefEv
 __ZN7WebCore16ThreadGlobalData10staticDataE
 __ZN7WebCore16ThreadGlobalDataC1Ev
 __ZN7WebCore16ThreadGlobalDataD1Ev
@@ -673,7 +674,6 @@ __ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E
 __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiiiNS_7IntSizeE
 __ZN7WebCore25contextMenuItemTagOutlineEv
 __ZN7WebCore25windowsKeyCodeForKeyEventEP7NSEvent
-__ZN7WebCore26CSSMutableStyleDeclarationC1Ev
 __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv
 __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv
 __ZN7WebCore26contextMenuItemTagFontMenuEv
@@ -1296,6 +1296,7 @@ __ZNK7WebCore16HTMLInputElement15isPasswordFieldEv
 __ZNK7WebCore16HTMLInputElement18shouldAutocompleteEv
 __ZNK7WebCore16IconDatabaseBase12databasePathEv
 __ZNK7WebCore16ResourceResponse13nsURLResponseEv
+__ZNK7WebCore16StylePropertySet25ensureCSSStyleDeclarationEv
 __ZNK7WebCore16VisibleSelection17isContentEditableEv
 __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
 __ZNK7WebCore16VisibleSelection19rootEditableElementEv
index d677437..4916020 100644 (file)
@@ -2514,12 +2514,12 @@ bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property
     return value && value->cssText() == property->value()->cssText();
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const
+PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copy() const
 {
     return copyPropertiesInSet(computedProperties, numComputedProperties);
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable()
+PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::makeMutable()
 {
     return copy();
 }
@@ -2562,7 +2562,7 @@ PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSid
     return list.release();
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const
+PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const
 {
     Vector<CSSProperty> list;
     list.reserveInitialCapacity(length);
@@ -2571,7 +2571,7 @@ PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyProperti
         if (value)
             list.append(CSSProperty(set[i], value.release(), false));
     }
-    return CSSMutableStyleDeclaration::create(list);
+    return StylePropertySet::create(list);
 }
 
 CSSRule* CSSComputedStyleDeclaration::parentRule() const
index 2b61355..2c504ac 100644 (file)
 
 namespace WebCore {
 
-class Color;
-class CSSMutableStyleDeclaration;
 class CSSPrimitiveValue;
 class CSSValueList;
 class CSSValuePool;
+class Color;
 class Node;
 class RenderStyle;
-class ShadowData;
 class SVGPaint;
+class ShadowData;
+class StylePropertySet;
 
 #if ENABLE(CSS_SHADERS)
 class CustomFilterNumberParameter;
@@ -54,8 +54,8 @@ public:
     String getPropertyValue(int propertyID) const;
     bool getPropertyPriority(int propertyID) const;
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
-    virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
+    virtual PassRefPtr<StylePropertySet> copy() const;
+    virtual PassRefPtr<StylePropertySet> makeMutable();
 
     PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const;
     PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
@@ -64,7 +64,7 @@ public:
     PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
 #endif
 
-    PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;
+    PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const;
 
 private:
     CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);
index 545c90a..f2d97d5 100644 (file)
@@ -42,19 +42,19 @@ public:
 
     ~CSSFontFaceRule();
 
-    CSSStyleDeclaration* style() const { return m_style.get(); }
+    CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); }
 
     String cssText() const;
 
-    CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
-    void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style) { m_style = style; }
+    StylePropertySet* declaration() const { return m_style.get(); }
+    void setDeclaration(PassRefPtr<StylePropertySet> style) { m_style = style; }
 
     void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
 
 private:
     CSSFontFaceRule(CSSStyleSheet* parent);
 
-    RefPtr<CSSMutableStyleDeclaration> m_style;
+    RefPtr<StylePropertySet> m_style;
 };
 
 } // namespace WebCore
index b13fffd..fed1bd3 100644 (file)
@@ -86,7 +86,7 @@ bool CSSFontSelector::isEmpty() const
 void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
 {
     // Obtain the font-family property and the src property.  Both must be defined.
-    const CSSMutableStyleDeclaration* style = fontFaceRule->declaration();
+    const StylePropertySet* style = fontFaceRule->declaration();
     RefPtr<CSSValue> fontFamily = style->getPropertyCSSValue(CSSPropertyFontFamily);
     RefPtr<CSSValue> src = style->getPropertyCSSValue(CSSPropertySrc);
     RefPtr<CSSValue> unicodeRange = style->getPropertyCSSValue(CSSPropertyUnicodeRange);
index 8ba60d9..2d55482 100644 (file)
@@ -45,12 +45,46 @@ using namespace std;
 
 namespace WebCore {
 
+class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration {
+public:
+    static PassRefPtr<PropertySetCSSStyleDeclaration> create(PassRefPtr<StylePropertySet> propertySet)
+    {
+        return adoptRef(new PropertySetCSSStyleDeclaration(propertySet)); 
+    }
+
+private:
+    PropertySetCSSStyleDeclaration(PassRefPtr<StylePropertySet> propertySet) : m_propertySet(propertySet) { }
+    
+    virtual CSSRule* parentRule() const OVERRIDE;
+    virtual unsigned length() const OVERRIDE;
+    virtual String item(unsigned index) const;
+    virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) OVERRIDE;
+    virtual String getPropertyValue(const String& propertyName) OVERRIDE;
+    virtual String getPropertyPriority(const String& propertyName) OVERRIDE;
+    virtual String getPropertyShorthand(const String& propertyName) OVERRIDE;
+    virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE;
+    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) OVERRIDE;
+    virtual String removeProperty(const String& propertyName, ExceptionCode&) OVERRIDE;
+    virtual String cssText() const OVERRIDE;
+    virtual void setCssText(const String&, ExceptionCode&);
+    virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) OVERRIDE;
+    virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE;
+    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE;
+    
+    virtual bool cssPropertyMatches(const CSSProperty*) const OVERRIDE;
+    virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> copy() const OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> makeMutable() OVERRIDE;
+    
+    RefPtr<StylePropertySet> m_propertySet;
+};
+
 namespace {
 
 class StyleAttributeMutationScope {
     WTF_MAKE_NONCOPYABLE(StyleAttributeMutationScope);
 public:
-    StyleAttributeMutationScope(CSSMutableStyleDeclaration* decl)
+    StyleAttributeMutationScope(StylePropertySet* decl)
     {
         ++s_scopeCount;
 
@@ -92,7 +126,7 @@ public:
             return;
         }
         // We have to clear internal state before calling Inspector's code.
-        CSSMutableStyleDeclaration* localCopyStyleDecl = s_currentDecl;
+        StylePropertySet* localCopyStyleDecl = s_currentDecl;
         s_currentDecl = 0;
         s_shouldNotifyInspector = false;
         if (localCopyStyleDecl->isInlineStyleDeclaration() && localCopyStyleDecl->parentElement() && localCopyStyleDecl->parentElement()->document())
@@ -114,7 +148,7 @@ public:
 
 private:
     static unsigned s_scopeCount;
-    static CSSMutableStyleDeclaration* s_currentDecl;
+    static StylePropertySet* s_currentDecl;
     static bool s_shouldNotifyInspector;
 #if ENABLE(MUTATION_OBSERVERS)
     static bool s_shouldDeliver;
@@ -125,7 +159,7 @@ private:
 };
 
 unsigned StyleAttributeMutationScope::s_scopeCount = 0;
-CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0;
+StylePropertySet* StyleAttributeMutationScope::s_currentDecl = 0;
 bool StyleAttributeMutationScope::s_shouldNotifyInspector = false;
 #if ENABLE(MUTATION_OBSERVERS)
 bool StyleAttributeMutationScope::s_shouldDeliver = false;
@@ -133,31 +167,30 @@ bool StyleAttributeMutationScope::s_shouldDeliver = false;
 
 } // namespace
 
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
+StylePropertySet::StylePropertySet()
     : m_strictParsing(false)
     , m_isInlineStyleDeclaration(false)
     , m_parent(static_cast<CSSRule*>(0))
 {
 }
 
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule)
+StylePropertySet::StylePropertySet(CSSRule* parentRule)
     : m_strictParsing(!parentRule || parentRule->useStrictParsing())
     , m_isInlineStyleDeclaration(false)
     , m_parent(parentRule)
 {
 }
 
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>& properties)
+StylePropertySet::StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>& properties)
     : m_properties(properties)
     , m_strictParsing(!parentRule || parentRule->useStrictParsing())
     , m_isInlineStyleDeclaration(false)
     , m_parent(parentRule)
 {
     m_properties.shrinkToFit();
-    // FIXME: This allows duplicate properties.
 }
 
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const * properties, int numProperties)
+StylePropertySet::StylePropertySet(CSSRule* parentRule, const CSSProperty* const * properties, int numProperties)
     : m_strictParsing(!parentRule || parentRule->useStrictParsing())
     , m_isInlineStyleDeclaration(false)
     , m_parent(parentRule)
@@ -181,18 +214,30 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parentRule, cons
     }
 }
 
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(StyledElement* parentElement) 
+StylePropertySet::StylePropertySet(StyledElement* parentElement) 
     : m_strictParsing(false)
     , m_isInlineStyleDeclaration(true)
     , m_parent(parentElement)
 { 
 }
 
-CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration()
+StylePropertySet::~StylePropertySet()
 {
 }
 
-CSSStyleSheet* CSSMutableStyleDeclaration::contextStyleSheet() const
+void StylePropertySet::deref()
+{
+    if (derefBase()) {
+        delete this;
+        return;
+    }
+    // StylePropertySet and CSSStyleDeclaration ref each other. When we have a declaration and
+    // our refcount drops to one we know it is the only thing keeping us alive.
+    if (m_cssStyleDeclaration && hasOneRef())
+        m_cssStyleDeclaration.clear();
+}
+
+CSSStyleSheet* StylePropertySet::contextStyleSheet() const
 {
     if (m_isInlineStyleDeclaration) {
         Document* document = m_parent.element ? m_parent.element->document() : 0;
@@ -201,12 +246,12 @@ CSSStyleSheet* CSSMutableStyleDeclaration::contextStyleSheet() const
     return m_parent.rule ? m_parent.rule->parentStyleSheet() : 0;
 }
 
-void CSSMutableStyleDeclaration::copyPropertiesFrom(const CSSMutableStyleDeclaration& other)
+void StylePropertySet::copyPropertiesFrom(const StylePropertySet& other)
 {
     m_properties = other.m_properties;
 }
 
-String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const
+String StylePropertySet::getPropertyValue(int propertyID) const
 {
     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
     if (value)
@@ -377,7 +422,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const
     return String();
 }
 
-String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) const
+String StylePropertySet::borderSpacingValue(const int properties[2]) const
 {
     RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(properties[0]);
     RefPtr<CSSValue> verticalValue = getPropertyCSSValue(properties[1]);
@@ -393,7 +438,7 @@ String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) c
     return horizontalValueCSSText + ' ' + verticalValueCSSText;
 }
 
-bool CSSMutableStyleDeclaration::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const
+bool StylePropertySet::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const
 {
     const CSSProperty* property = findPropertyWithId(propertyId);
     if (!property)
@@ -424,7 +469,7 @@ bool CSSMutableStyleDeclaration::appendFontLonghandValueIfExplicit(int propertyI
     return true;
 }
 
-String CSSMutableStyleDeclaration::fontValue() const
+String StylePropertySet::fontValue() const
 {
     const CSSProperty* fontSizeProperty = findPropertyWithId(CSSPropertyFontSize);
     if (!fontSizeProperty || fontSizeProperty->isImplicit())
@@ -449,7 +494,7 @@ String CSSMutableStyleDeclaration::fontValue() const
     return result.toString();
 }
 
-String CSSMutableStyleDeclaration::get4Values(const int* properties) const
+String StylePropertySet::get4Values(const int* properties) const
 {
     // Assume the properties are in the usual order top, right, bottom, left.
     RefPtr<CSSValue> topValue = getPropertyCSSValue(properties[0]);
@@ -476,7 +521,7 @@ String CSSMutableStyleDeclaration::get4Values(const int* properties) const
     return res;
 }
 
-String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* properties, size_t size) const
+String StylePropertySet::getLayeredShorthandValue(const int* properties, size_t size) const
 {
     String res;
 
@@ -577,7 +622,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie
     return res;
 }
 
-String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size_t size) const
+String StylePropertySet::getShorthandValue(const int* properties, size_t size) const
 {
     String res;
     for (size_t i = 0; i < size; ++i) {
@@ -595,7 +640,7 @@ String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size
 }
 
 // only returns a non-null value if all properties have the same, non-null value
-String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t size) const
+String StylePropertySet::getCommonValue(const int* properties, size_t size) const
 {
     String res;
     for (size_t i = 0; i < size; ++i) {
@@ -613,13 +658,13 @@ String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t
     return res;
 }
 
-PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(int propertyID) const
+PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(int propertyID) const
 {
     const CSSProperty* property = findPropertyWithId(propertyID);
     return property ? property->value() : 0;
 }
 
-bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool notifyChanged)
+bool StylePropertySet::removeShorthandProperty(int propertyID, bool notifyChanged)
 {
     CSSPropertyLonghand longhand = longhandForProperty(propertyID);
     if (!longhand.length())
@@ -627,7 +672,7 @@ bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool no
     return removePropertiesInSet(longhand.properties(), longhand.length(), notifyChanged);
 }
 
-String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyChanged, bool returnText)
+String StylePropertySet::removeProperty(int propertyID, bool notifyChanged, bool returnText)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -658,7 +703,7 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha
     return value;
 }
 
-void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
+void StylePropertySet::setNeedsStyleRecalc()
 {
     if (isInlineStyleDeclaration()) {
         StyledElement* element = parentElement();
@@ -670,13 +715,13 @@ void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
         return;
     }
 
-    if (CSSStyleSheet* styleSheet = parentStyleSheet()) {
+    if (CSSStyleSheet* styleSheet = contextStyleSheet()) {
         if (Document* document = styleSheet->findDocument())
             document->styleSelectorChanged(DeferRecalcStyle);
     }
 }
 
-bool CSSMutableStyleDeclaration::propertyIsImportant(int propertyID) const
+bool StylePropertySet::propertyIsImportant(int propertyID) const
 {
     const CSSProperty* property = findPropertyWithId(propertyID);
     if (property)
@@ -693,19 +738,19 @@ bool CSSMutableStyleDeclaration::propertyIsImportant(int propertyID) const
     return true;
 }
 
-int CSSMutableStyleDeclaration::getPropertyShorthand(int propertyID) const
+int StylePropertySet::getPropertyShorthand(int propertyID) const
 {
     const CSSProperty* property = findPropertyWithId(propertyID);
     return property ? property->shorthandID() : 0;
 }
 
-bool CSSMutableStyleDeclaration::isPropertyImplicit(int propertyID) const
+bool StylePropertySet::isPropertyImplicit(int propertyID) const
 {
     const CSSProperty* property = findPropertyWithId(propertyID);
     return property ? property->isImplicit() : false;
 }
 
-bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, bool notifyChanged)
+bool StylePropertySet::setProperty(int propertyID, const String& value, bool important, bool notifyChanged)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -737,7 +782,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value
     return true;
 }
 
-void CSSMutableStyleDeclaration::setProperty(const CSSProperty& property, CSSProperty* slot)
+void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -757,7 +802,7 @@ void CSSMutableStyleDeclaration::setProperty(const CSSProperty& property, CSSPro
 #endif
 }
 
-bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool important, bool notifyChanged)
+bool StylePropertySet::setProperty(int propertyID, int value, bool important, bool notifyChanged)
 {
     CSSProperty property(propertyID, CSSPrimitiveValue::createIdentifier(value), important);
     setProperty(property);
@@ -766,7 +811,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool imp
     return true;
 }
 
-bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged)
+bool StylePropertySet::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged)
 {
     CSSProperty property(propertyID, CSSPrimitiveValue::create(value, unit), important);
     setProperty(property);
@@ -775,7 +820,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPr
     return true;
 }
 
-void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration)
+void StylePropertySet::parseDeclaration(const String& styleDeclaration)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -792,7 +837,7 @@ void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration
     setNeedsStyleRecalc();
 }
 
-void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* properties, int numProperties)
+void StylePropertySet::addParsedProperties(const CSSProperty* const* properties, int numProperties)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -810,7 +855,7 @@ void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* p
     // a notifyChanged argument to this function to follow the model of other functions in this class.
 }
 
-void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property)
+void StylePropertySet::addParsedProperty(const CSSProperty& property)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -827,19 +872,7 @@ void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property)
 #endif
 }
 
-unsigned CSSMutableStyleDeclaration::length() const
-{
-    return propertyCount();
-}
-
-String CSSMutableStyleDeclaration::item(unsigned i) const
-{
-    if (i >= m_properties.size())
-       return "";
-    return getPropertyName(static_cast<CSSPropertyID>(m_properties[i].id()));
-}
-
-String CSSMutableStyleDeclaration::asText() const
+String StylePropertySet::asText() const
 {
     String result = "";
 
@@ -901,14 +934,7 @@ String CSSMutableStyleDeclaration::asText() const
     return result;
 }
 
-void CSSMutableStyleDeclaration::setCssText(const String& text, ExceptionCode& ec)
-{
-    ec = 0;
-    // FIXME: Detect syntax errors and set ec.
-    parseDeclaration(text);
-}
-
-void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, bool argOverridesOnConflict)
+void StylePropertySet::merge(const StylePropertySet* other, bool argOverridesOnConflict)
 {
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
@@ -934,9 +960,9 @@ void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other,
     // a notifyChanged argument to this function to follow the model of other functions in this class.
 }
 
-void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
+void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
 {
-    CSSStyleSheet* sheet = parentStyleSheet();
+    CSSStyleSheet* sheet = contextStyleSheet();
     size_t size = m_properties.size();
     for (size_t i = 0; i < size; ++i)
         m_properties[i].value()->addSubresourceStyleURLs(urls, sheet);
@@ -970,17 +996,17 @@ static const int blockProperties[] = {
 
 const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties);
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyBlockProperties() const
+PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const
 {
     return copyPropertiesInSet(blockProperties, numBlockProperties);
 }
 
-void CSSMutableStyleDeclaration::removeBlockProperties()
+void StylePropertySet::removeBlockProperties()
 {
     removePropertiesInSet(blockProperties, numBlockProperties);
 }
 
-bool CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged)
+bool StylePropertySet::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged)
 {
     if (m_properties.isEmpty())
         return false;
@@ -1021,17 +1047,7 @@ bool CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned
     return changed;
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::makeMutable()
-{
-    return this;
-}
-
-PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copy() const
-{
-    return adoptRef(new CSSMutableStyleDeclaration(0, m_properties));
-}
-
-const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) const
+const CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) const
 {
     for (int n = m_properties.size() - 1 ; n >= 0; --n) {
         if (propertyID == m_properties[n].m_id)
@@ -1040,7 +1056,7 @@ const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID
     return 0;
 }
 
-CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID)
+CSSProperty* StylePropertySet::findPropertyWithId(int propertyID)
 {
     for (int n = m_properties.size() - 1 ; n >= 0; --n) {
         if (propertyID == m_properties[n].m_id)
@@ -1048,125 +1064,193 @@ CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID)
     }
     return 0;
 }
+    
+bool StylePropertySet::propertyMatches(const CSSProperty* property) const
+{
+    RefPtr<CSSValue> value = getPropertyCSSValue(property->id());
+    return value && value->cssText() == property->value()->cssText();
+}
+    
+void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style)
+{
+    Vector<int> propertiesToRemove;
+    size_t size = m_properties.size();
+    for (size_t i = 0; i < size; ++i) {
+        const CSSProperty& property = m_properties[i];
+        if (style->propertyMatches(&property))
+            propertiesToRemove.append(property.id());
+    }    
+    // FIXME: This should use mass removal.
+    for (unsigned i = 0; i < propertiesToRemove.size(); ++i)
+        removeProperty(propertiesToRemove[i]);
+}
 
-CSSRule* CSSMutableStyleDeclaration::parentRule() const
+void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style)
 {
-    return parentRuleInternal();
+    Vector<int> propertiesToRemove;
+    size_t size = m_properties.size();
+    for (size_t i = 0; i < size; ++i) {
+        const CSSProperty& property = m_properties[i];
+        if (style->cssPropertyMatches(&property))
+            propertiesToRemove.append(property.id());
+    }    
+    // FIXME: This should use mass removal.
+    for (unsigned i = 0; i < propertiesToRemove.size(); ++i)
+        removeProperty(propertiesToRemove[i]);
+}
+
+PassRefPtr<StylePropertySet> StylePropertySet::copy() const
+{
+    return adoptRef(new StylePropertySet(0, m_properties));
+}
+
+PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const int* set, unsigned length) const
+{
+    Vector<CSSProperty> list;
+    list.reserveInitialCapacity(length);
+    for (unsigned i = 0; i < length; ++i) {
+        RefPtr<CSSValue> value = getPropertyCSSValue(set[i]);
+        if (value)
+            list.append(CSSProperty(set[i], value.release(), false));
+    }
+    return StylePropertySet::create(list);
+}
+
+CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() const
+{
+    if (!m_cssStyleDeclaration)
+        m_cssStyleDeclaration = PropertySetCSSStyleDeclaration::create(const_cast<StylePropertySet*>(this));
+    return m_cssStyleDeclaration.get();
+}
+
+unsigned PropertySetCSSStyleDeclaration::length() const
+{
+    return m_propertySet->propertyCount();
+}
+
+String PropertySetCSSStyleDeclaration::item(unsigned i) const
+{
+    if (i >= m_propertySet->propertyCount())
+        return "";
+    return getPropertyName(static_cast<CSSPropertyID>(m_propertySet->propertyAt(i).id()));
+}
+
+CSSRule* PropertySetCSSStyleDeclaration::parentRule() const
+{
+    return m_propertySet->parentRuleInternal();
 }
 
-String CSSMutableStyleDeclaration::cssText() const
+String PropertySetCSSStyleDeclaration::cssText() const
 {
-    return asText();
+    return m_propertySet->asText();
+}
+    
+void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec)
+{
+    ec = 0;
+    // FIXME: Detect syntax errors and set ec.
+    m_propertySet->parseDeclaration(text);
 }
 
-PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(const String& propertyName)
+PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const String& propertyName)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return 0;
-    return getPropertyCSSValue(propertyID);
+    return m_propertySet->getPropertyCSSValue(propertyID);
 }
 
-String CSSMutableStyleDeclaration::getPropertyValue(const String &propertyName)
+String PropertySetCSSStyleDeclaration::getPropertyValue(const String &propertyName)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
-    return getPropertyValue(propertyID);
+    return m_propertySet->getPropertyValue(propertyID);
 }
 
-String CSSMutableStyleDeclaration::getPropertyPriority(const String& propertyName)
+String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
-    return propertyIsImportant(propertyID) ? "important" : "";
+    return m_propertySet->propertyIsImportant(propertyID) ? "important" : "";
 }
 
-String CSSMutableStyleDeclaration::getPropertyShorthand(const String& propertyName)
+String PropertySetCSSStyleDeclaration::getPropertyShorthand(const String& propertyName)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
-    int shorthandID = getPropertyShorthand(propertyID);
+    int shorthandID = m_propertySet->getPropertyShorthand(propertyID);
     if (!shorthandID)
         return String();
     return getPropertyName(static_cast<CSSPropertyID>(shorthandID));
 }
 
-bool CSSMutableStyleDeclaration::isPropertyImplicit(const String& propertyName)
+bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyName)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return false;
-    return isPropertyImplicit(propertyID);
+    return m_propertySet->isPropertyImplicit(propertyID);
 }
 
-void CSSMutableStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
+void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return;
     bool important = priority.find("important", 0, false) != notFound;
     ec = 0;
-    setProperty(propertyID, value, important, true);
+    m_propertySet->setProperty(propertyID, value, important, true);
 }
 
-String CSSMutableStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec)
+String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec)
 {
     int propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
     ec = 0;
-    return removeProperty(propertyID, true, true);
+    return m_propertySet->removeProperty(propertyID, true, true);
 }
 
-PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
+PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
 { 
-    return getPropertyCSSValue(propertyID); 
+    return m_propertySet->getPropertyCSSValue(propertyID); 
 }
 
-String CSSMutableStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
+String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
 { 
-    return getPropertyValue(propertyID); 
+    return m_propertySet->getPropertyValue(propertyID); 
 }
 
-void CSSMutableStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec)
+void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec)
 { 
     ec = 0;
-    setProperty(propertyID, value, important, true);
+    m_propertySet->setProperty(propertyID, value, important, true);
+}
+
+CSSStyleSheet* PropertySetCSSStyleDeclaration::parentStyleSheet() const
+{ 
+    return m_propertySet->contextStyleSheet(); 
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const
+PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const
 {
-    Vector<CSSProperty> list;
-    list.reserveInitialCapacity(length);
-    for (unsigned i = 0; i < length; ++i) {
-        RefPtr<CSSValue> value = getPropertyCSSValue(set[i]);
-        if (value)
-            list.append(CSSProperty(set[i], value.release(), false));
-    }
-    return CSSMutableStyleDeclaration::create(list);
+    return m_propertySet->copy();
 }
 
-bool CSSMutableStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
+PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable()
 {
-    RefPtr<CSSValue> value = getPropertyCSSValue(property->id());
-    return value && value->cssText() == property->value()->cssText();
+    ASSERT(m_propertySet->m_cssStyleDeclaration == this || (!m_propertySet->m_cssStyleDeclaration && m_propertySet->hasOneRef()));
+    if (!m_propertySet->m_cssStyleDeclaration)
+        m_propertySet->m_cssStyleDeclaration = this;
+    return m_propertySet;
 }
 
-void CSSMutableStyleDeclaration::removeEquivalentProperties(const CSSStyleDeclaration* style)
+bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
 {
-    Vector<int> propertiesToRemove;
-    size_t size = m_properties.size();
-    for (size_t i = 0; i < size; ++i) {
-        const CSSProperty& property = m_properties[i];
-        if (style->cssPropertyMatches(&property))
-            propertiesToRemove.append(property.id());
-    }    
-    // FIXME: This should use mass removal.
-    for (unsigned i = 0; i < propertiesToRemove.size(); ++i)
-        removeProperty(propertiesToRemove[i]);
+    return m_propertySet->propertyMatches(property);
 }
 
 } // namespace WebCore
index 5f4fc09..e22340d 100644 (file)
 
 namespace WebCore {
 
+class PropertySetCSSStyleDeclaration;
 class StyledElement;
 
-class CSSMutableStyleDeclaration : public CSSStyleDeclaration {
+class StylePropertySet : public WTF::RefCountedBase {
 public:
-    virtual ~CSSMutableStyleDeclaration();
+    ~StylePropertySet();
 
-    static PassRefPtr<CSSMutableStyleDeclaration> create()
+    static PassRefPtr<StylePropertySet> create()
     {
-        return adoptRef(new CSSMutableStyleDeclaration);
+        return adoptRef(new StylePropertySet);
     }
-    static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule)
+    static PassRefPtr<StylePropertySet> create(CSSRule* parentRule)
     {
-        return adoptRef(new CSSMutableStyleDeclaration(parentRule));
+        return adoptRef(new StylePropertySet(parentRule));
     }
-    static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties)
+    static PassRefPtr<StylePropertySet> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties)
     {
-        return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties));
+        return adoptRef(new StylePropertySet(parentRule, properties, numProperties));
     }
-    static PassRefPtr<CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties)
+    static PassRefPtr<StylePropertySet> create(const Vector<CSSProperty>& properties)
     {
-        return adoptRef(new CSSMutableStyleDeclaration(0, properties));
+        return adoptRef(new StylePropertySet(0, properties));
     }
-    static PassRefPtr<CSSMutableStyleDeclaration> createInline(StyledElement* element)
+    static PassRefPtr<StylePropertySet> createInline(StyledElement* element)
     { 
-        return adoptRef(new CSSMutableStyleDeclaration(element));
+        return adoptRef(new StylePropertySet(element));
     }
 
+    void deref();
+
     unsigned propertyCount() const { return m_properties.size(); }
     bool isEmpty() const { return m_properties.isEmpty(); }
     const CSSProperty& propertyAt(unsigned index) const { return m_properties[index]; }
@@ -68,8 +71,6 @@ public:
     int getPropertyShorthand(int propertyID) const;
     bool isPropertyImplicit(int propertyID) const;
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
-
     bool setProperty(int propertyID, int value, bool important = false) { return setProperty(propertyID, value, important, true); }
     bool setProperty(int propertyId, double value, CSSPrimitiveValue::UnitTypes unit, bool important = false) { return setProperty(propertyId, value, unit, important, true); }
     bool setProperty(int propertyID, const String& value, bool important = false) { return setProperty(propertyID, value, important, true); }
@@ -87,11 +88,11 @@ public:
     // This does no change notifications since it's only called by createMarkup.
     void addParsedProperty(const CSSProperty&);
 
-    PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const;
+    PassRefPtr<StylePropertySet> copyBlockProperties() const;
     void removeBlockProperties();
     void removePropertiesInSet(const int* set, unsigned length) { removePropertiesInSet(set, length, true); }
 
-    void merge(const CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);
+    void merge(const StylePropertySet*, bool argOverridesOnConflict = true);
 
     void setStrictParsing(bool b) { m_strictParsing = b; }
     bool useStrictParsing() const { return m_strictParsing; }
@@ -99,12 +100,14 @@ public:
 
     void addSubresourceStyleURLs(ListHashSet<KURL>&);
 
+    PassRefPtr<StylePropertySet> copy() const;
     // Used by StyledElement::copyNonAttributeProperties().
-    void copyPropertiesFrom(const CSSMutableStyleDeclaration&);
+    void copyPropertiesFrom(const StylePropertySet&);
 
+    void removeEquivalentProperties(const StylePropertySet*);
     void removeEquivalentProperties(const CSSStyleDeclaration*);
 
-    PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;
+    PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const;
 
     CSSRule* parentRuleInternal() const { return m_isInlineStyleDeclaration ? 0 : m_parent.rule; }
     void clearParentRule() { ASSERT(!m_isInlineStyleDeclaration); m_parent.rule = 0; }
@@ -115,32 +118,15 @@ public:
     CSSStyleSheet* contextStyleSheet() const;
     
     String asText() const;
+    
+    CSSStyleDeclaration* ensureCSSStyleDeclaration() const;
 
 private:
-    CSSMutableStyleDeclaration();
-    CSSMutableStyleDeclaration(CSSRule* parentRule);
-    CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&);
-    CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties);
-    CSSMutableStyleDeclaration(StyledElement*);
-
-    virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
-
-    // CSSOM functions. Don't make these public.
-    virtual CSSRule* parentRule() const;
-    virtual unsigned length() const;
-    virtual String item(unsigned index) const;
-    virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName);
-    virtual String getPropertyValue(const String& propertyName);
-    virtual String getPropertyPriority(const String& propertyName);
-    virtual String getPropertyShorthand(const String& propertyName);
-    virtual bool isPropertyImplicit(const String& propertyName);
-    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&);
-    virtual String removeProperty(const String& propertyName, ExceptionCode&);
-    virtual String cssText() const;
-    virtual void setCssText(const String&, ExceptionCode&);
-    virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID);
-    virtual String getPropertyValueInternal(CSSPropertyID);
-    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&);
+    StylePropertySet();
+    StylePropertySet(CSSRule* parentRule);
+    StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>&);
+    StylePropertySet(CSSRule* parentRule, const CSSProperty* const *, int numProperties);
+    StylePropertySet(StyledElement*);
 
     void setNeedsStyleRecalc();
 
@@ -161,9 +147,7 @@ private:
     bool setProperty(int propertyID, const String& value, bool important, bool notifyChanged);
     bool removeShorthandProperty(int propertyID, bool notifyChanged);
     bool removePropertiesInSet(const int* set, unsigned length, bool notifyChanged);
-
-    virtual bool cssPropertyMatches(const CSSProperty*) const;
-    virtual CSSStyleSheet* parentStyleSheet() const { return contextStyleSheet(); }
+    bool propertyMatches(const CSSProperty*) const;
 
     const CSSProperty* findPropertyWithId(int propertyId) const;
     CSSProperty* findPropertyWithId(int propertyId);
@@ -178,7 +162,11 @@ private:
         Parent(StyledElement* element) : element(element) { }
         CSSRule* rule;
         StyledElement* element;
-    } m_parent;    
+    } m_parent;
+    
+    mutable RefPtr<PropertySetCSSStyleDeclaration> m_cssStyleDeclaration;
+    
+    friend class PropertySetCSSStyleDeclaration;
 };
 
 } // namespace WebCore
index 59e9dcf..6871149 100644 (file)
@@ -28,7 +28,6 @@
 
 namespace WebCore {
 
-class CSSMutableStyleDeclaration;
 class CSSSelector;
 class CSSSelectorList;
 
index 7cda4ae..de59959 100644 (file)
@@ -326,7 +326,7 @@ static inline bool isColorPropertyID(int propertyId)
     }
 }
 
-static bool parseColorValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)
+static bool parseColorValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)
 {
     if (!string.length())
         return false;
@@ -409,7 +409,7 @@ static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativ
     }
 }
 
-static bool parseSimpleLengthValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)
+static bool parseSimpleLengthValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0)
 {
     bool acceptsNegativeNumbers;
     unsigned length = string.length();
@@ -498,7 +498,7 @@ bool CSSParser::parseMappedAttributeValue(CSSMappedAttributeDeclaration* mappedA
     return parser.parseValue(mappedAttribute->declaration(), propertyId, value, false, elementSheet);
 }
 
-bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict)
+bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict)
 {
     if (parseSimpleLengthValue(declaration, propertyId, string, important, strict))
         return true;
@@ -508,7 +508,7 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int property
     return parser.parseValue(declaration, propertyId, string, important);
 }
 
-bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
+bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
 {
     if (contextStyleSheet)
         setStyleSheet(contextStyleSheet);
@@ -608,7 +608,7 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
     ASSERT(dummyStyleSheet->hasOneRef());
 }
 
-bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet)
+bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet)
 {
     // Length of the "@-webkit-decls{" prefix.
     static const unsigned prefixLength = 15;
@@ -8847,7 +8847,7 @@ CSSRule* CSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selector
         rule->adoptSelectorVector(*selectors);
         if (m_hasFontFaceOnlyValues)
             deleteFontFaceOnlyValues();
-        rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));
+        rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties));
         result = rule.get();
         m_parsedRules.append(rule.release());
         if (m_ruleRangeMap) {
@@ -8886,7 +8886,7 @@ CSSRule* CSSParser::createFontFaceRule()
         }
     }
     RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet);
-    rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));
+    rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties));
     clearProperties();
     CSSFontFaceRule* result = rule.get();
     m_parsedRules.append(rule.release());
@@ -8957,7 +8957,7 @@ CSSRule* CSSParser::createPageRule(PassOwnPtr<CSSParserSelector> pageSelector)
         Vector<OwnPtr<CSSParserSelector> > selectorVector;
         selectorVector.append(pageSelector);
         rule->adoptSelectorVector(selectorVector);
-        rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));
+        rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties));
         pageRule = rule.get();
         m_parsedRules.append(rule.release());
     }
@@ -9041,7 +9041,7 @@ WebKitCSSKeyframeRule* CSSParser::createKeyframeRule(CSSParserValueList* keys)
 
     RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(m_styleSheet);
     keyframe->setKeyText(keyString);
-    keyframe->setDeclaration(CSSMutableStyleDeclaration::create(keyframe.get(), m_parsedProperties, m_numParsedProperties));
+    keyframe->setDeclaration(StylePropertySet::create(keyframe.get(), m_parsedProperties, m_numParsedProperties));
 
     clearProperties();
 
index b7384ee..e18a570 100644 (file)
@@ -44,7 +44,6 @@ namespace WebCore {
 
 class CSSBorderImageSliceValue;
 class CSSMappedAttributeDeclaration;
-class CSSMutableStyleDeclaration;
 class CSSPrimitiveValue;
 class CSSValuePool;
 class CSSProperty;
@@ -58,6 +57,7 @@ class CSSWrapShape;
 class Document;
 class MediaList;
 class MediaQueryExp;
+class StylePropertySet;
 class StyledElement;
 class WebKitCSSKeyframeRule;
 class WebKitCSSKeyframesRule;
@@ -70,11 +70,11 @@ public:
     void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0);
     PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&);
     PassRefPtr<WebKitCSSKeyframeRule> parseKeyframeRule(CSSStyleSheet*, const String&);
-    static bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict);
+    static bool parseValue(StylePropertySet*, int propId, const String&, bool important, bool strict);
     static bool parseColor(RGBA32& color, const String&, bool strict = false);
     static bool parseSystemColor(RGBA32& color, const String&, Document*);
     PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*);
-    bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0);
+    bool parseDeclaration(StylePropertySet*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0);
     bool parseMediaQuery(MediaList*, const String&);
 
     static bool parseMappedAttributeValue(CSSMappedAttributeDeclaration*, StyledElement*, int propertyId, const String&);
@@ -358,7 +358,7 @@ private:
     bool isGeneratedImageValue(CSSParserValue*) const;
     bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&);
 
-    bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0);
+    bool parseValue(StylePropertySet*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0);
 
     enum SizeParameterType {
         None,
index a55071f..e5e7cb9 100644 (file)
 
 namespace WebCore {
 
-class CSSMutableStyleDeclaration;
 class CSSProperty;
 class CSSStyleSheet;
 class CSSValue;
+class StylePropertySet;
 class StyledElement;
 
 typedef int ExceptionCode;
@@ -59,8 +59,8 @@ public:
     virtual String getPropertyValueInternal(CSSPropertyID) = 0;
     virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0;
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const = 0;
-    virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable() = 0;
+    virtual PassRefPtr<StylePropertySet> copy() const = 0;
+    virtual PassRefPtr<StylePropertySet> makeMutable() = 0;
 
     virtual bool cssPropertyMatches(const CSSProperty*) const = 0;
     virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
index 0a21577..6c430a8 100644 (file)
@@ -43,15 +43,15 @@ public:
     String selectorText() const;
     void setSelectorText(const String&);
 
-    CSSStyleDeclaration* style() const { return m_style.get(); }
+    CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); }
 
     String cssText() const;
 
     void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
-    void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style) { ASSERT(style->parentRuleInternal() == this); m_style = style; }
+    void setDeclaration(PassRefPtr<StylePropertySet> style) { ASSERT(style->parentRuleInternal() == this); m_style = style; }
 
     const CSSSelectorList& selectorList() const { return m_selectorList; }
-    CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
+    StylePropertySet* declaration() const { return m_style.get(); }
 
     void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
 
@@ -64,7 +64,7 @@ private:
     void cleanup();
     String generateSelectorText() const;
 
-    RefPtr<CSSMutableStyleDeclaration> m_style;
+    RefPtr<StylePropertySet> m_style;
     CSSSelectorList m_selectorList;
 };
 
index 84c302a..169e5fd 100644 (file)
@@ -297,17 +297,17 @@ static const MediaQueryEvaluator& printEval()
     return staticPrintEval;
 }
 
-static CSSMutableStyleDeclaration* leftToRightDeclaration()
+static StylePropertySet* leftToRightDeclaration()
 {
-    DEFINE_STATIC_LOCAL(RefPtr<CSSMutableStyleDeclaration>, leftToRightDecl, (CSSMutableStyleDeclaration::create()));
+    DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, leftToRightDecl, (StylePropertySet::create()));
     if (leftToRightDecl->isEmpty())
         leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr);
     return leftToRightDecl.get();
 }
 
-static CSSMutableStyleDeclaration* rightToLeftDeclaration()
+static StylePropertySet* rightToLeftDeclaration()
 {
-    DEFINE_STATIC_LOCAL(RefPtr<CSSMutableStyleDeclaration>, rightToLeftDecl, (CSSMutableStyleDeclaration::create()));
+    DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, rightToLeftDecl, (StylePropertySet::create()));
     if (rightToLeftDecl->isEmpty())
         rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl);
     return rightToLeftDecl.get();
@@ -747,7 +747,7 @@ static void ensureDefaultStyleSheetsForElement(Element* element)
     ASSERT_UNUSED(loadedMathMLUserAgentSheet, loadedMathMLUserAgentSheet || defaultStyle->features().siblingRules.isEmpty());
 }
 
-void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType)
+void CSSStyleSelector::addMatchedDeclaration(StylePropertySet* styleDeclaration, unsigned linkMatchType)
 {
     m_matchedDecls.grow(m_matchedDecls.size() + 1);
     MatchedStyleDeclaration& newDeclaration = m_matchedDecls.last();
@@ -940,7 +940,7 @@ void CSSStyleSelector::collectMatchingRulesForList(const Vector<RuleData>* rules
                 continue;
             }
             // If the rule has no properties to apply, then ignore it in the non-debug mode.
-            CSSMutableStyleDeclaration* decl = rule->declaration();
+            StylePropertySet* decl = rule->declaration();
             if (!decl || (decl->isEmpty() && !includeEmptyRules)) {
                 InspectorInstrumentation::didMatchRule(cookie, false);
                 continue;
@@ -1013,7 +1013,7 @@ void CSSStyleSelector::matchAllRules(MatchResult& result)
         // Now we check additional mapped declarations.
         // Tables and table cells share an additional mapped rule that must be applied
         // after all attributes, since their mapped style depends on the values of multiple attributes.
-        if (RefPtr<CSSMutableStyleDeclaration> additionalStyle = m_styledElement->additionalAttributeStyle()) {
+        if (RefPtr<StylePropertySet> additionalStyle = m_styledElement->additionalAttributeStyle()) {
             if (result.ranges.firstAuthorRule == -1)
                 result.ranges.firstAuthorRule = m_matchedDecls.size();
             result.ranges.lastAuthorRule = m_matchedDecls.size();
@@ -1035,7 +1035,7 @@ void CSSStyleSelector::matchAllRules(MatchResult& result)
 
     // Now check our inline style attribute.
     if (m_matchAuthorAndUserStyles && m_styledElement) {
-        CSSMutableStyleDeclaration* inlineDecl = m_styledElement->inlineStyleDecl();
+        StylePropertySet* inlineDecl = m_styledElement->inlineStyleDecl();
         if (inlineDecl) {
             result.ranges.lastAuthorRule = m_matchedDecls.size();
             if (result.ranges.firstAuthorRule == -1)
@@ -1530,7 +1530,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* element, Rend
 
 PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeValue& keyframe)
 {
-    if (keyframeRule->style())
+    if (keyframeRule->declaration())
         addMatchedDeclaration(keyframeRule->declaration());
 
     ASSERT(!m_style);
@@ -1570,7 +1570,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* el
 #endif
 
     // Add all the animating properties to the keyframe.
-    if (CSSMutableStyleDeclaration* styleDeclaration = keyframeRule->declaration()) {
+    if (StylePropertySet* styleDeclaration = keyframeRule->declaration()) {
         unsigned propertyCount = styleDeclaration->propertyCount();
         for (unsigned i = 0; i < propertyCount; ++i) {
             int property = styleDeclaration->propertyAt(i).id();
@@ -2435,7 +2435,7 @@ static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyl
     return convertToLength(primitiveValue, style, rootStyle, true, multiplier, ok);
 }
 
-static inline bool isInsideRegionRule(CSSMutableStyleDeclaration* styleDeclaration)
+static inline bool isInsideRegionRule(StylePropertySet* styleDeclaration)
 {
     ASSERT(styleDeclaration);
 
@@ -2449,7 +2449,7 @@ static inline bool isInsideRegionRule(CSSMutableStyleDeclaration* styleDeclarati
 }
 
 template <bool applyFirst>
-void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclaration, bool isImportant, bool inheritedOnly)
+void CSSStyleSelector::applyDeclaration(StylePropertySet* styleDeclaration, bool isImportant, bool inheritedOnly)
 {
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), styleDeclaration->parentRuleInternal());
     bool styleDeclarationInsideRegionRule = m_regionForStyling ? isInsideRegionRule(styleDeclaration) : false;
@@ -2501,7 +2501,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e
 
     if (m_style->insideLink() != NotInsideLink) {
         for (int i = startIndex; i <= endIndex; ++i) {
-            CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration.get();
+            StylePropertySet* styleDeclaration = m_matchedDecls[i].styleDeclaration.get();
             unsigned linkMatchType = m_matchedDecls[i].linkMatchType;
             // FIXME: It would be nicer to pass these as arguments but that requires changes in many places.
             m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;
@@ -2720,7 +2720,7 @@ void CSSStyleSelector::matchPageRulesForList(const Vector<RuleData>* rules, bool
             continue;
 
         // If the rule has no properties to apply, then ignore it.
-        CSSMutableStyleDeclaration* decl = rule->declaration();
+        StylePropertySet* decl = rule->declaration();
         if (!decl || decl->isEmpty())
             continue;
 
index 633f703..844235a 100644 (file)
@@ -38,7 +38,6 @@ namespace WebCore {
 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimumForFontFize };
 
 class CSSFontSelector;
-class CSSMutableStyleDeclaration;
 class CSSPageRule;
 class CSSPrimitiveValue;
 class CSSProperty;
@@ -70,6 +69,7 @@ class RuleSet;
 class Settings;
 class StyleImage;
 class StylePendingImage;
+class StylePropertySet;
 class StyleShader;
 class StyleSheet;
 class StyleSheetList;
@@ -259,7 +259,7 @@ private:
     void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*);
 
     void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); }
-    void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll);
+    void addMatchedDeclaration(StylePropertySet*, unsigned linkMatchType = SelectorChecker::MatchAll);
 
     struct MatchRanges {
         MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1), firstUserRule(-1), lastUserRule(-1) { }
@@ -294,7 +294,7 @@ private:
     template <bool firstPass>
     void applyDeclarations(bool important, int startIndex, int endIndex, bool inheritedOnly);
     template <bool firstPass>
-    void applyDeclaration(CSSMutableStyleDeclaration*, bool isImportant, bool inheritedOnly);
+    void applyDeclaration(StylePropertySet*, bool isImportant, bool inheritedOnly);
 
     static bool isValidRegionStyleProperty(int id);
 
@@ -375,7 +375,7 @@ private:
     struct MatchedStyleDeclaration {
         MatchedStyleDeclaration() : possiblyPaddedMember(0) { }
 
-        RefPtr<CSSMutableStyleDeclaration> styleDeclaration;
+        RefPtr<StylePropertySet> styleDeclaration;
         union {
             unsigned linkMatchType;
             // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object.
index a324237..f963d2c 100644 (file)
@@ -52,7 +52,7 @@ String WebKitCSSKeyframeRule::cssText() const
     return result;
 }
 
-void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style)
+void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<StylePropertySet> style)
 {
     ASSERT(style->parentRuleInternal() == this);
     m_style = style;
index 0835187..81bbb3a 100644 (file)
@@ -53,19 +53,19 @@ public:
 
     void getKeys(Vector<float>& keys) const   { parseKeyString(m_key, keys); }
 
-    CSSStyleDeclaration* style() const { return m_style.get(); }
+    CSSStyleDeclaration* style() const { return m_style ? m_style->ensureCSSStyleDeclaration() : 0; }
 
     String cssText() const;
 
-    CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
-    void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>);
+    StylePropertySet* declaration() const { return m_style.get(); }
+    void setDeclaration(PassRefPtr<StylePropertySet>);
 
 private:
     static void parseKeyString(const String& s, Vector<float>& keys);
 
     WebKitCSSKeyframeRule(CSSStyleSheet* parent);
 
-    RefPtr<CSSMutableStyleDeclaration> m_style;
+    RefPtr<StylePropertySet> m_style;
     String m_key;        // comma separated list of keys
 };
 
index f61719e..ace48d5 100644 (file)
@@ -52,7 +52,7 @@ WebKitCSSMatrix::~WebKitCSSMatrix()
 
 void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec)
 {
-    RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create();
     if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, true)) {
         // Convert to TransformOperations. This can fail if a property
         // requires style (i.e., param uses 'ems' or 'exs')
index 7b6e332..1f57b17 100644 (file)
@@ -56,7 +56,7 @@ public:
     bool isId() const;
 
     // An extension to get presentational information for attributes.
-    CSSStyleDeclaration* style() { return m_attribute->decl(); }
+    CSSStyleDeclaration* style() { return m_attribute->decl()->ensureCSSStyleDeclaration(); }
 
     void setSpecified(bool specified) { m_specified = specified; }
 
index 938e192..67387e0 100644 (file)
@@ -69,7 +69,7 @@ public:
     
     PassRefPtr<Attribute> clone() const;
     
-    CSSMutableStyleDeclaration* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; }
+    StylePropertySet* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; }
 
     CSSMappedAttributeDeclaration* mappedAttributeDeclaration() const { return m_mappedAttributeDeclaration.get(); }
     void setMappedAttributeDeclaration(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_mappedAttributeDeclaration = decl; }
index d9544ed..4e10089 100644 (file)
@@ -58,11 +58,11 @@ public:
 
     void removeMappedProperty(StyledElement*, int propertyId);
     
-    CSSMutableStyleDeclaration* declaration() const { return m_declaration.get(); }
+    StylePropertySet* declaration() const { return m_declaration.get(); }
 
 private:
     CSSMappedAttributeDeclaration()
-        : m_declaration(CSSMutableStyleDeclaration::create())
+        : m_declaration(StylePropertySet::create())
         , m_entryType(eNone)
         , m_attrName(anyQName())
     {
@@ -70,7 +70,7 @@ private:
 
     void setNeedsStyleRecalc(StyledElement*);
 
-    RefPtr<CSSMutableStyleDeclaration> m_declaration;
+    RefPtr<StylePropertySet> m_declaration;
     MappedAttributeEntry m_entryType;
     QualifiedName m_attrName;
     AtomicString m_attrValue;
index 6ef4bc7..edbbcdd 100644 (file)
@@ -811,7 +811,7 @@ PassRefPtr<EditingText> Document::createEditingTextNode(const String& text)
 
 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
 {
-    return CSSMutableStyleDeclaration::create();
+    return StylePropertySet::create()->ensureCSSStyleDeclaration();
 }
 
 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec)
index 20116c6..a9a021c 100644 (file)
@@ -49,7 +49,7 @@ private:
     {
     }
 
-    RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
+    RefPtr<StylePropertySet> m_inlineStyleDecl;
     SpaceSplitString m_classNames;
     AtomicString m_idForStyleResolution;
 };
index 7f62297..18936e5 100644 (file)
@@ -321,11 +321,11 @@ bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const
     return true;
 }
 
-CSSMutableStyleDeclaration* NamedNodeMap::ensureInlineStyleDecl()
+StylePropertySet* NamedNodeMap::ensureInlineStyleDecl()
 {
     if (!attributeData()->m_inlineStyleDecl) {
         ASSERT(m_element->isStyledElement());
-        attributeData()->m_inlineStyleDecl = CSSMutableStyleDeclaration::createInline(static_cast<StyledElement*>(m_element));
+        attributeData()->m_inlineStyleDecl = StylePropertySet::createInline(static_cast<StyledElement*>(m_element));
         attributeData()->m_inlineStyleDecl->setStrictParsing(m_element->isHTMLElement() && !m_element->document()->inQuirksMode());
     }
     return attributeData()->m_inlineStyleDecl.get();
index f53047c..d3bb1df 100644 (file)
@@ -99,8 +99,8 @@ public:
     ElementAttributeData* attributeData() { return &m_attributeData; }
     const ElementAttributeData* attributeData() const { return &m_attributeData; }
 
-    CSSMutableStyleDeclaration* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); }
-    CSSMutableStyleDeclaration* ensureInlineStyleDecl();
+    StylePropertySet* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); }
+    StylePropertySet* ensureInlineStyleDecl();
     void destroyInlineStyleDecl();
 
 private:
index 25f2cd8..322b74e 100644 (file)
@@ -112,7 +112,7 @@ void StyledElement::updateStyleAttribute() const
     ASSERT(!isStyleAttributeValid());
     setIsStyleAttributeValid();
     setIsSynchronizingStyleAttribute();
-    if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())
+    if (StylePropertySet* inlineStyle = inlineStyleDecl())
         const_cast<StyledElement*>(this)->setAttribute(styleAttr, inlineStyle->asText());
     clearIsSynchronizingStyleAttribute();
 }
@@ -405,7 +405,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
     if (!source->inlineStyleDecl())
         return;
 
-    CSSMutableStyleDeclaration* inlineStyle = ensureInlineStyleDecl();
+    StylePropertySet* inlineStyle = ensureInlineStyleDecl();
     inlineStyle->copyPropertiesFrom(*source->inlineStyleDecl());
     inlineStyle->setStrictParsing(source->inlineStyleDecl()->useStrictParsing());
 
@@ -417,7 +417,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
 
 void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
 {
-    if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())
+    if (StylePropertySet* inlineStyle = inlineStyleDecl())
         inlineStyle->addSubresourceStyleURLs(urls);
 }
 
index d61f0af..bdac0da 100644 (file)
@@ -55,12 +55,12 @@ public:
     static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
     static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() { return 0; }
+    virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() { return 0; }
     void invalidateStyleAttribute();
 
-    CSSMutableStyleDeclaration* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; }
-    CSSMutableStyleDeclaration* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); }
-    virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl(); }
+    StylePropertySet* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; }
+    StylePropertySet* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); }
+    virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl()->ensureCSSStyleDeclaration(); }
 
     const SpaceSplitString& classNames() const;
 
index 43820c4..61e2c41 100644 (file)
@@ -384,7 +384,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
         }
         lastStyledNode = node;
 
-        CSSMutableStyleDeclaration* inlineStyleDecl = element->ensureInlineStyleDecl();
+        StylePropertySet* inlineStyleDecl = element->ensureInlineStyleDecl();
         float currentFontSize = computedFontSize(node);
         float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta());
         RefPtr<CSSValue> value = inlineStyleDecl->getPropertyCSSValue(CSSPropertyFontSize);
@@ -511,7 +511,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp
             // other attributes, like we (should) do with B and I elements.
             removeNodeAttribute(element, dirAttr);
         } else {
-            RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy();
+            RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy();
             inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
             inlineStyle->removeProperty(CSSPropertyDirection);
             setNodeAttribute(element, styleAttr, inlineStyle->asText());
@@ -725,7 +725,7 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, Node* n
                 break;
             // Add to this element's inline style and skip over its contents.
             HTMLElement* element = toHTMLElement(node);
-            RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy();
+            RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy();
             inlineStyle->merge(style->style());
             setNodeAttribute(element, styleAttr, inlineStyle->asText());
             next = node->traverseNextSibling();
@@ -890,7 +890,7 @@ bool ApplyStyleCommand::removeCSSStyle(EditingStyle* style, HTMLElement* element
     if (!style->conflictsWithInlineStyleOfElement(element, extractedStyle, properties))
         return false;
 
-    CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();
+    StylePropertySet* inlineStyle = element->inlineStyleDecl();
     ASSERT(inlineStyle);
     // FIXME: We should use a mass-removal function here but we don't have an undoable one yet.
     for (size_t i = 0; i < properties.size(); i++)
@@ -1310,7 +1310,7 @@ void ApplyStyleCommand::addBlockStyle(const StyleChange& styleChange, HTMLElemen
         return;
         
     String cssText = styleChange.cssStyle();
-    if (CSSMutableStyleDeclaration* decl = block->inlineStyleDecl())
+    if (StylePropertySet* decl = block->inlineStyleDecl())
         cssText += decl->asText();
     setNodeAttribute(block, styleAttr, cssText);
 }
@@ -1375,7 +1375,7 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, PassRefPtr<N
 
     if (styleChange.cssStyle().length()) {
         if (styleContainer) {
-            if (CSSMutableStyleDeclaration* existingStyle = styleContainer->inlineStyleDecl())
+            if (StylePropertySet* existingStyle = styleContainer->inlineStyleDecl())
                 setNodeAttribute(styleContainer, styleAttr, existingStyle->asText() + styleChange.cssStyle());
             else
                 setNodeAttribute(styleContainer, styleAttr, styleChange.cssStyle());
index 870a678..6122dab 100644 (file)
@@ -205,7 +205,7 @@ void DeleteButtonController::createDeletionUI()
     RefPtr<HTMLDivElement> container = HTMLDivElement::create(m_target->document());
     container->setIdAttribute(containerElementIdentifier);
 
-    CSSMutableStyleDeclaration* style = container->ensureInlineStyleDecl();
+    StylePropertySet* style = container->ensureInlineStyleDecl();
     style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone);
     style->setProperty(CSSPropertyWebkitUserSelect, CSSValueNone);
     style->setProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly);
index 7e5441d..eb2f320 100644 (file)
@@ -83,7 +83,7 @@ static const int editingProperties[] = {
 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingProperties };
 
 template <class StyleDeclarationType>
-static PassRefPtr<CSSMutableStyleDeclaration> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties)
+static PassRefPtr<StylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties)
 {
     if (type == AllEditingProperties)
         return style->copyPropertiesInSet(editingProperties, WTF_ARRAY_LENGTH(editingProperties));
@@ -99,17 +99,19 @@ static inline bool isEditingProperty(int id)
     return false;
 }
 
-static PassRefPtr<CSSMutableStyleDeclaration> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties)
+static PassRefPtr<StylePropertySet> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties)
 {
     if (!style)
-        return CSSMutableStyleDeclaration::create();
+        return StylePropertySet::create();
     return copyEditingProperties(style.get(), type);
 }
 
-static RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle);
+static PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle);
 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelValuesMatch };
 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode);
+static bool isTransparentColorValue(CSSValue*);
 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*);
+static bool hasTransparentBackgroundColor(StylePropertySet*);
 static PassRefPtr<CSSValue> backgroundColorInEffect(Node*);
 
 class HTMLElementEquivalent {
@@ -122,8 +124,8 @@ public:
     virtual ~HTMLElementEquivalent() { }
     virtual bool matches(const Element* element) const { return !m_tagName || element->hasTagName(*m_tagName); }
     virtual bool hasAttribute() const { return false; }
-    virtual bool propertyExistsInStyle(CSSMutableStyleDeclaration* style) const { return style && style->getPropertyCSSValue(m_propertyID); }
-    virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;
+    virtual bool propertyExistsInStyle(StylePropertySet* style) const { return style && style->getPropertyCSSValue(m_propertyID); }
+    virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const;
     virtual void addToStyle(Element*, EditingStyle*) const;
 
 protected:
@@ -155,7 +157,7 @@ HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, int primitiveValu
     ASSERT(primitiveValue != CSSValueInvalid);
 }
 
-bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const
+bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const
 {
     RefPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID);
     return matches(element) && value && value->isPrimitiveValue() && static_cast<CSSPrimitiveValue*>(value.get())->getIdent() == m_primitiveValue->getIdent();
@@ -172,8 +174,8 @@ public:
     {
         return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName));
     }
-    virtual bool propertyExistsInStyle(CSSMutableStyleDeclaration*) const;
-    virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;
+    virtual bool propertyExistsInStyle(StylePropertySet*) const;
+    virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const;
 
 private:
     HTMLTextDecorationEquivalent(int primitiveValue, const QualifiedName& tagName);
@@ -185,12 +187,12 @@ HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(int primitiveValue, c
 {
 }
 
-bool HTMLTextDecorationEquivalent::propertyExistsInStyle(CSSMutableStyleDeclaration* style) const
+bool HTMLTextDecorationEquivalent::propertyExistsInStyle(StylePropertySet* style) const
 {
     return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) || style->getPropertyCSSValue(CSSPropertyTextDecoration);
 }
 
-bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const
+bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const
 {
     RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
     if (!styleValue)
@@ -211,7 +213,7 @@ public:
 
     bool matches(const Element* elem) const { return HTMLElementEquivalent::matches(elem) && elem->hasAttribute(m_attrName); }
     virtual bool hasAttribute() const { return true; }
-    virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const;
+    virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const;
     virtual void addToStyle(Element*, EditingStyle*) const;
     virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const;
     inline const QualifiedName& attributeName() const { return m_attrName; }
@@ -234,7 +236,7 @@ HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
 {
 }
 
-bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const
+bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const
 {
     RefPtr<CSSValue> value = attributeValueAsCSSValue(element);
     RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID);
@@ -256,8 +258,8 @@ PassRefPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSValue(Element*
     if (!element->hasAttribute(m_attrName))
         return 0;
     
-    RefPtr<CSSMutableStyleDeclaration> dummyStyle;
-    dummyStyle = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> dummyStyle;
+    dummyStyle = StylePropertySet::create();
     dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName));
     return dummyStyle->getPropertyCSSValue(m_propertyID);
 }
@@ -312,6 +314,14 @@ EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
     init(position.deprecatedNode(), propertiesToInclude);
 }
 
+EditingStyle::EditingStyle(const StylePropertySet* style)
+    : m_mutableStyle(style ? style->copy() : 0)
+    , m_shouldUseFixedDefaultFontSize(false)
+    , m_fontSizeDelta(NoFontDelta)
+{
+    extractFontSizeDelta();
+}
+
 EditingStyle::EditingStyle(const CSSStyleDeclaration* style)
     : m_mutableStyle(style ? style->copy() : 0)
     , m_shouldUseFixedDefaultFontSize(false)
@@ -351,6 +361,11 @@ static inline RGBA32 getRGBAFontColor(CSSStyleDeclaration* style)
     return cssValueToRGBA(style->getPropertyCSSValueInternal(CSSPropertyColor).get());
 }
 
+static inline RGBA32 getRGBAFontColor(StylePropertySet* style)
+{
+    return cssValueToRGBA(style->getPropertyCSSValue(CSSPropertyColor).get());
+}
+
 static inline RGBA32 rgbaBackgroundColorInEffect(Node* node)
 {
     return cssValueToRGBA(backgroundColorInEffect(node).get());
@@ -397,7 +412,7 @@ void EditingStyle::removeTextFillAndStrokeColorsIfNeeded(RenderStyle* renderStyl
 void EditingStyle::setProperty(int propertyID, const String& value, bool important)
 {
     if (!m_mutableStyle)
-        m_mutableStyle = CSSMutableStyleDeclaration::create();
+        m_mutableStyle = StylePropertySet::create();
 
     m_mutableStyle->setProperty(propertyID, value, important);
 }
@@ -469,7 +484,7 @@ bool EditingStyle::textDirection(WritingDirection& writingDirection) const
     return false;
 }
 
-void EditingStyle::setStyle(PassRefPtr<CSSMutableStyleDeclaration> style)
+void EditingStyle::setStyle(PassRefPtr<StylePropertySet> style)
 {
     m_mutableStyle = style;
     // FIXME: We should be able to figure out whether or not font is fixed width for mutable style.
@@ -478,12 +493,12 @@ void EditingStyle::setStyle(PassRefPtr<CSSMutableStyleDeclaration> style)
     extractFontSizeDelta();
 }
 
-void EditingStyle::overrideWithStyle(const CSSMutableStyleDeclaration* style)
+void EditingStyle::overrideWithStyle(const StylePropertySet* style)
 {
     if (!style || style->isEmpty())
         return;
     if (!m_mutableStyle)
-        m_mutableStyle = CSSMutableStyleDeclaration::create();
+        m_mutableStyle = StylePropertySet::create();
     m_mutableStyle->merge(style);
     extractFontSizeDelta();
 }
@@ -520,7 +535,7 @@ PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties()
 PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection()
 {
     RefPtr<EditingStyle> textDirection = EditingStyle::create();
-    textDirection->m_mutableStyle = CSSMutableStyleDeclaration::create();
+    textDirection->m_mutableStyle = StylePropertySet::create();
     textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi));
     textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableStyle->getPropertyValue(CSSPropertyDirection),
         m_mutableStyle->propertyIsImportant(CSSPropertyDirection));
@@ -543,10 +558,10 @@ void EditingStyle::removeStyleAddedByNode(Node* node)
 {
     if (!node || !node->parentNode())
         return;
-    RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
-    RefPtr<CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
-    nodeStyle->removeEquivalentProperties(parentStyle.get());
-    m_mutableStyle->removeEquivalentProperties(nodeStyle.get());
+    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
+    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
+    nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration());
+    m_mutableStyle->removeEquivalentProperties(nodeStyle->ensureCSSStyleDeclaration());
 }
 
 void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node)
@@ -554,9 +569,9 @@ void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node)
     if (!node || !node->parentNode() || !m_mutableStyle)
         return;
 
-    RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
-    RefPtr<CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
-    nodeStyle->removeEquivalentProperties(parentStyle.get());
+    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
+    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
+    nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration());
 
     unsigned propertyCount = nodeStyle->propertyCount();
     for (unsigned i = 0; i < propertyCount; ++i)
@@ -598,12 +613,12 @@ TriState EditingStyle::triStateOfStyle(EditingStyle* style) const
 {
     if (!style || !style->m_mutableStyle)
         return FalseTriState;
-    return triStateOfStyle(style->m_mutableStyle.get(), DoNotIgnoreTextOnlyProperties);
+    return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), DoNotIgnoreTextOnlyProperties);
 }
 
 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const
 {
-    RefPtr<CSSMutableStyleDeclaration> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare);
+    RefPtr<StylePropertySet> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare);
 
     if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties)
         difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(textOnlyProperties));
@@ -648,7 +663,7 @@ bool EditingStyle::conflictsWithInlineStyleOfElement(StyledElement* element, Edi
     ASSERT(element);
     ASSERT(!conflictingProperties || conflictingProperties->isEmpty());
 
-    CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();
+    StylePropertySet* inlineStyle = element->inlineStyleDecl();
     if (!m_mutableStyle || !inlineStyle)
         return false;
 
@@ -835,7 +850,7 @@ bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen
         matchedAttributes++;
 
     if (element->hasAttribute(HTMLNames::styleAttr)) {
-        if (CSSMutableStyleDeclaration* style = element->inlineStyleDecl()) {
+        if (StylePropertySet* style = element->inlineStyleDecl()) {
             unsigned propertyCount = style->propertyCount();
             for (unsigned i = 0; i < propertyCount; ++i) {
                 if (!isEditingProperty(style->propertyAt(i).id()))
@@ -914,7 +929,7 @@ void EditingStyle::mergeInlineStyleOfElement(StyledElement* element, CSSProperty
 }
 
 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLElementEquivalent* equivalent, const StyledElement* element,
-    EditingStyle::CSSPropertyOverrideMode mode, CSSMutableStyleDeclaration* style)
+    EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style)
 {
     return equivalent->matches(element) && !equivalent->propertyExistsInStyle(element->inlineStyleDecl())
         && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsInStyle(style));
@@ -982,7 +997,7 @@ static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
         mergedValue->append(lineThrough.get());
 }
 
-void EditingStyle::mergeStyle(CSSMutableStyleDeclaration* style, CSSPropertyOverrideMode mode)
+void EditingStyle::mergeStyle(StylePropertySet* style, CSSPropertyOverrideMode mode)
 {
     if (!style)
         return;
@@ -1011,14 +1026,14 @@ void EditingStyle::mergeStyle(CSSMutableStyleDeclaration* style, CSSPropertyOver
     }
 }
 
-static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude)
+static PassRefPtr<StylePropertySet> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     RefPtr<CSSRuleList> matchedRules = element->document()->styleSelector()->styleRulesForElement(element, rulesToInclude);
     if (matchedRules) {
         for (unsigned i = 0; i < matchedRules->length(); i++) {
             if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) {
-                RefPtr<CSSMutableStyleDeclaration> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration();
+                RefPtr<StylePropertySet> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration();
                 style->merge(s.get(), true);
             }
         }
@@ -1029,7 +1044,7 @@ static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(El
 
 void EditingStyle::mergeStyleFromRules(StyledElement* element)
 {
-    RefPtr<CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
+    RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
         CSSStyleSelector::AuthorCSSRules | CSSStyleSelector::CrossOriginCSSRules);
     // Styles from the inline style declaration, held in the variable "style", take precedence 
     // over those from matched rules.
@@ -1048,7 +1063,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element)
     // For example: style="height: 1%; overflow: visible;" in quirksmode
     // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot copy/paste fidelity problem
     RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = computedStyle(element);
-    RefPtr<CSSMutableStyleDeclaration> fromComputedStyle = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> fromComputedStyle = StylePropertySet::create();
     {
         unsigned propertyCount = m_mutableStyle->propertyCount();
         for (unsigned i = 0; i < propertyCount; ++i) {
@@ -1065,7 +1080,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element)
     m_mutableStyle->merge(fromComputedStyle.get());
 }
 
-static void removePropertiesInStyle(CSSMutableStyleDeclaration* styleToRemovePropertiesFrom, CSSMutableStyleDeclaration* style)
+static void removePropertiesInStyle(StylePropertySet* styleToRemovePropertiesFrom, StylePropertySet* style)
 {
     unsigned propertyCount = style->propertyCount();
     Vector<int> propertiesToRemove(propertyCount);
@@ -1082,9 +1097,9 @@ void EditingStyle::removeStyleFromRulesAndContext(StyledElement* element, Node*
         return;
 
     // 1. Remove style from matched rules because style remain without repeating it in inline style declaration
-    RefPtr<CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules);
+    RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules);
     if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty())
-        m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules.get());
+        m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules->ensureCSSStyleDeclaration());
 
     // 2. Remove style present in context and not overriden by matched rules.
     RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPropertiesInEffect);
@@ -1093,7 +1108,7 @@ void EditingStyle::removeStyleFromRulesAndContext(StyledElement* element, Node*
             computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColor, CSSValueTransparent);
 
         removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMatchedRules.get());
-        m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle.get());
+        m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle->ensureCSSStyleDeclaration());
     }
 
     // 3. If this element is a span and has display: inline or float: none, remove them unless they are overriden by rules.
@@ -1111,7 +1126,7 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element* element)
     if (!m_mutableStyle || m_mutableStyle->isEmpty())
         return;
 
-    RefPtr<CSSMutableStyleDeclaration> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules);
+    RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules);
 
     removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get());
 }
@@ -1119,7 +1134,7 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element* element)
 void EditingStyle::forceInline()
 {
     if (!m_mutableStyle)
-        m_mutableStyle = CSSMutableStyleDeclaration::create();
+        m_mutableStyle = StylePropertySet::create();
     const bool propertyIsImportant = true;
     m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsImportant);
 }
@@ -1168,7 +1183,7 @@ PassRefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelect
     return style;
 }
 
-static void reconcileTextDecorationProperties(CSSMutableStyleDeclaration* style)
+static void reconcileTextDecorationProperties(StylePropertySet* style)
 {    
     RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
     RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration);
@@ -1199,7 +1214,7 @@ StyleChange::StyleChange(EditingStyle* style, const Position& position)
 
     RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle();
     // FIXME: take care of background-color in effect
-    RefPtr<CSSMutableStyleDeclaration> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
+    RefPtr<StylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
 
     reconcileTextDecorationProperties(mutableStyle.get());
     if (!document->frame()->editor()->shouldStyleWithCSS())
@@ -1218,7 +1233,7 @@ StyleChange::StyleChange(EditingStyle* style, const Position& position)
     m_cssStyle = mutableStyle->asText().stripWhiteSpace();
 }
 
-static void setTextDecorationProperty(CSSMutableStyleDeclaration* style, const CSSValueList* newTextDecoration, int propertyID)
+static void setTextDecorationProperty(StylePropertySet* style, const CSSValueList* newTextDecoration, int propertyID)
 {
     if (newTextDecoration->length())
         style->setProperty(propertyID, newTextDecoration->cssText(), style->propertyIsImportant(propertyID));
@@ -1229,7 +1244,7 @@ static void setTextDecorationProperty(CSSMutableStyleDeclaration* style, const C
     }
 }
 
-void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclaration* style, bool shouldUseFixedFontDefaultSize)
+void StyleChange::extractTextStyles(Document* document, StylePropertySet* style, bool shouldUseFixedFontDefaultSize)
 {
     ASSERT(style);
 
@@ -1292,7 +1307,7 @@ void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclarati
     }
 }
 
-static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID, CSSValue* refTextDecoration)
+static void diffTextDecorations(StylePropertySet* style, int propertID, CSSValue* refTextDecoration)
 {
     RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(propertID);
     if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration || !refTextDecoration->isValueList())
@@ -1307,11 +1322,8 @@ static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID
     setTextDecorationProperty(style, newTextDecoration.get(), propertID);
 }
 
-static bool fontWeightIsBold(CSSStyleDeclaration* style)
+static bool fontWeightIsBold(CSSValue* fontWeight)
 {
-    ASSERT(style);
-    RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight);
-
     if (!fontWeight)
         return false;
     if (!fontWeight->isPrimitiveValue())
@@ -1319,7 +1331,7 @@ static bool fontWeightIsBold(CSSStyleDeclaration* style)
 
     // Because b tag can only bold text, there are only two states in plain html: bold and not bold.
     // Collapse all other values to either one of these two states for editing purposes.
-    switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) {
+    switch (static_cast<CSSPrimitiveValue*>(fontWeight)->getIdent()) {
         case CSSValue100:
         case CSSValue200:
         case CSSValue300:
@@ -1336,13 +1348,26 @@ static bool fontWeightIsBold(CSSStyleDeclaration* style)
     }
 
     ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter
-    return false; // Make compiler happy
+    return false;
 }
 
-static int getTextAlignment(CSSStyleDeclaration* style)
+static bool fontWeightIsBold(CSSStyleDeclaration* style)
+{
+    ASSERT(style);
+    RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight);
+    return fontWeightIsBold(fontWeight.get());
+}
+
+static bool fontWeightIsBold(StylePropertySet* style)
 {
-    int textAlign = getIdentifierValue(style, CSSPropertyTextAlign);
-    switch (textAlign) {
+    ASSERT(style);
+    RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight);
+    return fontWeightIsBold(fontWeight.get());
+}
+
+static int getTextAlignment(int textAlignIdentifierValue)
+{
+    switch (textAlignIdentifierValue) {
     case CSSValueCenter:
     case CSSValueWebkitCenter:
         return CSSValueCenter;
@@ -1358,11 +1383,21 @@ static int getTextAlignment(CSSStyleDeclaration* style)
     return CSSValueInvalid;
 }
 
-RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle)
+static int getTextAlignment(CSSStyleDeclaration* style)
+{
+    return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign));
+}
+
+static int getTextAlignment(StylePropertySet* style)
+{
+    return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign));
+}
+
+PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle)
 {
     ASSERT(styleWithRedundantProperties);
     ASSERT(baseStyle);
-    RefPtr<CSSMutableStyleDeclaration> result = styleWithRedundantProperties->copy();
+    RefPtr<StylePropertySet> result = styleWithRedundantProperties->copy();
 
     result->removeEquivalentProperties(baseStyle);
 
@@ -1382,15 +1417,23 @@ RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* style
     return result;
 }
 
-int getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID propertyID)
+int getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID)
 {
     if (!style)
         return 0;
+    RefPtr<CSSValue> value = style->getPropertyCSSValue(propertyID);
+    if (!value || !value->isPrimitiveValue())
+        return 0;
+    return static_cast<CSSPrimitiveValue*>(value.get())->getIdent();
+}
 
+int getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID propertyID)
+{
+    if (!style)
+        return 0;
     RefPtr<CSSValue> value = style->getPropertyCSSValueInternal(propertyID);
     if (!value || !value->isPrimitiveValue())
         return 0;
-
     return static_cast<CSSPrimitiveValue*>(value.get())->getIdent();
 }
 
@@ -1418,22 +1461,30 @@ int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, boo
     return 0;
 }
 
-bool hasTransparentBackgroundColor(CSSStyleDeclaration* style)
+bool isTransparentColorValue(CSSValue* cssValue)
 {
-    RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor);
     if (!cssValue)
-        return true;
-    
+        return true;    
     if (!cssValue->isPrimitiveValue())
         return false;
-    CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue.get());
-    
+    CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue);    
     if (value->isRGBColor())
-        return !alphaChannel(value->getRGBA32Value());
-    
+        return !alphaChannel(value->getRGBA32Value());    
     return value->getIdent() == CSSValueTransparent;
 }
 
+bool hasTransparentBackgroundColor(CSSStyleDeclaration* style)
+{
+    RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor);
+    return isTransparentColorValue(cssValue.get());
+}
+    
+bool hasTransparentBackgroundColor(StylePropertySet* style)
+{
+    RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundColor);
+    return isTransparentColorValue(cssValue.get());
+}
+
 PassRefPtr<CSSValue> backgroundColorInEffect(Node* node)
 {
     for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
index b497dc9..6b60920 100644 (file)
@@ -43,7 +43,6 @@ namespace WebCore {
 
 class CSSStyleDeclaration;
 class CSSComputedStyleDeclaration;
-class CSSMutableStyleDeclaration;
 class CSSPrimitiveValue;
 class CSSValue;
 class Document;
@@ -53,6 +52,7 @@ class Node;
 class Position;
 class QualifiedName;
 class RenderStyle;
+class StylePropertySet;
 class StyledElement;
 class VisibleSelection;
 
@@ -81,6 +81,11 @@ public:
         return adoptRef(new EditingStyle(position, propertiesToInclude));
     }
 
+    static PassRefPtr<EditingStyle> create(const StylePropertySet* style)
+    {
+        return adoptRef(new EditingStyle(style));
+    }
+
     static PassRefPtr<EditingStyle> create(const CSSStyleDeclaration* style)
     {
         return adoptRef(new EditingStyle(style));
@@ -93,11 +98,11 @@ public:
 
     ~EditingStyle();
 
-    CSSMutableStyleDeclaration* style() { return m_mutableStyle.get(); }
+    StylePropertySet* style() { return m_mutableStyle.get(); }
     bool textDirection(WritingDirection&) const;
     bool isEmpty() const;
-    void setStyle(PassRefPtr<CSSMutableStyleDeclaration>);
-    void overrideWithStyle(const CSSMutableStyleDeclaration*);
+    void setStyle(PassRefPtr<StylePropertySet>);
+    void overrideWithStyle(const StylePropertySet*);
     void clear();
     PassRefPtr<EditingStyle> copy() const;
     PassRefPtr<EditingStyle> extractAndRemoveBlockProperties();
@@ -144,6 +149,7 @@ private:
     EditingStyle();
     EditingStyle(Node*, PropertiesToInclude);
     EditingStyle(const Position&, PropertiesToInclude);
+    EditingStyle(const StylePropertySet*);
     EditingStyle(const CSSStyleDeclaration*);
     EditingStyle(int propertyID, const String& value);
     void init(Node*, PropertiesToInclude);
@@ -154,9 +160,9 @@ private:
     TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties) const;
     bool conflictsWithInlineStyleOfElement(StyledElement*, EditingStyle* extractedStyle, Vector<CSSPropertyID>* conflictingProperties) const;
     void mergeInlineAndImplicitStyleOfElement(StyledElement*, CSSPropertyOverrideMode, PropertiesToInclude);
-    void mergeStyle(CSSMutableStyleDeclaration*, CSSPropertyOverrideMode);
+    void mergeStyle(StylePropertySet*, CSSPropertyOverrideMode);
 
-    RefPtr<CSSMutableStyleDeclaration> m_mutableStyle;
+    RefPtr<StylePropertySet> m_mutableStyle;
     bool m_shouldUseFixedDefaultFontSize;
     float m_fontSizeDelta;
 
@@ -201,7 +207,7 @@ public:
         return !(*this == other);
     }
 private:
-    void extractTextStyles(Document*, CSSMutableStyleDeclaration*, bool shouldUseFixedFontDefaultSize);
+    void extractTextStyles(Document*, StylePropertySet*, bool shouldUseFixedFontDefaultSize);
 
     String m_cssStyle;
     bool m_applyBold;
@@ -217,6 +223,7 @@ private:
 
 // FIXME: Remove these functions or make them non-global to discourage using CSSStyleDeclaration directly.
 int getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID);
+int getIdentifierValue(StylePropertySet*, CSSPropertyID);
 
 } // namespace WebCore
 
index 72ce5b8..40eeb2a 100644 (file)
@@ -1346,9 +1346,9 @@ void Editor::setBaseWritingDirection(WritingDirection direction)
         return;
     }
 
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyDirection, direction == LeftToRightWritingDirection ? "ltr" : direction == RightToLeftWritingDirection ? "rtl" : "inherit", false);
-    applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection);
+    applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
 }
 
 void Editor::selectComposition()
@@ -2745,7 +2745,7 @@ void Editor::applyEditingStyleToElement(Element* element) const
     ASSERT(element->isStyledElement());
     if (!element->isStyledElement())
         return;
-    CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();
+    StylePropertySet* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();
     style->setProperty(CSSPropertyWordWrap, "break-word", false);
     style->setProperty(CSSPropertyWebkitNbspMode, "space", false);
     style->setProperty(CSSPropertyWebkitLineBreak, "after-white-space", false);
index 74d70db..a0506b1 100644 (file)
@@ -98,16 +98,16 @@ static Frame* targetFrame(Frame* frame, Event* event)
     return node->document()->frame();
 }
 
-static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style)
+static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, StylePropertySet* style)
 {
     // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
     switch (source) {
     case CommandFromMenuOrKeyBinding:
-        frame->editor()->applyStyleToSelection(style, action);
+        frame->editor()->applyStyleToSelection(style->ensureCSSStyleDeclaration(), action);
         return true;
     case CommandFromDOM:
     case CommandFromDOMWithUserInterface:
-        frame->editor()->applyStyle(style);
+        frame->editor()->applyStyle(style->ensureCSSStyleDeclaration());
         return true;
     }
     ASSERT_NOT_REACHED();
@@ -116,14 +116,14 @@ static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAc
 
 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
     return applyCommandToFrame(frame, source, action, style.get());
 }
 
 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
     return applyCommandToFrame(frame, source, action, style.get());
 }
@@ -151,7 +151,7 @@ static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E
         newStyle = value->cssText();
 
     // FIXME: We shouldn't be having to convert new style into text.  We should have setPropertyCSSValue.
-    RefPtr<CSSMutableStyleDeclaration> newMutableStyle = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> newMutableStyle = StylePropertySet::create();
     newMutableStyle->setProperty(propertyID, newStyle, ec);
     return applyCommandToFrame(frame, source, action, newMutableStyle.get());
 }
@@ -174,16 +174,16 @@ static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAct
 
 static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
     // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
     switch (source) {
     case CommandFromMenuOrKeyBinding:
-        frame->editor()->applyParagraphStyleToSelection(style.get(), action);
+        frame->editor()->applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), action);
         return true;
     case CommandFromDOM:
     case CommandFromDOMWithUserInterface:
-        frame->editor()->applyParagraphStyle(style.get());
+        frame->editor()->applyParagraphStyle(style->ensureCSSStyleDeclaration());
         return true;
     }
     ASSERT_NOT_REACHED();
@@ -580,27 +580,27 @@ static bool executeJustifyRight(Frame* frame, Event*, EditorCommandSource source
 
 static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
     style->setProperty(CSSPropertyDirection, CSSValueLtr);
-    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
     return true;
 }
 
 static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
-    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
     return true;
 }
 
 static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
     style->setProperty(CSSPropertyDirection, CSSValueRtl);
-    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
     return true;
 }
 
index 539cc5b..fc7286e 100644 (file)
@@ -1837,7 +1837,7 @@ void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const
 #endif
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> FrameSelection::copyTypingStyle() const
+PassRefPtr<StylePropertySet> FrameSelection::copyTypingStyle() const
 {
     if (!m_typingStyle || !m_typingStyle->style())
         return 0;
index 114e77d..b1877f6 100644 (file)
 namespace WebCore {
 
 class CharacterData;
-class CSSMutableStyleDeclaration;
 class Frame;
 class GraphicsContext;
 class HTMLFormElement;
 class RenderObject;
 class RenderView;
 class Settings;
+class StylePropertySet;
 class VisiblePosition;
 
 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 };
@@ -235,7 +235,7 @@ public:
     void paintDragCaret(GraphicsContext*, const LayoutPoint&, const LayoutRect& clipRect) const;
 
     EditingStyle* typingStyle() const;
-    PassRefPtr<CSSMutableStyleDeclaration> copyTypingStyle() const;
+    PassRefPtr<StylePropertySet> copyTypingStyle() const;
     void setTypingStyle(PassRefPtr<EditingStyle>);
     void clearTypingStyle();
 
index 5408e39..54ac595 100644 (file)
@@ -42,7 +42,7 @@ RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, PassRefPt
 
 void RemoveCSSPropertyCommand::doApply()
 {
-    CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl();
+    StylePropertySet* style = m_element->inlineStyleDecl();
     m_oldValue = style->getPropertyValue(m_property);
     m_important = style->propertyIsImportant(m_property);
     style->removeProperty(m_property);
@@ -50,7 +50,7 @@ void RemoveCSSPropertyCommand::doApply()
 
 void RemoveCSSPropertyCommand::doUnapply()
 {
-    CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl();
+    StylePropertySet* style = m_element->inlineStyleDecl();
     style->setProperty(m_property, m_oldValue, m_important);
 }
 
index 18f622e..70703e0 100644 (file)
@@ -481,7 +481,7 @@ void ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline(Insert
 
         StyledElement* element = static_cast<StyledElement*>(node.get());
 
-        CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl();
+        StylePropertySet* inlineStyle = element->inlineStyleDecl();
         RefPtr<EditingStyle> newInlineStyle = EditingStyle::create(inlineStyle);
         if (inlineStyle) {
             ContainerNode* context = element->parentNode();
index fcb55cc..da053b8 100644 (file)
 
 namespace WebCore {
 
-class CSSMutableStyleDeclaration;
 class DocumentFragment;
 class EditingStyle;
 class Node;
 class ReplacementFragment;
+class StylePropertySet;
 
 class ReplaceSelectionCommand : public CompositeEditCommand {
 public:
index a5482af..415e523 100644 (file)
@@ -69,7 +69,7 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-static bool propertyMissingOrEqualToNone(CSSMutableStyleDeclaration*, int propertyID);
+static bool propertyMissingOrEqualToNone(StylePropertySet*, int propertyID);
 
 class AttributeChange {
 public:
@@ -129,11 +129,11 @@ public:
     Node* serializeNodes(Node* startNode, Node* pastEnd);
     virtual void appendString(const String& s) { return MarkupAccumulator::appendString(s); }
     void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySelectsNode = DoesFullySelectNode);
-    void wrapWithStyleNode(CSSMutableStyleDeclaration*, Document*, bool isBlock = false);
+    void wrapWithStyleNode(StylePropertySet*, Document*, bool isBlock = false);
     String takeResults();
 
 private:
-    void appendStyleNodeOpenTag(StringBuilder&, CSSMutableStyleDeclaration*, Document*, bool isBlock = false);
+    void appendStyleNodeOpenTag(StringBuilder&, StylePropertySet*, Document*, bool isBlock = false);
     const String styleNodeCloseTag(bool isBlock = false);
     virtual void appendText(StringBuilder& out, Text*);
     String renderedText(const Node*, const Range*);
@@ -178,7 +178,7 @@ void StyledMarkupAccumulator::wrapWithNode(Node* node, bool convertBlocksToInlin
         m_nodes->append(node);
 }
 
-void StyledMarkupAccumulator::wrapWithStyleNode(CSSMutableStyleDeclaration* style, Document* document, bool isBlock)
+void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style, Document* document, bool isBlock)
 {
     StringBuilder openTag;
     appendStyleNodeOpenTag(openTag, style, document, isBlock);
@@ -186,7 +186,7 @@ void StyledMarkupAccumulator::wrapWithStyleNode(CSSMutableStyleDeclaration* styl
     appendString(styleNodeCloseTag(isBlock));
 }
 
-void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, CSSMutableStyleDeclaration* style, Document* document, bool isBlock)
+void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, StylePropertySet* style, Document* document, bool isBlock)
 {
     // wrappingStyleForSerialization should have removed -webkit-text-decorations-in-effect
     ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect));
@@ -467,7 +467,7 @@ static inline Node* ancestorToRetainStructureAndAppearanceWithNoRenderer(Node* c
     return ancestorToRetainStructureAndAppearanceForBlock(commonAncestorBlock);
 }
 
-static bool propertyMissingOrEqualToNone(CSSMutableStyleDeclaration* style, int propertyID)
+static bool propertyMissingOrEqualToNone(StylePropertySet* style, int propertyID)
 {
     if (!style)
         return false;
index 9a96a36..d19b482 100644 (file)
@@ -118,7 +118,7 @@ void HTMLTableCellElement::parseMappedAttribute(Attribute* attr)
         HTMLTablePartElement::parseMappedAttribute(attr);
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableCellElement::additionalAttributeStyle()
+PassRefPtr<StylePropertySet> HTMLTableCellElement::additionalAttributeStyle()
 {
     ContainerNode* p = parentNode();
     while (p && !p->hasTagName(tableTag))
index d7ddc86..510bcf8 100644 (file)
@@ -56,7 +56,7 @@ private:
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(Attribute*);
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE;
 
     virtual bool isURLAttribute(Attribute*) const;
 
index 10657e6..abb1ddd 100644 (file)
@@ -77,7 +77,7 @@ void HTMLTableColElement::parseMappedAttribute(Attribute* attr)
         HTMLTablePartElement::parseMappedAttribute(attr);
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableColElement::additionalAttributeStyle()
+PassRefPtr<StylePropertySet> HTMLTableColElement::additionalAttributeStyle()
 {
     if (!hasLocalName(colgroupTag))
         return 0;
index 36180c7..20cc457 100644 (file)
@@ -44,7 +44,7 @@ private:
 
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(Attribute*);
-    virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE;
 
     int m_span;
 };
index cac8b4d..5b008b4 100644 (file)
@@ -445,9 +445,9 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr)
     }
 }
 
-static CSSMutableStyleDeclaration* leakBorderStyle(int value)
+static StylePropertySet* leakBorderStyle(int value)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyBorderTopStyle, value);
     style->setProperty(CSSPropertyBorderBottomStyle, value);
     style->setProperty(CSSPropertyBorderLeftStyle, value);
@@ -455,16 +455,16 @@ static CSSMutableStyleDeclaration* leakBorderStyle(int value)
     return style.release().leakRef();
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalAttributeStyle()
+PassRefPtr<StylePropertySet> HTMLTableElement::additionalAttributeStyle()
 {
     if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr)
         return 0;
 
     if (m_borderColorAttr) {
-        static CSSMutableStyleDeclaration* solidBorderStyle = leakBorderStyle(CSSValueSolid);
+        static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueSolid);
         return solidBorderStyle;
     }
-    static CSSMutableStyleDeclaration* outsetBorderStyle = leakBorderStyle(CSSValueOutset);
+    static StylePropertySet* outsetBorderStyle = leakBorderStyle(CSSValueOutset);
     return outsetBorderStyle;
 }
 
@@ -491,9 +491,9 @@ HTMLTableElement::CellBorders HTMLTableElement::cellBorders() const
     return NoBorders;
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle()
+PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle()
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
 
     switch (cellBorders()) {
     case SolidBordersColsOnly:
@@ -542,16 +542,16 @@ PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle()
     return style.release();
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalCellStyle()
+PassRefPtr<StylePropertySet> HTMLTableElement::additionalCellStyle()
 {
     if (!m_sharedCellStyle)
         m_sharedCellStyle = createSharedCellStyle();
     return m_sharedCellStyle;
 }
 
-static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows)
+static StylePropertySet* leakGroupBorderStyle(int rows)
 {
-    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> style = StylePropertySet::create();
     if (rows) {
         style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin);
         style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin);
@@ -566,16 +566,16 @@ static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows)
     return style.release().leakRef();
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalGroupStyle(bool rows)
+PassRefPtr<StylePropertySet> HTMLTableElement::additionalGroupStyle(bool rows)
 {
     if (m_rulesAttr != GroupsRules)
         return 0;
 
     if (rows) {
-        static CSSMutableStyleDeclaration* rowBorderStyle = leakGroupBorderStyle(true);
+        static StylePropertySet* rowBorderStyle = leakGroupBorderStyle(true);
         return rowBorderStyle;
     }
-    static CSSMutableStyleDeclaration* columnBorderStyle = leakGroupBorderStyle(false);
+    static StylePropertySet* columnBorderStyle = leakGroupBorderStyle(false);
     return columnBorderStyle;
 }
 
index cfde1df..4e7fe31 100644 (file)
@@ -66,8 +66,8 @@ public:
 
     virtual void attach();
 
-    PassRefPtr<CSSMutableStyleDeclaration> additionalCellStyle();
-    PassRefPtr<CSSMutableStyleDeclaration> additionalGroupStyle(bool rows);
+    PassRefPtr<StylePropertySet> additionalCellStyle();
+    PassRefPtr<StylePropertySet> additionalGroupStyle(bool rows);
 
 private:
     HTMLTableElement(const QualifiedName&, Document*);
@@ -77,7 +77,7 @@ private:
     virtual bool isURLAttribute(Attribute*) const;
 
     // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes.
-    virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE;
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
@@ -86,7 +86,7 @@ private:
 
     CellBorders cellBorders() const;
 
-    PassRefPtr<CSSMutableStyleDeclaration> createSharedCellStyle();
+    PassRefPtr<StylePropertySet> createSharedCellStyle();
 
     HTMLTableSectionElement* lastBody() const;
 
@@ -98,7 +98,7 @@ private:
 
     unsigned short m_padding;
     OwnPtr<HTMLTableRowsCollection> m_rowsCollection;
-    RefPtr<CSSMutableStyleDeclaration> m_sharedCellStyle;
+    RefPtr<StylePropertySet> m_sharedCellStyle;
 };
 
 } //namespace
index ef6e9f2..be69d7f 100644 (file)
@@ -47,7 +47,7 @@ PassRefPtr<HTMLTableSectionElement> HTMLTableSectionElement::create(const Qualif
     return adoptRef(new HTMLTableSectionElement(tagName, document));
 }
 
-PassRefPtr<CSSMutableStyleDeclaration> HTMLTableSectionElement::additionalAttributeStyle()
+PassRefPtr<StylePropertySet> HTMLTableSectionElement::additionalAttributeStyle()
 {
     ContainerNode* p = parentNode();
     while (p && !p->hasTagName(tableTag))
index b1680c4..b7a4179 100644 (file)
@@ -56,7 +56,7 @@ public:
 private:
     HTMLTableSectionElement(const QualifiedName& tagName, Document*);
 
-    virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE;
+    virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE;
 };
 
 } //namespace
index 604e54a..bc3c454 100644 (file)
@@ -119,7 +119,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble
         hostY -= containerLocation.y() + container->borderTop();
     }
 
-    CSSMutableStyleDeclaration* style = bubble->ensureInlineStyleDecl();
+    StylePropertySet* style = bubble->ensureInlineStyleDecl();
     style->setProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX);
     // The 'left' value of ::-webkit-validation-bubble-arrow.
     const int bubbleArrowTopOffset = 32;
index a24cd69..868484a 100644 (file)
@@ -1989,7 +1989,7 @@ String CanvasRenderingContext2D::font() const
 
 void CanvasRenderingContext2D::setFont(const String& newFont)
 {
-    RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> tempDecl = StylePropertySet::create();
     CSSParser parser(!m_usesCSSCompatibilityParseMode);
 
     String declarationText("font: ");
index c75b2b7..e932e73 100644 (file)
@@ -175,7 +175,7 @@ void MediaControlPanelElement::endDrag()
 
 void MediaControlPanelElement::setPosition(const LayoutPoint& position)
 {
-    CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();
+    StylePropertySet* style = ensureInlineStyleDecl();
 
     double left = position.x();
     double top = position.y();
@@ -193,7 +193,7 @@ void MediaControlPanelElement::setPosition(const LayoutPoint& position)
 
 void MediaControlPanelElement::resetPosition()
 {
-    CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();
+    StylePropertySet* style = ensureInlineStyleDecl();
 
     style->removeProperty(CSSPropertyLeft);
     style->removeProperty(CSSPropertyTop);
@@ -211,7 +211,7 @@ void MediaControlPanelElement::makeOpaque()
 
     double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeInDuration() : 0;
 
-    CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();
+    StylePropertySet* style = ensureInlineStyleDecl();
     style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity);
     style->setProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S);
     style->setProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBER);
@@ -224,7 +224,7 @@ void MediaControlPanelElement::makeTransparent()
     if (!m_opaque)
         return;
 
-    CSSMutableStyleDeclaration* style = ensureInlineStyleDecl();
+    StylePropertySet* style = ensureInlineStyleDecl();
     style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity);
     style->setProperty(CSSPropertyWebkitTransitionDuration, document()->page()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S);
     style->setProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER);
index 60b9e35..319a11e 100644 (file)
@@ -334,7 +334,7 @@ PassRefPtr<TrackLimiterElement> TrackLimiterElement::create(Document* document)
 {
     RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document));
 
-    CSSMutableStyleDeclaration* style = element->ensureInlineStyleDecl();
+    StylePropertySet* style = element->ensureInlineStyleDecl();
     style->setProperty(CSSPropertyVisibility, CSSValueHidden);
     style->setProperty(CSSPropertyPosition, CSSValueStatic);
 
index 06635f5..45ce72d 100644 (file)
@@ -727,7 +727,7 @@ PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Eleme
             continue;
         RefPtr<InspectorObject> attrStyleObject = InspectorObject::create();
         String attributeName = attribute->localName();
-        RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl(), 0);
+        RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl()->ensureCSSStyleDeclaration(), 0);
         attrStyleObject->setString("name", attributeName.utf8().data());
         attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle());
         attrStyles->pushObject(attrStyleObject.release());
index 2f37f0d..57df992 100644 (file)
@@ -294,7 +294,7 @@ bool InspectorStyle::setPropertyText(ErrorString* errorString, unsigned index, c
     populateAllProperties(&allProperties);
 
     if (propertyText.stripWhiteSpace().length()) {
-        RefPtr<CSSMutableStyleDeclaration> tempMutableStyle = CSSMutableStyleDeclaration::create();
+        RefPtr<StylePropertySet> tempMutableStyle = StylePropertySet::create();
         RefPtr<CSSStyleSourceData> sourceData = CSSStyleSourceData::create();
         CSSParser p;
         p.parseDeclaration(tempMutableStyle.get(), propertyText + " " + bogusPropertyName + ": none", &sourceData, m_style->parentStyleSheet());
@@ -1317,7 +1317,7 @@ bool InspectorStyleSheetForInlineStyle::getStyleAttributeRanges(RefPtr<CSSStyleS
         return true;
     }
 
-    RefPtr<CSSMutableStyleDeclaration> tempDeclaration = CSSMutableStyleDeclaration::create();
+    RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create();
     CSSParser p;
     p.parseDeclaration(tempDeclaration.get(), m_styleText, result, m_element->document()->elementSheet());
     return true;
index a47b6a4..07395da 100644 (file)
@@ -447,12 +447,12 @@ bool DragController::concludeEditDrag(DragData* dragData)
         if (!color.isValid())
             return false;
         RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange();
-        RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
+        RefPtr<StylePropertySet> style = StylePropertySet::create();
         style->setProperty(CSSPropertyColor, color.serialized(), false);
-        if (!innerFrame->editor()->shouldApplyStyle(style.get(), innerRange.get()))
+        if (!innerFrame->editor()->shouldApplyStyle(style->ensureCSSStyleDeclaration(), innerRange.get()))
             return false;
         m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
-        innerFrame->editor()->applyStyle(style.get(), EditActionSetColor);
+        innerFrame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetColor);
         return true;
     }
 
index 2ea0fbe..059864e 100644 (file)
@@ -307,7 +307,7 @@ void PageSerializer::retrieveResourcesForCSSRule(CSSStyleRule* rule, Document* d
     retrieveResourcesForCSSDeclaration(rule->declaration(), document);
 }
 
-void PageSerializer::retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclaration* styleDeclaration, Document* document)
+void PageSerializer::retrieveResourcesForCSSDeclaration(StylePropertySet* styleDeclaration, Document* document)
 {
     if (!styleDeclaration)
         return;
index 1a8ae57..a900f15 100644 (file)
 namespace WebCore {
 
 class CachedImage;
-class CSSMutableStyleDeclaration;
 class CSSStyleRule;
 class CSSStyleSheet;
 class Document;
 class Frame;
 class Page;
 class RenderObject;
+class StylePropertySet;
 
 // This class is used to serialize a page contents back to text (typically HTML).
 // It serializes all the page frames and retrieves resources such as images and CSS stylesheets.
@@ -78,7 +78,7 @@ private:
     void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&);
 
     void addImageToResources(CachedImage*, RenderObject*, const KURL&);
-    void retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclaration*, Document*);
+    void retrieveResourcesForCSSDeclaration(StylePropertySet*, Document*);
     void retrieveResourcesForCSSRule(CSSStyleRule*, Document*);
 
     Vector<Resource>* m_resources;
index d06b30d..603e159 100644 (file)
@@ -1707,7 +1707,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOff
     LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
 
     ASSERT(element->isStyledElement());
-    CSSMutableStyleDeclaration* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();
+    StylePropertySet* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl();
     bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX;
 
     if (resize != RESIZE_VERTICAL && difference.width()) {
index 88ad4ac..d020039 100644 (file)
@@ -183,7 +183,7 @@ static bool isEmptyOrUnstyledAppleStyleSpan(const Node* node)
     if (!node->hasChildNodes())
         return true;
 
-    CSSMutableStyleDeclaration* inlineStyleDecl = elem->inlineStyleDecl();
+    StylePropertySet* inlineStyleDecl = elem->inlineStyleDecl();
     return (!inlineStyleDecl || inlineStyleDecl->isEmpty());
 }
 
index 06e5001..c770942 100644 (file)
@@ -51,7 +51,7 @@ inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Docu
     , m_fontFaceRule(CSSFontFaceRule::create())
 {
     ASSERT(hasTagName(font_faceTag));
-    RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(m_fontFaceRule.get());
+    RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(m_fontFaceRule.get());
     styleDeclaration->setStrictParsing(true);
     m_fontFaceRule->setDeclaration(styleDeclaration.release());
 }
index c381d87..f2f714c 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-03  Antti Koivisto  <antti@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77740
+        Split CSSMutableStyleDeclaration into separate internal and CSSOM types 
+
+        Reviewed by Andreas Kling and Darin Adler.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _typingStyle]):
+
 2012-02-03  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=77691
index c034354..c09863e 100644 (file)
@@ -55,7 +55,7 @@
 #import <WebCore/AXObjectCache.h>
 #import <WebCore/AccessibilityObject.h>
 #import <WebCore/AnimationController.h>
-#import <WebCore/CSSMutableStyleDeclaration.h>
+#import <WebCore/CSSStyleDeclaration.h>
 #import <WebCore/CachedResourceLoader.h>
 #import <WebCore/Chrome.h>
 #import <WebCore/ColorMac.h>
@@ -791,7 +791,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 {
     if (!_private->coreFrame)
         return nil;
-    RefPtr<CSSMutableStyleDeclaration> typingStyle = _private->coreFrame->selection()->copyTypingStyle();
+    RefPtr<CSSStyleDeclaration> typingStyle = _private->coreFrame->selection()->copyTypingStyle()->ensureCSSStyleDeclaration();
     if (!typingStyle)
         return nil;
     return kit(typingStyle.get());
index 771ad56..65ded43 100644 (file)
@@ -844,7 +844,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str
     if (!propID)
         return QString();
 
-    CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();
+    StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();
 
     if (strategy == InlineStyle)
         return style->getPropertyValue(propID);
@@ -909,7 +909,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value)
         return;
 
     int propID = cssPropertyID(name);
-    CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();
+    StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl();
     if (!propID || !style)
         return;
 
index cbbdec3..a968056 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-03  Antti Koivisto  <antti@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77740
+        Split CSSMutableStyleDeclaration into separate internal and CSSOM types 
+
+        Reviewed by Andreas Kling and Darin Adler.
+
+        * Api/qwebelement.cpp:
+        (QWebElement::styleProperty):
+
 2012-02-03  No'am Rosenthal  <noam.rosenthal@nokia.com>
 
         [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible.