Use is<>() / downcast<>() for CSS StyleProperties
https://bugs.webkit.org/show_bug.cgi?id=137398

Reviewed by Benjamin Poulain.

Use is<>() / downcast<>() for CSS StyleProperties subclasses.

No new tests, no behavior change.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::immutableCopyIfNeeded):
(WebCore::MutableStyleProperties::MutableStyleProperties):
(WebCore::StyleProperties::hasCSSOMWrapper):
* css/StyleProperties.h:
(WebCore::StyleProperties::PropertyReference::propertyMetadata):
(WebCore::StyleProperties::PropertyReference::propertyValue):
(WebCore::StyleProperties::propertyCount):
(WebCore::StyleProperties::deref):
(WebCore::StyleProperties::findPropertyIndex):
(isType):
(WebCore::toMutableStyleProperties): Deleted.
(WebCore::toImmutableStyleProperties): Deleted.
* css/StyleRule.cpp:
(WebCore::StyleRule::mutableProperties):
(WebCore::StyleRulePage::mutableProperties):
(WebCore::StyleRuleFontFace::mutableProperties):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::mutableProperties):
* dom/StyledElement.cpp:
(WebCore::StyledElement::ensureMutableInlineStyle):
(WebCore::StyledElement::setInlineStyleFromString):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/css/StyleRule.cpp b/Source/WebCore/css/StyleRule.cpp
index 99c42ea..1cfc834 100644
--- a/Source/WebCore/css/StyleRule.cpp
+++ b/Source/WebCore/css/StyleRule.cpp
@@ -220,9 +220,9 @@
 
 MutableStyleProperties& StyleRule::mutableProperties()
 {
-    if (!m_properties->isMutable())
+    if (!is<MutableStyleProperties>(m_properties.get()))
         m_properties = m_properties->mutableCopy();
-    return static_cast<MutableStyleProperties&>(m_properties.get());
+    return downcast<MutableStyleProperties>(m_properties.get());
 }
 
 PassRef<StyleRule> StyleRule::create(int sourceLine, const Vector<const CSSSelector*>& selectors, PassRef<StyleProperties> properties)
@@ -282,9 +282,9 @@
 
 MutableStyleProperties& StyleRulePage::mutableProperties()
 {
-    if (!m_properties->isMutable())
+    if (!is<MutableStyleProperties>(m_properties.get()))
         m_properties = m_properties->mutableCopy();
-    return static_cast<MutableStyleProperties&>(m_properties.get());
+    return downcast<MutableStyleProperties>(m_properties.get());
 }
 
 StyleRuleFontFace::StyleRuleFontFace(PassRef<StyleProperties> properties)
@@ -305,9 +305,9 @@
 
 MutableStyleProperties& StyleRuleFontFace::mutableProperties()
 {
-    if (!m_properties->isMutable())
+    if (!is<MutableStyleProperties>(m_properties.get()))
         m_properties = m_properties->mutableCopy();
-    return static_cast<MutableStyleProperties&>(m_properties.get());
+    return downcast<MutableStyleProperties>(m_properties.get());
 }
 
 StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase>>& adoptRule)