PassRefPtrWillBeRawPtr<StyleRuleBase> StyleRuleBase::copy() const { switch (type()) { case Style: return toStyleRule(this)->copy(); case Page: return toStyleRulePage(this)->copy(); case FontFace: return toStyleRuleFontFace(this)->copy(); case Media: return toStyleRuleMedia(this)->copy(); case Supports: return toStyleRuleSupports(this)->copy(); case Import: // FIXME: Copy import rules. ASSERT_NOT_REACHED(); return nullptr; case Keyframes: return toStyleRuleKeyframes(this)->copy(); case Viewport: return toStyleRuleViewport(this)->copy(); case Filter: return toStyleRuleFilter(this)->copy(); case Unknown: case Charset: case Keyframe: ASSERT_NOT_REACHED(); return nullptr; } ASSERT_NOT_REACHED(); return nullptr; }
void CSSFilterRule::reattach(StyleRuleBase* rule) { ASSERT(rule); m_filterRule = toStyleRuleFilter(rule); if (m_propertiesCSSOMWrapper) m_propertiesCSSOMWrapper->reattach(m_filterRule->mutableProperties()); }
PassRefPtrWillBeRawPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const { RefPtrWillBeRawPtr<CSSRule> rule; StyleRuleBase* self = const_cast<StyleRuleBase*>(this); switch (type()) { case Style: rule = CSSStyleRule::create(toStyleRule(self), parentSheet); break; case Page: rule = CSSPageRule::create(toStyleRulePage(self), parentSheet); break; case FontFace: rule = CSSFontFaceRule::create(toStyleRuleFontFace(self), parentSheet); break; case Media: rule = CSSMediaRule::create(toStyleRuleMedia(self), parentSheet); break; case Supports: rule = CSSSupportsRule::create(toStyleRuleSupports(self), parentSheet); break; case Import: rule = CSSImportRule::create(toStyleRuleImport(self), parentSheet); break; case Keyframes: rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet); break; case Viewport: rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet); break; case Filter: rule = CSSFilterRule::create(toStyleRuleFilter(self), parentSheet); break; case Unknown: case Charset: case Keyframe: ASSERT_NOT_REACHED(); return nullptr; } if (parentRule) rule->setParentRule(parentRule); return rule.release(); }
void StyleRuleBase::finalize() { switch (type()) { case Style: toStyleRule(this)->~StyleRule(); return; case Page: toStyleRulePage(this)->~StyleRulePage(); return; case FontFace: toStyleRuleFontFace(this)->~StyleRuleFontFace(); return; case Media: toStyleRuleMedia(this)->~StyleRuleMedia(); return; case Supports: toStyleRuleSupports(this)->~StyleRuleSupports(); return; case Import: toStyleRuleImport(this)->~StyleRuleImport(); return; case Keyframes: toStyleRuleKeyframes(this)->~StyleRuleKeyframes(); return; case Viewport: toStyleRuleViewport(this)->~StyleRuleViewport(); return; case Filter: toStyleRuleFilter(this)->~StyleRuleFilter(); return; case Unknown: case Charset: case Keyframe: ASSERT_NOT_REACHED(); return; } ASSERT_NOT_REACHED(); }
void StyleRuleBase::trace(Visitor* visitor) { switch (type()) { case Style: toStyleRule(this)->traceAfterDispatch(visitor); return; case Page: toStyleRulePage(this)->traceAfterDispatch(visitor); return; case FontFace: toStyleRuleFontFace(this)->traceAfterDispatch(visitor); return; case Media: toStyleRuleMedia(this)->traceAfterDispatch(visitor); return; case Supports: toStyleRuleSupports(this)->traceAfterDispatch(visitor); return; case Import: toStyleRuleImport(this)->traceAfterDispatch(visitor); return; case Keyframes: toStyleRuleKeyframes(this)->traceAfterDispatch(visitor); return; case Viewport: toStyleRuleViewport(this)->traceAfterDispatch(visitor); return; case Filter: toStyleRuleFilter(this)->traceAfterDispatch(visitor); return; case Unknown: case Charset: case Keyframe: ASSERT_NOT_REACHED(); return; } ASSERT_NOT_REACHED(); }
void StyleRuleBase::destroy() { switch (type()) { case Style: delete toStyleRule(this); return; case Page: delete toStyleRulePage(this); return; case FontFace: delete toStyleRuleFontFace(this); return; case Media: delete toStyleRuleMedia(this); return; case Supports: delete toStyleRuleSupports(this); return; case Import: delete toStyleRuleImport(this); return; case Keyframes: delete toStyleRuleKeyframes(this); return; case Viewport: delete toStyleRuleViewport(this); return; case Filter: delete toStyleRuleFilter(this); return; case Unknown: case Charset: case Keyframe: ASSERT_NOT_REACHED(); return; } ASSERT_NOT_REACHED(); }