From: antti@apple.com Date: Tue, 31 Jan 2012 22:30:22 +0000 (+0000) Subject: Make CSSOM style() return CSSStyleDeclaration* X-Git-Tag: 070512121124~14109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ef12a29a800598cac6c094e453829441fa12206;p=profile%2Fivi%2Fwebkit-efl.git Make CSSOM style() return CSSStyleDeclaration* https://bugs.webkit.org/show_bug.cgi?id=77475 Reviewed by Anders Carlsson CSSStyleRule::style() and some other places return CSSMutableStyleDeclaration. They should return the plain CSSOM type instead. CSSMutableStyleDeclaration* should be available through non-CSSOM function. * css/CSSFontFaceRule.h: (WebCore::CSSFontFaceRule::style): (WebCore::CSSFontFaceRule::declaration): * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::addFontFaceRule): * css/CSSStyleRule.h: (WebCore::CSSStyleRule::style): (WebCore::CSSStyleRule::declaration): * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::styleForKeyframe): * css/WebKitCSSKeyframeRule.h: (WebCore): (WebCore::WebKitCSSKeyframeRule::style): (WebCore::WebKitCSSKeyframeRule::declaration): (WebKitCSSKeyframeRule): * editing/EditingStyle.cpp: (WebCore::styleFromMatchedRulesForElement): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::revalidateStyle): * page/PageSerializer.cpp: (WebCore::PageSerializer::retrieveResourcesForCSSRule): * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::parseMappedAttribute): (WebCore::SVGFontFaceElement::fontFamily): (WebCore::SVGFontFaceElement::rebuildFontFace): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106393 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 4d48b1a..6149800 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,41 @@ +2012-01-31 Antti Koivisto + + Make CSSOM style() return CSSStyleDeclaration* + https://bugs.webkit.org/show_bug.cgi?id=77475 + + Reviewed by Anders Carlsson + + CSSStyleRule::style() and some other places return CSSMutableStyleDeclaration. + They should return the plain CSSOM type instead. + + CSSMutableStyleDeclaration* should be available through non-CSSOM function. + + * css/CSSFontFaceRule.h: + (WebCore::CSSFontFaceRule::style): + (WebCore::CSSFontFaceRule::declaration): + * css/CSSFontSelector.cpp: + (WebCore::CSSFontSelector::addFontFaceRule): + * css/CSSStyleRule.h: + (WebCore::CSSStyleRule::style): + (WebCore::CSSStyleRule::declaration): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForKeyframe): + * css/WebKitCSSKeyframeRule.h: + (WebCore): + (WebCore::WebKitCSSKeyframeRule::style): + (WebCore::WebKitCSSKeyframeRule::declaration): + (WebKitCSSKeyframeRule): + * editing/EditingStyle.cpp: + (WebCore::styleFromMatchedRulesForElement): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyleSheet::revalidateStyle): + * page/PageSerializer.cpp: + (WebCore::PageSerializer::retrieveResourcesForCSSRule): + * svg/SVGFontFaceElement.cpp: + (WebCore::SVGFontFaceElement::parseMappedAttribute): + (WebCore::SVGFontFaceElement::fontFamily): + (WebCore::SVGFontFaceElement::rebuildFontFace): + 2012-01-31 Scott Graham [Chromium] Remove references to gyp cygwin build target diff --git a/Source/WebCore/css/CSSFontFaceRule.h b/Source/WebCore/css/CSSFontFaceRule.h index 3d1f76c..545c90a 100644 --- a/Source/WebCore/css/CSSFontFaceRule.h +++ b/Source/WebCore/css/CSSFontFaceRule.h @@ -42,10 +42,11 @@ public: ~CSSFontFaceRule(); - CSSMutableStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style.get(); } String cssText() const; + CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } void setDeclaration(PassRefPtr style) { m_style = style; } void addSubresourceStyleURLs(ListHashSet& urls); diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index ada612c..b13fffd 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -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->style(); + const CSSMutableStyleDeclaration* style = fontFaceRule->declaration(); RefPtr fontFamily = style->getPropertyCSSValue(CSSPropertyFontFamily); RefPtr src = style->getPropertyCSSValue(CSSPropertySrc); RefPtr unicodeRange = style->getPropertyCSSValue(CSSPropertyUnicodeRange); diff --git a/Source/WebCore/css/CSSStyleRule.h b/Source/WebCore/css/CSSStyleRule.h index 7346350..713e682 100644 --- a/Source/WebCore/css/CSSStyleRule.h +++ b/Source/WebCore/css/CSSStyleRule.h @@ -43,7 +43,7 @@ public: String selectorText() const; void setSelectorText(const String&); - CSSMutableStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style.get(); } String cssText() const; @@ -51,7 +51,7 @@ public: void setDeclaration(PassRefPtr style) { ASSERT(style->parentRule() == this); m_style = style; } const CSSSelectorList& selectorList() const { return m_selectorList; } - CSSMutableStyleDeclaration* declaration() { return m_style.get(); } + CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } void addSubresourceStyleURLs(ListHashSet& urls); diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index e7954ae..abac398 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -1529,7 +1529,7 @@ PassRefPtr CSSStyleSelector::styleForElement(Element* element, Rend PassRefPtr CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeValue& keyframe) { if (keyframeRule->style()) - addMatchedDeclaration(keyframeRule->style()); + addMatchedDeclaration(keyframeRule->declaration()); ASSERT(!m_style); @@ -1568,7 +1568,7 @@ PassRefPtr CSSStyleSelector::styleForKeyframe(const RenderStyle* el #endif // Add all the animating properties to the keyframe. - if (CSSMutableStyleDeclaration* styleDeclaration = keyframeRule->style()) { + if (CSSMutableStyleDeclaration* styleDeclaration = keyframeRule->declaration()) { unsigned propertyCount = styleDeclaration->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { int property = styleDeclaration->propertyAt(i).id(); diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.h b/Source/WebCore/css/WebKitCSSKeyframeRule.h index 052c86b..0835187 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.h +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.h @@ -26,14 +26,13 @@ #ifndef WebKitCSSKeyframeRule_h #define WebKitCSSKeyframeRule_h +#include "CSSMutableStyleDeclaration.h" #include "CSSRule.h" #include #include namespace WebCore { -class CSSMutableStyleDeclaration; - typedef int ExceptionCode; class WebKitCSSKeyframeRule : public CSSRule { @@ -54,15 +53,13 @@ public: void getKeys(Vector& keys) const { parseKeyString(m_key, keys); } - CSSMutableStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style.get(); } String cssText() const; + CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } void setDeclaration(PassRefPtr); - CSSMutableStyleDeclaration* declaration() { return m_style.get(); } - const CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } - private: static void parseKeyString(const String& s, Vector& keys); diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp index 796ad1b..1bcd69c 100644 --- a/Source/WebCore/editing/EditingStyle.cpp +++ b/Source/WebCore/editing/EditingStyle.cpp @@ -1018,7 +1018,7 @@ static PassRefPtr styleFromMatchedRulesForElement(El if (matchedRules) { for (unsigned i = 0; i < matchedRules->length(); i++) { if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) { - RefPtr s = static_cast(matchedRules->item(i))->style(); + RefPtr s = static_cast(matchedRules->item(i))->declaration(); style->merge(s.get(), true); } } diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp index 8f5d45b..2f37f0d 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.cpp +++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp @@ -1085,7 +1085,7 @@ void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle) for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { CSSStyleRule* parsedRule = m_flatRules.at(i); if (parsedRule->style() == pageStyle) { - if (parsedRule->style()->asText() != pageStyle->cssText()) { + if (parsedRule->declaration()->asText() != pageStyle->cssText()) { // Clear the disabled properties for the invalid style here. m_inspectorStyles.remove(pageStyle); setStyleText(pageStyle, pageStyle->cssText()); diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp index 7adde3e..99ab2ef 100644 --- a/Source/WebCore/page/PageSerializer.cpp +++ b/Source/WebCore/page/PageSerializer.cpp @@ -303,7 +303,7 @@ void PageSerializer::addImageToResources(CachedImage* image, RenderObject* image void PageSerializer::retrieveResourcesForCSSRule(CSSStyleRule* rule) { - retrieveResourcesForCSSDeclaration(rule->style()); + retrieveResourcesForCSSDeclaration(rule->declaration()); } void PageSerializer::retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclaration* styleDeclaration) diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp index 2ecb3d0..06e5001 100644 --- a/Source/WebCore/svg/SVGFontFaceElement.cpp +++ b/Source/WebCore/svg/SVGFontFaceElement.cpp @@ -113,7 +113,7 @@ void SVGFontFaceElement::parseMappedAttribute(Attribute* attr) { int propId = cssPropertyIdForSVGAttributeName(attr->name()); if (propId > 0) { - m_fontFaceRule->style()->setProperty(propId, attr->value(), false); + m_fontFaceRule->declaration()->setProperty(propId, attr->value(), false); rebuildFontFace(); return; } @@ -258,7 +258,7 @@ int SVGFontFaceElement::descent() const String SVGFontFaceElement::fontFamily() const { - return m_fontFaceRule->style()->getPropertyValue(CSSPropertyFontFamily); + return m_fontFaceRule->declaration()->getPropertyValue(CSSPropertyFontFamily); } SVGFontElement* SVGFontFaceElement::associatedFontElement() const @@ -299,11 +299,11 @@ void SVGFontFaceElement::rebuildFontFace() // Parse in-memory CSS rules CSSProperty srcProperty(CSSPropertySrc, list); const CSSProperty* srcPropertyRef = &srcProperty; - m_fontFaceRule->style()->addParsedProperties(&srcPropertyRef, 1); + m_fontFaceRule->declaration()->addParsedProperties(&srcPropertyRef, 1); if (describesParentFont) { // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves. - RefPtr src = m_fontFaceRule->style()->getPropertyCSSValue(CSSPropertySrc); + RefPtr src = m_fontFaceRule->declaration()->getPropertyCSSValue(CSSPropertySrc); CSSValueList* srcList = static_cast(src.get()); unsigned srcLength = srcList ? srcList->length() : 0;