Commit e89e04dc authored by antti@apple.com's avatar 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.

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: http://svn.webkit.org/repository/webkit/trunk@106681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8bb7d695
This diff is collapsed.
......@@ -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
......
......@@ -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
......
......@@ -28,15 +28,15 @@
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&);
......
......@@ -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
......
......@@ -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);
......
......@@ -31,33 +31,36 @@
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
......
......@@ -28,7 +28,6 @@
namespace WebCore {
class CSSMutableStyleDeclaration;
class CSSSelector;
class CSSSelectorList;
......
......@@ -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();
......
......@@ -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,
......
......@@ -27,10 +27,10 @@
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; }
......
......@@ -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;
};
......
......@@ -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;
......
......@@ -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); }