Commit 9ef12a29 authored by antti@apple.com's avatar antti@apple.com

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
parent d4a07657
2012-01-31 Antti Koivisto <antti@apple.com>
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 <scottmg@chromium.org>
[Chromium] Remove references to gyp cygwin build target
......@@ -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<CSSMutableStyleDeclaration> style) { m_style = style; }
void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
......
......@@ -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<CSSValue> fontFamily = style->getPropertyCSSValue(CSSPropertyFontFamily);
RefPtr<CSSValue> src = style->getPropertyCSSValue(CSSPropertySrc);
RefPtr<CSSValue> unicodeRange = style->getPropertyCSSValue(CSSPropertyUnicodeRange);
......
......@@ -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<CSSMutableStyleDeclaration> 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<KURL>& urls);
......
......@@ -1529,7 +1529,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* element, Rend
PassRefPtr<RenderStyle> 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<RenderStyle> 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();
......
......@@ -26,14 +26,13 @@
#ifndef WebKitCSSKeyframeRule_h
#define WebKitCSSKeyframeRule_h
#include "CSSMutableStyleDeclaration.h"
#include "CSSRule.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class CSSMutableStyleDeclaration;
typedef int ExceptionCode;
class WebKitCSSKeyframeRule : public CSSRule {
......@@ -54,15 +53,13 @@ public:
void getKeys(Vector<float>& 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>);
CSSMutableStyleDeclaration* declaration() { return m_style.get(); }
const CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
private:
static void parseKeyString(const String& s, Vector<float>& keys);
......
......@@ -1018,7 +1018,7 @@ static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(El
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))->style();
RefPtr<CSSMutableStyleDeclaration> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration();
style->merge(s.get(), true);
}
}
......
......@@ -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());
......
......@@ -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)
......
......@@ -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<CSSValue> src = m_fontFaceRule->style()->getPropertyCSSValue(CSSPropertySrc);
RefPtr<CSSValue> src = m_fontFaceRule->declaration()->getPropertyCSSValue(CSSPropertySrc);
CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
unsigned srcLength = srcList ? srcList->length() : 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment