<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174069] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174069">174069</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-09-29 10:35:28 -0700 (Mon, 29 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use the new is&lt;&gt;() / downcast&lt;&gt;() for ShadowRoot and StyledElement
https://bugs.webkit.org/show_bug.cgi?id=137199

Reviewed by Darin Adler.

Use the new is&lt;&gt;() / downcast&lt;&gt;() for ShadowRoot and StyledElement and
move towards getting rid of the NODE_TYPE_CASTS() macro.

No new tests, no behavior change.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::matchAllRules):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::initElement):
(WebCore::StyleResolver::State::initForStyleResolve):
(WebCore::StyleResolver::locateCousinList):
(WebCore::StyleResolver::findSiblingForStyleSharing):
* dom/Attr.cpp:
(WebCore::Attr::style):
* dom/Element.cpp:
(WebCore::Element::removeAttribute):
* dom/EventDispatcher.cpp:
(WebCore::EventRelatedNodeResolver::moveToParentOrShadowHost):
(WebCore::EventRelatedNodeResolver::findHostOfTreeScopeInTargetTreeScope):
(WebCore::eventTargetRespectingTargetRules):
(WebCore::EventPath::EventPath):
* dom/Node.cpp:
(WebCore::Node::containingShadowRoot):
(WebCore::Node::parentOrShadowHostElement):
(WebCore::Node::showNodePathForThis):
* dom/NodeRenderingTraversal.cpp:
(WebCore::NodeRenderingTraversal::traverseParent):
* dom/ShadowRoot.h:
(WebCore::isShadowRoot):
(WebCore::Node::shadowRoot):
(WebCore::Node::parentOrShadowHostNode):
* dom/StyledElement.h:
(WebCore::StyledElement::presentationAttributeStyle):
(WebCore::isStyledElement):
* dom/Text.cpp:
(WebCore::isSVGShadowText):
* dom/TreeScope.cpp:
(WebCore::TreeScope::focusedElement):
* dom/TreeScopeAdopter.cpp:
(WebCore::TreeScopeAdopter::moveNodeToNewDocument):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::wrappingStyleForSerialization):
* editing/Editor.cpp:
(WebCore::Editor::applyEditingStyleToElement):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
* editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::inlineStylePropertyForElement):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendElement):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForElementInfo):
* page/DragController.cpp:
(WebCore::asFileInput):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
* page/FocusController.cpp:
(WebCore::FocusNavigationScope::owner):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::serializeFrame):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
* svg/SVGElement.cpp:
(WebCore::SVGElement::title):
* testing/Internals.cpp:
(WebCore::Internals::shadowRoot):
(WebCore::Internals::shadowRootType):
(WebCore::Internals::includerFor):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCoredomAttrcpp">trunk/Source/WebCore/dom/Attr.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomEventDispatchercpp">trunk/Source/WebCore/dom/EventDispatcher.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeRenderingTraversalcpp">trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp</a></li>
<li><a href="#trunkSourceWebCoredomShadowRooth">trunk/Source/WebCore/dom/ShadowRoot.h</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementh">trunk/Source/WebCore/dom/StyledElement.h</a></li>
<li><a href="#trunkSourceWebCoredomTextcpp">trunk/Source/WebCore/dom/Text.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopeAdoptercpp">trunk/Source/WebCore/dom/TreeScopeAdopter.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyStyleCommandcpp">trunk/Source/WebCore/editing/ApplyStyleCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingStylecpp">trunk/Source/WebCore/editing/EditingStyle.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandcpp">trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingcocoaHTMLConvertermm">trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgentcpp">trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlaycpp">trunk/Source/WebCore/inspector/InspectorOverlay.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageSerializercpp">trunk/Source/WebCore/page/PageSerializer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementcpp">trunk/Source/WebCore/svg/SVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/ChangeLog        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -1,5 +1,86 @@
</span><span class="cx"> 2014-09-29  Christophe Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Use the new is&lt;&gt;() / downcast&lt;&gt;() for ShadowRoot and StyledElement
+        https://bugs.webkit.org/show_bug.cgi?id=137199
+
+        Reviewed by Darin Adler.
+
+        Use the new is&lt;&gt;() / downcast&lt;&gt;() for ShadowRoot and StyledElement and
+        move towards getting rid of the NODE_TYPE_CASTS() macro.
+
+        No new tests, no behavior change.
+
+        * css/ElementRuleCollector.cpp:
+        (WebCore::ElementRuleCollector::matchAllRules):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::initElement):
+        (WebCore::StyleResolver::State::initForStyleResolve):
+        (WebCore::StyleResolver::locateCousinList):
+        (WebCore::StyleResolver::findSiblingForStyleSharing):
+        * dom/Attr.cpp:
+        (WebCore::Attr::style):
+        * dom/Element.cpp:
+        (WebCore::Element::removeAttribute):
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventRelatedNodeResolver::moveToParentOrShadowHost):
+        (WebCore::EventRelatedNodeResolver::findHostOfTreeScopeInTargetTreeScope):
+        (WebCore::eventTargetRespectingTargetRules):
+        (WebCore::EventPath::EventPath):
+        * dom/Node.cpp:
+        (WebCore::Node::containingShadowRoot):
+        (WebCore::Node::parentOrShadowHostElement):
+        (WebCore::Node::showNodePathForThis):
+        * dom/NodeRenderingTraversal.cpp:
+        (WebCore::NodeRenderingTraversal::traverseParent):
+        * dom/ShadowRoot.h:
+        (WebCore::isShadowRoot):
+        (WebCore::Node::shadowRoot):
+        (WebCore::Node::parentOrShadowHostNode):
+        * dom/StyledElement.h:
+        (WebCore::StyledElement::presentationAttributeStyle):
+        (WebCore::isStyledElement):
+        * dom/Text.cpp:
+        (WebCore::isSVGShadowText):
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::focusedElement):
+        * dom/TreeScopeAdopter.cpp:
+        (WebCore::TreeScopeAdopter::moveNodeToNewDocument):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
+        (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::wrappingStyleForSerialization):
+        * editing/Editor.cpp:
+        (WebCore::Editor::applyEditingStyleToElement):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
+        * editing/cocoa/HTMLConverter.mm:
+        (HTMLConverterCaches::inlineStylePropertyForElement):
+        * editing/markup.cpp:
+        (WebCore::StyledMarkupAccumulator::appendElement):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::buildObjectForElementInfo):
+        * page/DragController.cpp:
+        (WebCore::asFileInput):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEvent):
+        * page/FocusController.cpp:
+        (WebCore::FocusNavigationScope::owner):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::serializeFrame):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::resize):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::title):
+        * testing/Internals.cpp:
+        (WebCore::Internals::shadowRoot):
+        (WebCore::Internals::shadowRootType):
+        (WebCore::Internals::includerFor):
+
+2014-09-29  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         Use the new is&lt;&gt;() / downcast&lt;&gt;() for Text Nodes
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=137188
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -388,8 +388,8 @@
</span><span class="cx">         matchUserRules(false);
</span><span class="cx"> 
</span><span class="cx">     // Now check author rules, beginning first with presentational attributes mapped from HTML.
</span><del>-    if (m_element.isStyledElement()) {
-        StyledElement&amp; styledElement = toStyledElement(m_element);
</del><ins>+    if (is&lt;StyledElement&gt;(m_element)) {
+        StyledElement&amp; styledElement = downcast&lt;StyledElement&gt;(m_element);
</ins><span class="cx">         addElementStyleProperties(styledElement.presentationAttributeStyle());
</span><span class="cx"> 
</span><span class="cx">         // Now we check additional mapped declarations.
</span><span class="lines">@@ -409,8 +409,8 @@
</span><span class="cx">     if (matchAuthorAndUserStyles)
</span><span class="cx">         matchAuthorRules(false);
</span><span class="cx"> 
</span><del>-    if (matchAuthorAndUserStyles &amp;&amp; m_element.isStyledElement()) {
-        StyledElement&amp; styledElement = toStyledElement(m_element);
</del><ins>+    if (matchAuthorAndUserStyles &amp;&amp; is&lt;StyledElement&gt;(m_element)) {
+        StyledElement&amp; styledElement = downcast&lt;StyledElement&gt;(m_element);
</ins><span class="cx">         // Now check our inline style attribute.
</span><span class="cx">         if (styledElement.inlineStyle()) {
</span><span class="cx">             // Inline style is immutable as long as there is no CSSOM wrapper.
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -385,11 +385,11 @@
</span><span class="cx">     m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void StyleResolver::State::initElement(Element* e)
</del><ins>+inline void StyleResolver::State::initElement(Element* element)
</ins><span class="cx"> {
</span><del>-    m_element = e;
-    m_styledElement = e &amp;&amp; e-&gt;isStyledElement() ? toStyledElement(e) : nullptr;
-    m_elementLinkState = e ? e-&gt;document().visitedLinkState().determineLinkState(*e) : NotInsideLink;
</del><ins>+    m_element = element;
+    m_styledElement = element &amp;&amp; is&lt;StyledElement&gt;(element) ? downcast&lt;StyledElement&gt;(element) : nullptr;
+    m_elementLinkState = element ? element-&gt;document().visitedLinkState().determineLinkState(*element) : NotInsideLink;
</ins><span class="cx">     updateConversionData();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -409,7 +409,7 @@
</span><span class="cx">     m_regionForStyling = regionForStyling;
</span><span class="cx"> 
</span><span class="cx">     if (e) {
</span><del>-        bool resetStyleInheritance = hasShadowRootParent(*e) &amp;&amp; toShadowRoot(e-&gt;parentNode())-&gt;resetStyleInheritance();
</del><ins>+        bool resetStyleInheritance = hasShadowRootParent(*e) &amp;&amp; downcast&lt;ShadowRoot&gt;(*e-&gt;parentNode()).resetStyleInheritance();
</ins><span class="cx">         m_parentStyle = resetStyleInheritance ? nullptr : parentStyle;
</span><span class="cx">     } else
</span><span class="cx">         m_parentStyle = parentStyle;
</span><span class="lines">@@ -445,9 +445,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (visitedNodeCount &gt;= cStyleSearchThreshold * cStyleSearchLevelThreshold)
</span><span class="cx">         return nullptr;
</span><del>-    if (!parent || !parent-&gt;isStyledElement())
</del><ins>+    if (!parent || !is&lt;StyledElement&gt;(parent))
</ins><span class="cx">         return nullptr;
</span><del>-    StyledElement* styledParent = toStyledElement(parent);
</del><ins>+    StyledElement* styledParent = downcast&lt;StyledElement&gt;(parent);
</ins><span class="cx">     if (styledParent-&gt;inlineStyle())
</span><span class="cx">         return nullptr;
</span><span class="cx">     if (is&lt;SVGElement&gt;(styledParent) &amp;&amp; downcast&lt;SVGElement&gt;(*styledParent).animatedSMILStyleProperties())
</span><span class="lines">@@ -664,14 +664,14 @@
</span><span class="cx"> inline StyledElement* StyleResolver::findSiblingForStyleSharing(Node* node, unsigned&amp; count) const
</span><span class="cx"> {
</span><span class="cx">     for (; node; node = node-&gt;previousSibling()) {
</span><del>-        if (!node-&gt;isStyledElement())
</del><ins>+        if (!is&lt;StyledElement&gt;(node))
</ins><span class="cx">             continue;
</span><del>-        if (canShareStyleWithElement(toStyledElement(node)))
</del><ins>+        if (canShareStyleWithElement(downcast&lt;StyledElement&gt;(node)))
</ins><span class="cx">             break;
</span><span class="cx">         if (count++ == cStyleSearchThreshold)
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">     }
</span><del>-    return toStyledElement(node);
</del><ins>+    return downcast&lt;StyledElement&gt;(node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderStyle* StyleResolver::locateSharedStyle()
</span></span></pre></div>
<a id="trunkSourceWebCoredomAttrcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Attr.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Attr.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/Attr.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -188,10 +188,10 @@
</span><span class="cx"> CSSStyleDeclaration* Attr::style()
</span><span class="cx"> {
</span><span class="cx">     // This function only exists to support the Obj-C bindings.
</span><del>-    if (!m_element || !m_element-&gt;isStyledElement())
</del><ins>+    if (!m_element || !is&lt;StyledElement&gt;(m_element))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     m_style = MutableStyleProperties::create();
</span><del>-    toStyledElement(m_element)-&gt;collectStyleForPresentationAttribute(qualifiedName(), value(), *m_style);
</del><ins>+    downcast&lt;StyledElement&gt;(*m_element).collectStyleForPresentationAttribute(qualifiedName(), value(), *m_style);
</ins><span class="cx">     return m_style-&gt;ensureCSSStyleDeclaration();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -1825,8 +1825,8 @@
</span><span class="cx">     AtomicString localName = shouldIgnoreAttributeCase(*this) ? name.lower() : name;
</span><span class="cx">     unsigned index = elementData()-&gt;findAttributeIndexByName(localName, false);
</span><span class="cx">     if (index == ElementData::attributeNotFound) {
</span><del>-        if (UNLIKELY(localName == styleAttr) &amp;&amp; elementData()-&gt;styleAttributeIsDirty() &amp;&amp; isStyledElement())
-            toStyledElement(this)-&gt;removeAllInlineStyleProperties();
</del><ins>+        if (UNLIKELY(localName == styleAttr) &amp;&amp; elementData()-&gt;styleAttributeIsDirty() &amp;&amp; is&lt;StyledElement&gt;(*this))
+            downcast&lt;StyledElement&gt;(*this).removeAllInlineStyleProperties();
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventDispatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventDispatcher.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -143,8 +143,8 @@
</span><span class="cx">             return m_relatedNodeInCurrentTreeScope;
</span><span class="cx"> 
</span><span class="cx">         if (m_currentTreeScope) {
</span><del>-            ASSERT(m_currentTreeScope-&gt;rootNode().isShadowRoot());
-            ASSERT(&amp;newTarget == toShadowRoot(m_currentTreeScope-&gt;rootNode()).hostElement());
</del><ins>+            ASSERT(is&lt;ShadowRoot&gt;(m_currentTreeScope-&gt;rootNode()));
+            ASSERT(&amp;newTarget == downcast&lt;ShadowRoot&gt;(m_currentTreeScope-&gt;rootNode()).hostElement());
</ins><span class="cx">             ASSERT(m_currentTreeScope-&gt;parentTreeScope() == &amp;newTreeScope);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -184,8 +184,8 @@
</span><span class="cx">                 ASSERT_WITH_SECURITY_IMPLICATION(&amp;previousHost-&gt;treeScope() == &amp;targetScope);
</span><span class="cx">                 return previousHost;
</span><span class="cx">             }
</span><del>-            if (scope-&gt;rootNode().isShadowRoot())
-                previousHost = toShadowRoot(scope-&gt;rootNode()).hostElement();
</del><ins>+            if (is&lt;ShadowRoot&gt;(scope-&gt;rootNode()))
+                previousHost = downcast&lt;ShadowRoot&gt;(scope-&gt;rootNode()).hostElement();
</ins><span class="cx">             else
</span><span class="cx">                 ASSERT_WITH_SECURITY_IMPLICATION(!scope-&gt;parentTreeScope());
</span><span class="cx">         }
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx">     // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
</span><span class="cx">     // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects
</span><span class="cx">     auto&amp; rootNode = referenceNode.treeScope().rootNode();
</span><del>-    Element* shadowHostElement = rootNode.isShadowRoot() ? toShadowRoot(rootNode).hostElement() : nullptr;
</del><ins>+    Element* shadowHostElement = is&lt;ShadowRoot&gt;(rootNode) ? downcast&lt;ShadowRoot&gt;(rootNode).hostElement() : nullptr;
</ins><span class="cx">     // At this time, SVG nodes are not supported in non-&lt;use&gt; shadow trees.
</span><span class="cx">     if (!shadowHostElement || !shadowHostElement-&gt;hasTagName(SVGNames::useTag))
</span><span class="cx">         return referenceNode;
</span><span class="lines">@@ -447,12 +447,12 @@
</span><span class="cx">                 m_path.append(std::make_unique&lt;EventContext&gt;(node, &amp;currentTarget, target));
</span><span class="cx">             if (!inDocument)
</span><span class="cx">                 return;
</span><del>-            if (node-&gt;isShadowRoot())
</del><ins>+            if (is&lt;ShadowRoot&gt;(node))
</ins><span class="cx">                 break;
</span><span class="cx">         }
</span><del>-        if (!node || !shouldEventCrossShadowBoundary(event, *toShadowRoot(node), *target))
</del><ins>+        if (!node || !shouldEventCrossShadowBoundary(event, downcast&lt;ShadowRoot&gt;(*node), *target))
</ins><span class="cx">             return;
</span><del>-        node = toShadowRoot(node)-&gt;hostElement();
</del><ins>+        node = downcast&lt;ShadowRoot&gt;(*node).hostElement();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/Node.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -974,7 +974,7 @@
</span><span class="cx"> ShadowRoot* Node::containingShadowRoot() const
</span><span class="cx"> {
</span><span class="cx">     ContainerNode&amp; root = treeScope().rootNode();
</span><del>-    return root.isShadowRoot() ? toShadowRoot(&amp;root) : nullptr;
</del><ins>+    return is&lt;ShadowRoot&gt;(root) ? downcast&lt;ShadowRoot&gt;(&amp;root) : nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Node* Node::nonBoundaryShadowTreeRootNode()
</span><span class="lines">@@ -1002,13 +1002,13 @@
</span><span class="cx"> {
</span><span class="cx">     ContainerNode* parent = parentOrShadowHostNode();
</span><span class="cx">     if (!parent)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    if (parent-&gt;isShadowRoot())
-        return toShadowRoot(parent)-&gt;hostElement();
</del><ins>+    if (is&lt;ShadowRoot&gt;(parent))
+        return downcast&lt;ShadowRoot&gt;(parent)-&gt;hostElement();
</ins><span class="cx"> 
</span><span class="cx">     if (!parent-&gt;isElementNode())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     return toElement(parent);
</span><span class="cx"> }
</span><span class="lines">@@ -1572,9 +1572,9 @@
</span><span class="cx">     }
</span><span class="cx">     for (unsigned index = chain.size(); index &gt; 0; --index) {
</span><span class="cx">         const Node* node = chain[index - 1];
</span><del>-        if (node-&gt;isShadowRoot()) {
</del><ins>+        if (is&lt;ShadowRoot&gt;(node)) {
</ins><span class="cx">             int count = 0;
</span><del>-            for (const ShadowRoot* shadowRoot = toShadowRoot(node); shadowRoot &amp;&amp; shadowRoot != node; shadowRoot = shadowRoot-&gt;shadowRoot())
</del><ins>+            for (const ShadowRoot* shadowRoot = downcast&lt;ShadowRoot&gt;(node); shadowRoot &amp;&amp; shadowRoot != node; shadowRoot = shadowRoot-&gt;shadowRoot())
</ins><span class="cx">                 ++count;
</span><span class="cx">             fprintf(stderr, &quot;/#shadow-root[%d]&quot;, count);
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeRenderingTraversalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx"> static ContainerNode* traverseParent(const Node* node, ShadowRootCrossing shadowRootCrossing)
</span><span class="cx"> {
</span><span class="cx">     if (shadowRootCrossing == DontCrossShadowRoot  &amp;&amp; node-&gt;isShadowRoot())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     if (nodeCanBeDistributed(node)) {
</span><span class="cx">         if (InsertionPoint* insertionPoint = findInsertionPointOf(node))
</span><span class="lines">@@ -132,8 +132,8 @@
</span><span class="cx">     if (!parent)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (parent-&gt;isShadowRoot())
-        return shadowRootCrossing == CrossShadowRoot ? toShadowRoot(parent)-&gt;hostElement() : parent;
</del><ins>+    if (is&lt;ShadowRoot&gt;(parent))
+        return shadowRootCrossing == CrossShadowRoot ? downcast&lt;ShadowRoot&gt;(parent)-&gt;hostElement() : parent;
</ins><span class="cx"> 
</span><span class="cx">     if (is&lt;InsertionPoint&gt;(parent)) {
</span><span class="cx">         const InsertionPoint&amp; insertionPoint = downcast&lt;InsertionPoint&gt;(*parent);
</span></span></pre></div>
<a id="trunkSourceWebCoredomShadowRooth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ShadowRoot.h (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ShadowRoot.h        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/ShadowRoot.h        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -95,22 +95,22 @@
</span><span class="cx">     return treeScope().focusedElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isShadowRoot(const Node&amp; node) { return node.isShadowRoot(); }
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(ShadowRoot)
+    static bool isShadowRoot(const Node&amp; node) { return node.isShadowRoot(); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-NODE_TYPE_CASTS(ShadowRoot)
-
</del><span class="cx"> inline ShadowRoot* Node::shadowRoot() const
</span><span class="cx"> {
</span><span class="cx">     if (!isElementNode())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return toElement(this)-&gt;shadowRoot();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline ContainerNode* Node::parentOrShadowHostNode() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThreadOrGCThread());
</span><del>-    if (isShadowRoot())
-        return toShadowRoot(this)-&gt;hostElement();
</del><ins>+    if (is&lt;ShadowRoot&gt;(this))
+        return downcast&lt;ShadowRoot&gt;(*this).hostElement();
</ins><span class="cx">     return parentNode();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.h (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.h        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/StyledElement.h        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -100,16 +100,16 @@
</span><span class="cx"> inline const StyleProperties* StyledElement::presentationAttributeStyle()
</span><span class="cx"> {
</span><span class="cx">     if (!elementData())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     if (elementData()-&gt;presentationAttributeStyleIsDirty())
</span><span class="cx">         rebuildPresentationAttributeStyle();
</span><span class="cx">     return elementData()-&gt;presentationAttributeStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isStyledElement(const Node&amp; node) { return node.isStyledElement(); }
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(StyledElement)
+    static bool isStyledElement(const Node&amp; node) { return node.isStyledElement(); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-NODE_TYPE_CASTS(StyledElement)
-
</del><span class="cx"> } //namespace
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoredomTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Text.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Text.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/Text.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> static bool isSVGShadowText(Text* text)
</span><span class="cx"> {
</span><span class="cx">     Node* parentNode = text-&gt;parentNode();
</span><del>-    return parentNode-&gt;isShadowRoot() &amp;&amp; toShadowRoot(parentNode)-&gt;hostElement()-&gt;hasTagName(SVGNames::trefTag);
</del><ins>+    return is&lt;ShadowRoot&gt;(parentNode) &amp;&amp; downcast&lt;ShadowRoot&gt;(*parentNode).hostElement()-&gt;hasTagName(SVGNames::trefTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isSVGText(Text* text)
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/TreeScope.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     TreeScope* treeScope = &amp;element-&gt;treeScope();
</span><span class="cx">     while (treeScope != this &amp;&amp; treeScope != &amp;document) {
</span><del>-        element = toShadowRoot(treeScope-&gt;rootNode()).hostElement();
</del><ins>+        element = downcast&lt;ShadowRoot&gt;(treeScope-&gt;rootNode()).hostElement();
</ins><span class="cx">         treeScope = &amp;element-&gt;treeScope();
</span><span class="cx">     }
</span><span class="cx">     if (this != treeScope)
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopeAdoptercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScopeAdopter.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScopeAdopter.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/dom/TreeScopeAdopter.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -124,8 +124,8 @@
</span><span class="cx">     if (oldDocument)
</span><span class="cx">         oldDocument-&gt;moveNodeIteratorsToNewDocument(node, newDocument);
</span><span class="cx"> 
</span><del>-    if (node-&gt;isShadowRoot())
-        toShadowRoot(node)-&gt;setDocumentScope(newDocument);
</del><ins>+    if (is&lt;ShadowRoot&gt;(node))
+        downcast&lt;ShadowRoot&gt;(*node).setDocumentScope(newDocument);
</ins><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     didMoveToNewDocumentWasCalled = false;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyStyleCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -502,14 +502,14 @@
</span><span class="cx">     if (!block)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    Node* parent = 0;
-    for (Node* n = node-&gt;parentNode(); n != block &amp;&amp; n != unsplitAncestor; n = parent) {
-        parent = n-&gt;parentNode();
-        if (!n-&gt;isStyledElement())
</del><ins>+    Node* parent = nullptr;
+    for (Node* ancestor = node-&gt;parentNode(); ancestor != block &amp;&amp; ancestor != unsplitAncestor; ancestor = parent) {
+        parent = ancestor-&gt;parentNode();
+        if (!is&lt;StyledElement&gt;(ancestor))
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        StyledElement* element = toStyledElement(n);
-        int unicodeBidi = toIdentifier(ComputedStyleExtractor(element).propertyValue(CSSPropertyUnicodeBidi));
</del><ins>+        StyledElement&amp; element = downcast&lt;StyledElement&gt;(*ancestor);
+        int unicodeBidi = toIdentifier(ComputedStyleExtractor(&amp;element).propertyValue(CSSPropertyUnicodeBidi));
</ins><span class="cx">         if (!unicodeBidi || unicodeBidi == CSSValueNormal)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="lines">@@ -517,17 +517,17 @@
</span><span class="cx">         // and all matching style rules in order to determine how to best set the unicode-bidi property to 'normal'.
</span><span class="cx">         // For now, it assumes that if the 'dir' attribute is present, then removing it will suffice, and
</span><span class="cx">         // otherwise it sets the property in the inline style declaration.
</span><del>-        if (element-&gt;fastHasAttribute(dirAttr)) {
</del><ins>+        if (element.fastHasAttribute(dirAttr)) {
</ins><span class="cx">             // FIXME: If this is a BDO element, we should probably just remove it if it has no
</span><span class="cx">             // other attributes, like we (should) do with B and I elements.
</span><del>-            removeNodeAttribute(element, dirAttr);
</del><ins>+            removeNodeAttribute(&amp;element, dirAttr);
</ins><span class="cx">         } else {
</span><del>-            RefPtr&lt;MutableStyleProperties&gt; inlineStyle = copyStyleOrCreateEmpty(element-&gt;inlineStyle());
</del><ins>+            RefPtr&lt;MutableStyleProperties&gt; inlineStyle = copyStyleOrCreateEmpty(element.inlineStyle());
</ins><span class="cx">             inlineStyle-&gt;setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
</span><span class="cx">             inlineStyle-&gt;removeProperty(CSSPropertyDirection);
</span><del>-            setNodeAttribute(element, styleAttr, inlineStyle-&gt;asText());
-            if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
-                removeNodePreservingChildren(element);
</del><ins>+            setNodeAttribute(&amp;element, styleAttr, inlineStyle-&gt;asText());
+            if (isSpanWithoutAttributesOrUnstyledStyleSpan(&amp;element))
+                removeNodePreservingChildren(&amp;element);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -1040,8 +1040,8 @@
</span><span class="cx">         getChildNodes(*current.get(), currentChildren);
</span><span class="cx"> 
</span><span class="cx">         RefPtr&lt;StyledElement&gt; styledElement;
</span><del>-        if (current-&gt;isStyledElement() &amp;&amp; isStyledInlineElementToRemove(toElement(current.get()))) {
-            styledElement = toStyledElement(current.get());
</del><ins>+        if (is&lt;StyledElement&gt;(*current) &amp;&amp; isStyledInlineElementToRemove(toElement(current.get()))) {
+            styledElement = downcast&lt;StyledElement&gt;(current.get());
</ins><span class="cx">             elementsToPushDown.append(*styledElement);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingStyle.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -1036,8 +1036,8 @@
</span><span class="cx"> 
</span><span class="cx">     // When not annotating for interchange, we only preserve inline style declarations.
</span><span class="cx">     for (Node* node = context; node &amp;&amp; !node-&gt;isDocumentNode(); node = node-&gt;parentNode()) {
</span><del>-        if (node-&gt;isStyledElement() &amp;&amp; !isMailBlockquote(node)) {
-            wrappingStyle-&gt;mergeInlineAndImplicitStyleOfElement(toStyledElement(node), EditingStyle::DoNotOverrideValues,
</del><ins>+        if (is&lt;StyledElement&gt;(node) &amp;&amp; !isMailBlockquote(node)) {
+            wrappingStyle-&gt;mergeInlineAndImplicitStyleOfElement(downcast&lt;StyledElement&gt;(node), EditingStyle::DoNotOverrideValues,
</ins><span class="cx">                 EditingStyle::EditingPropertiesInEffect);
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -3107,12 +3107,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (!element)
</span><span class="cx">         return;
</span><del>-    ASSERT(element-&gt;isStyledElement());
-    if (!element-&gt;isStyledElement())
</del><ins>+    ASSERT(is&lt;StyledElement&gt;(element));
+    if (!is&lt;StyledElement&gt;(element))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Mutate using the CSSOM wrapper so we get the same event behavior as a script.
</span><del>-    CSSStyleDeclaration* style = toStyledElement(element)-&gt;style();
</del><ins>+    CSSStyleDeclaration* style = downcast&lt;StyledElement&gt;(*element).style();
</ins><span class="cx">     style-&gt;setPropertyInternal(CSSPropertyWordWrap, &quot;break-word&quot;, false, IGNORE_EXCEPTION);
</span><span class="cx">     style-&gt;setPropertyInternal(CSSPropertyWebkitNbspMode, &quot;space&quot;, false, IGNORE_EXCEPTION);
</span><span class="cx">     style-&gt;setPropertyInternal(CSSPropertyWebkitLineBreak, &quot;after-white-space&quot;, false, IGNORE_EXCEPTION);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -480,10 +480,10 @@
</span><span class="cx">         // FIXME: &lt;rdar://problem/5371536&gt; Style rules that match pasted content can change it's appearance
</span><span class="cx"> 
</span><span class="cx">         next = NodeTraversal::next(node.get());
</span><del>-        if (!node-&gt;isStyledElement())
</del><ins>+        if (!is&lt;StyledElement&gt;(*node))
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        StyledElement* element = toStyledElement(node.get());
</del><ins>+        StyledElement* element = downcast&lt;StyledElement&gt;(node.get());
</ins><span class="cx"> 
</span><span class="cx">         const StyleProperties* inlineStyle = element-&gt;inlineStyle();
</span><span class="cx">         RefPtr&lt;EditingStyle&gt; newInlineStyle = EditingStyle::create(inlineStyle);
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx">                 if (newInlineStyle-&gt;conflictsWithImplicitStyleOfElement(&amp;htmlElement)) {
</span><span class="cx">                     // e.g. &lt;b style=&quot;font-weight: normal;&quot;&gt; is converted to &lt;span style=&quot;font-weight: normal;&quot;&gt;
</span><span class="cx">                     node = replaceElementWithSpanPreservingChildrenAndAttributes(&amp;htmlElement);
</span><del>-                    element = toStyledElement(node.get());
</del><ins>+                    element = downcast&lt;StyledElement&gt;(node.get());
</ins><span class="cx">                     insertedNodes.didReplaceNode(&amp;htmlElement, node.get());
</span><span class="cx">                 } else if (newInlineStyle-&gt;extractConflictingImplicitStyleOfAttributes(&amp;htmlElement, EditingStyle::PreserveWritingDirection, 0, attributes,
</span><span class="cx">                     EditingStyle::DoNotExtractMatchingStyle)) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingcocoaHTMLConvertermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -709,9 +709,9 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;CSSValue&gt; HTMLConverterCaches::inlineStylePropertyForElement(Element&amp; element, CSSPropertyID propertyId)
</span><span class="cx"> {
</span><del>-    if (propertyId == CSSPropertyInvalid || !element.isStyledElement())
</del><ins>+    if (propertyId == CSSPropertyInvalid || !is&lt;StyledElement&gt;(element))
</ins><span class="cx">         return nullptr;
</span><del>-    const StyleProperties* properties = toStyledElement(element).inlineStyle();
</del><ins>+    const StyleProperties* properties = downcast&lt;StyledElement&gt;(element).inlineStyle();
</ins><span class="cx">     if (!properties)
</span><span class="cx">         return nullptr;
</span><span class="cx">     return properties-&gt;getPropertyCSSValue(propertyId);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/editing/markup.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -322,8 +322,8 @@
</span><span class="cx">         } else
</span><span class="cx">             newInlineStyle = EditingStyle::create();
</span><span class="cx"> 
</span><del>-        if (element.isStyledElement() &amp;&amp; toStyledElement(element).inlineStyle())
-            newInlineStyle-&gt;overrideWithStyle(toStyledElement(element).inlineStyle());
</del><ins>+        if (is&lt;StyledElement&gt;(element) &amp;&amp; downcast&lt;StyledElement&gt;(element).inlineStyle())
+            newInlineStyle-&gt;overrideWithStyle(downcast&lt;StyledElement&gt;(element).inlineStyle());
</ins><span class="cx"> 
</span><span class="cx">         if (shouldAnnotateOrForceInline) {
</span><span class="cx">             if (shouldAnnotate())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -1086,11 +1086,11 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;Inspector::Protocol::CSS::CSSStyle&gt; InspectorCSSAgent::buildObjectForAttributesStyle(Element* element)
</span><span class="cx"> {
</span><del>-    if (!element-&gt;isStyledElement())
</del><ins>+    if (!is&lt;StyledElement&gt;(element))
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Ugliness below.
</span><del>-    StyleProperties* attributeStyle = const_cast&lt;StyleProperties*&gt;(toStyledElement(element)-&gt;presentationAttributeStyle());
</del><ins>+    StyleProperties* attributeStyle = const_cast&lt;StyleProperties*&gt;(downcast&lt;StyledElement&gt;(element)-&gt;presentationAttributeStyle());
</ins><span class="cx">     if (!attributeStyle)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -686,9 +686,9 @@
</span><span class="cx">     elementInfo-&gt;setString(&quot;tagName&quot;, isXHTML ? element-&gt;nodeName() : element-&gt;nodeName().lower());
</span><span class="cx">     elementInfo-&gt;setString(&quot;idValue&quot;, element-&gt;getIdAttribute());
</span><span class="cx">     HashSet&lt;AtomicString&gt; usedClassNames;
</span><del>-    if (element-&gt;hasClass() &amp;&amp; element-&gt;isStyledElement()) {
</del><ins>+    if (element-&gt;hasClass() &amp;&amp; is&lt;StyledElement&gt;(element)) {
</ins><span class="cx">         StringBuilder classNames;
</span><del>-        const SpaceSplitString&amp; classNamesString = toStyledElement(element)-&gt;classNames();
</del><ins>+        const SpaceSplitString&amp; classNamesString = downcast&lt;StyledElement&gt;(*element).classNames();
</ins><span class="cx">         size_t classNameCount = classNamesString.size();
</span><span class="cx">         for (size_t i = 0; i &lt; classNameCount; ++i) {
</span><span class="cx">             const AtomicString&amp; className = classNamesString[i];
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/page/DragController.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -273,8 +273,8 @@
</span><span class="cx">     HTMLInputElement* inputElement = node-&gt;toInputElement();
</span><span class="cx"> 
</span><span class="cx">     // If this is a button inside of the a file input, move up to the file input.
</span><del>-    if (inputElement &amp;&amp; inputElement-&gt;isTextButton() &amp;&amp; inputElement-&gt;treeScope().rootNode().isShadowRoot())
-        inputElement = toShadowRoot(inputElement-&gt;treeScope().rootNode()).hostElement()-&gt;toInputElement();
</del><ins>+    if (inputElement &amp;&amp; inputElement-&gt;isTextButton() &amp;&amp; is&lt;ShadowRoot&gt;(inputElement-&gt;treeScope().rootNode()))
+        inputElement = downcast&lt;ShadowRoot&gt;(inputElement-&gt;treeScope().rootNode()).hostElement()-&gt;toInputElement();
</ins><span class="cx"> 
</span><span class="cx">     return inputElement &amp;&amp; inputElement-&gt;isFileUpload() ? inputElement : 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -1760,7 +1760,7 @@
</span><span class="cx">         // If a mouse event handler changes the input element type to one that has a widget associated,
</span><span class="cx">         // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
</span><span class="cx">         // event target node can't still be the shadow node.
</span><del>-        if (mouseEvent.targetNode()-&gt;isShadowRoot() &amp;&amp; is&lt;HTMLInputElement&gt;(toShadowRoot(mouseEvent.targetNode())-&gt;hostElement()))
</del><ins>+        if (is&lt;ShadowRoot&gt;(mouseEvent.targetNode()) &amp;&amp; is&lt;HTMLInputElement&gt;(downcast&lt;ShadowRoot&gt;(*mouseEvent.targetNode()).hostElement()))
</ins><span class="cx">             mouseEvent = m_frame.document()-&gt;prepareMouseEvent(HitTestRequest(), documentPoint, platformMouseEvent);
</span><span class="cx"> 
</span><span class="cx">         FrameView* view = m_frame.view();
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/page/FocusController.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -82,11 +82,11 @@
</span><span class="cx"> Element* FocusNavigationScope::owner() const
</span><span class="cx"> {
</span><span class="cx">     ContainerNode* root = rootNode();
</span><del>-    if (root-&gt;isShadowRoot())
-        return toShadowRoot(root)-&gt;hostElement();
</del><ins>+    if (is&lt;ShadowRoot&gt;(root))
+        return downcast&lt;ShadowRoot&gt;(*root).hostElement();
</ins><span class="cx">     if (Frame* frame = root-&gt;document().frame())
</span><span class="cx">         return frame-&gt;ownerElement();
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FocusNavigationScope FocusNavigationScope::focusNavigationScopeOf(Node* node)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageSerializercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageSerializer.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageSerializer.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/page/PageSerializer.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -225,25 +225,25 @@
</span><span class="cx">         if (!node-&gt;isElementNode())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        Element* element = toElement(node);
</del><ins>+        Element&amp; element = toElement(*node);
</ins><span class="cx">         // We have to process in-line style as it might contain some resources (typically background images).
</span><del>-        if (element-&gt;isStyledElement())
-            retrieveResourcesForProperties(toStyledElement(element)-&gt;inlineStyle(), document);
</del><ins>+        if (is&lt;StyledElement&gt;(element))
+            retrieveResourcesForProperties(downcast&lt;StyledElement&gt;(element).inlineStyle(), document);
</ins><span class="cx"> 
</span><span class="cx">         if (is&lt;HTMLImageElement&gt;(element)) {
</span><del>-            HTMLImageElement&amp; imageElement = downcast&lt;HTMLImageElement&gt;(*element);
</del><ins>+            HTMLImageElement&amp; imageElement = downcast&lt;HTMLImageElement&gt;(element);
</ins><span class="cx">             URL url = document-&gt;completeURL(imageElement.fastGetAttribute(HTMLNames::srcAttr));
</span><span class="cx">             CachedImage* cachedImage = imageElement.cachedImage();
</span><span class="cx">             addImageToResources(cachedImage, imageElement.renderer(), url);
</span><span class="cx">         } else if (is&lt;HTMLLinkElement&gt;(element)) {
</span><del>-            HTMLLinkElement&amp; linkElement = downcast&lt;HTMLLinkElement&gt;(*element);
</del><ins>+            HTMLLinkElement&amp; linkElement = downcast&lt;HTMLLinkElement&gt;(element);
</ins><span class="cx">             if (CSSStyleSheet* sheet = linkElement.sheet()) {
</span><span class="cx">                 URL url = document-&gt;completeURL(linkElement.getAttribute(HTMLNames::hrefAttr));
</span><span class="cx">                 serializeCSSStyleSheet(sheet, url);
</span><span class="cx">                 ASSERT(m_resourceURLs.contains(url));
</span><span class="cx">             }
</span><span class="cx">         } else if (is&lt;HTMLStyleElement&gt;(element)) {
</span><del>-            if (CSSStyleSheet* sheet = downcast&lt;HTMLStyleElement&gt;(*element).sheet())
</del><ins>+            if (CSSStyleSheet* sheet = downcast&lt;HTMLStyleElement&gt;(element).sheet())
</ins><span class="cx">                 serializeCSSStyleSheet(sheet, URL());
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -2569,7 +2569,7 @@
</span><span class="cx">     
</span><span class="cx">     LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
</span><span class="cx"> 
</span><del>-    StyledElement* styledElement = toStyledElement(element);
</del><ins>+    StyledElement* styledElement = downcast&lt;StyledElement&gt;(element);
</ins><span class="cx">     bool isBoxSizingBorder = renderer-&gt;style().boxSizing() == BORDER_BOX;
</span><span class="cx"> 
</span><span class="cx">     EResize resize = renderer-&gt;style().resize();
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -957,7 +957,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Walk up the tree, to find out whether we're inside a &lt;use&gt; shadow tree, to find the right title.
</span><span class="cx">     if (isInShadowTree()) {
</span><del>-        Element* shadowHostElement = toShadowRoot(treeScope().rootNode()).hostElement();
</del><ins>+        Element* shadowHostElement = downcast&lt;ShadowRoot&gt;(treeScope().rootNode()).hostElement();
</ins><span class="cx">         // At this time, SVG nodes are not allowed in non-&lt;use&gt; shadow trees, so any shadow root we do
</span><span class="cx">         // have should be a use. The assert and following test is here to catch future shadow DOM changes
</span><span class="cx">         // that do enable SVG in a shadow tree.
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (174068 => 174069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-09-29 17:20:18 UTC (rev 174068)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-09-29 17:35:28 UTC (rev 174069)
</span><span class="lines">@@ -574,19 +574,19 @@
</span><span class="cx"> {
</span><span class="cx">     if (!host) {
</span><span class="cx">         ec = INVALID_ACCESS_ERR;
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx">     return host-&gt;shadowRoot();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Internals::shadowRootType(const Node* root, ExceptionCode&amp; ec) const
</span><span class="cx"> {
</span><del>-    if (!root || !root-&gt;isShadowRoot()) {
</del><ins>+    if (!root || !is&lt;ShadowRoot&gt;(root)) {
</ins><span class="cx">         ec = INVALID_ACCESS_ERR;
</span><span class="cx">         return String();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    switch (toShadowRoot(root)-&gt;type()) {
</del><ins>+    switch (downcast&lt;ShadowRoot&gt;(*root).type()) {
</ins><span class="cx">     case ShadowRoot::UserAgentShadowRoot:
</span><span class="cx">         return String(&quot;UserAgentShadowRoot&quot;);
</span><span class="cx">     default:
</span><span class="lines">@@ -598,7 +598,7 @@
</span><span class="cx"> Element* Internals::includerFor(Node*, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     ec = INVALID_ACCESS_ERR;
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Internals::shadowPseudoId(Element* element, ExceptionCode&amp; ec)
</span></span></pre>
</div>
</div>

</body>
</html>