Commit 180847c9 authored by andersca@apple.com's avatar andersca@apple.com

2008-06-25 Anders Carlsson <andersca@apple.com>

        Reviewed by Dave Hyatt.

        Fix refcount leak in CSSVariablesRule.

        * css/CSSParser.cpp:
        (WebCore::CSSParser::createVariablesRule):
        * css/CSSVariablesRule.h:
        (WebCore::CSSVariablesRule::create):
        (WebCore::CSSVariablesRule::setDeclaration):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 23f50648
2008-06-25 Anders Carlsson <andersca@apple.com>
Reviewed by Dave Hyatt.
Fix refcount leak in CSSVariablesRule.
* css/CSSParser.cpp:
(WebCore::CSSParser::createVariablesRule):
* css/CSSVariablesRule.h:
(WebCore::CSSVariablesRule::create):
(WebCore::CSSVariablesRule::setDeclaration):
2008-06-25 Anders Carlsson <andersca@apple.com>
Reviewed by Mitz.
......@@ -4257,11 +4257,12 @@ CSSRule* CSSParser::createFontFaceRule()
CSSRule* CSSParser::createVariablesRule(MediaList* mediaList)
{
CSSVariablesRule* rule = new CSSVariablesRule(m_styleSheet, mediaList);
m_parsedStyleObjects.append(rule);
rule->setDeclaration(CSSVariablesDeclaration::create(rule, m_variableNames, m_variableValues).get());
clearVariables();
return rule;
RefPtr<CSSVariablesRule> rule = CSSVariablesRule::create(m_styleSheet, mediaList);
rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues));
clearVariables();
CSSRule* result = rule.get();
m_parsedStyleObjects.append(rule.release());
return result;
}
bool CSSParser::addVariable(const CSSParserString& name, CSSParserValueList* valueList)
......
......@@ -37,7 +37,11 @@ class MediaList;
class CSSVariablesRule : public CSSRule {
public:
CSSVariablesRule(CSSStyleSheet* parent, MediaList*);
static PassRefPtr<CSSVariablesRule> create(CSSStyleSheet* parent, MediaList* mediaList)
{
return adoptRef(new CSSVariablesRule(parent, mediaList));
}
virtual ~CSSVariablesRule();
// CSSVariablesRule interface
......@@ -51,9 +55,11 @@ public:
// Used internally. Does not notify the document of the change. Only intended
// for use on initial parse.
void setDeclaration(CSSVariablesDeclaration* decl) { m_variables = decl; }
void setDeclaration(PassRefPtr<CSSVariablesDeclaration> decl) { m_variables = decl; }
private:
CSSVariablesRule(CSSStyleSheet* parent, MediaList*);
protected:
RefPtr<MediaList> m_lstMedia;
RefPtr<CSSVariablesDeclaration> m_variables;
};
......
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