This source file includes following definitions.
- m_importRule
- href
- media
- cssText
- styleSheet
- reattach
- trace
#include "config.h"
#include "core/css/CSSImportRule.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/MediaList.h"
#include "core/css/StyleRuleImport.h"
#include "core/css/StyleSheetContents.h"
#include "wtf/text/StringBuilder.h"
namespace WebCore {
CSSImportRule::CSSImportRule(StyleRuleImport* importRule, CSSStyleSheet* parent)
: CSSRule(parent)
, m_importRule(importRule)
{
}
CSSImportRule::~CSSImportRule()
{
#if !ENABLE(OILPAN)
if (m_styleSheetCSSOMWrapper)
m_styleSheetCSSOMWrapper->clearOwnerRule();
if (m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper->clearParentRule();
#endif
}
String CSSImportRule::href() const
{
return m_importRule->href();
}
MediaList* CSSImportRule::media() const
{
if (!m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper = MediaList::create(m_importRule->mediaQueries(), const_cast<CSSImportRule*>(this));
return m_mediaCSSOMWrapper.get();
}
String CSSImportRule::cssText() const
{
StringBuilder result;
result.append("@import url(\"");
result.append(m_importRule->href());
result.append("\")");
if (m_importRule->mediaQueries()) {
String mediaText = m_importRule->mediaQueries()->mediaText();
if (!mediaText.isEmpty()) {
result.append(' ');
result.append(mediaText);
}
}
result.append(';');
return result.toString();
}
CSSStyleSheet* CSSImportRule::styleSheet() const
{
if (!m_importRule->styleSheet())
return 0;
if (!m_styleSheetCSSOMWrapper)
m_styleSheetCSSOMWrapper = CSSStyleSheet::create(m_importRule->styleSheet(), const_cast<CSSImportRule*>(this));
return m_styleSheetCSSOMWrapper.get();
}
void CSSImportRule::reattach(StyleRuleBase*)
{
ASSERT_NOT_REACHED();
}
void CSSImportRule::trace(Visitor* visitor)
{
visitor->trace(m_importRule);
visitor->trace(m_mediaCSSOMWrapper);
visitor->trace(m_styleSheetCSSOMWrapper);
CSSRule::trace(visitor);
}
}