CSSFontFaceRule.cpp [plain text]
#include "config.h"
#include "CSSFontFaceRule.h"
#include "StylePropertySet.h"
#include "StyleRule.h"
namespace WebCore {
CSSFontFaceRule::CSSFontFaceRule(StyleRuleFontFace* fontFaceRule, CSSStyleSheet* parent)
: CSSRule(parent, CSSRule::FONT_FACE_RULE)
, m_fontFaceRule(fontFaceRule)
{
}
CSSFontFaceRule::~CSSFontFaceRule()
{
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->clearParentRule();
}
CSSStyleDeclaration* CSSFontFaceRule::style() const
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->properties(), const_cast<CSSFontFaceRule*>(this));
return m_propertiesCSSOMWrapper.get();
}
String CSSFontFaceRule::cssText() const
{
String result("@font-face");
result += " { ";
result += m_fontFaceRule->properties()->asText();
result += "}";
return result;
}
void CSSFontFaceRule::reattach(StyleRuleFontFace* rule)
{
ASSERT(rule);
m_fontFaceRule = rule;
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->reattach(m_fontFaceRule->properties());
}
}