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