This source file includes following definitions.
- m_fontFaceRule
- style
- cssText
- reattach
- trace
#include "config.h"
#include "core/css/CSSFontFaceRule.h"
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
#include "wtf/text/StringBuilder.h"
namespace WebCore {
CSSFontFaceRule::CSSFontFaceRule(StyleRuleFontFace* fontFaceRule, CSSStyleSheet* parent)
: CSSRule(parent)
, m_fontFaceRule(fontFaceRule)
{
}
CSSFontFaceRule::~CSSFontFaceRule()
{
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->clearParentRule();
}
CSSStyleDeclaration* CSSFontFaceRule::style() const
{
if (!m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->mutableProperties(), const_cast<CSSFontFaceRule*>(this));
return m_propertiesCSSOMWrapper.get();
}
String CSSFontFaceRule::cssText() const
{
StringBuilder result;
result.appendLiteral("@font-face { ");
String descs = m_fontFaceRule->properties().asText();
result.append(descs);
if (!descs.isEmpty())
result.append(' ');
result.append('}');
return result.toString();
}
void CSSFontFaceRule::reattach(StyleRuleBase* rule)
{
ASSERT(rule);
m_fontFaceRule = toStyleRuleFontFace(rule);
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->reattach(m_fontFaceRule->mutableProperties());
}
void CSSFontFaceRule::trace(Visitor* visitor)
{
visitor->trace(m_fontFaceRule);
CSSRule::trace(visitor);
}
}