<!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>[191327] 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/191327">191327</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-10-19 20:29:34 -0700 (Mon, 19 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Drop unnecessary Node::toInputElement() virtual function
https://bugs.webkit.org/show_bug.cgi?id=150341
Reviewed by Darin Adler.
Drop unnecessary Node::toInputElement() virtual function and use the
usual is<HTMLInputElement>() / downcast< HTMLInputElement >() instead.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckerTestFunctionsh">trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementh">trunk/Source/WebCore/html/HTMLInputElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlRadioNodeListcpp">trunk/Source/WebCore/html/RadioNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowSliderThumbElementcpp">trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderButtoncpp">trunk/Source/WebCore/rendering/RenderButton.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemecpp">trunk/Source/WebCore/rendering/RenderTheme.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 (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/ChangeLog        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-10-19 Chris Dumez <cdumez@apple.com>
+
+ Drop unnecessary Node::toInputElement() virtual function
+ https://bugs.webkit.org/show_bug.cgi?id=150341
+
+ Reviewed by Darin Adler.
+
+ Drop unnecessary Node::toInputElement() virtual function and use the
+ usual is<HTMLInputElement>() / downcast< HTMLInputElement >() instead.
+
</ins><span class="cx"> 2015-10-19 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r191324.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -1316,11 +1316,8 @@
</span><span class="cx"> if (!domNode)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (domNode->isHTMLElement()) {
- HTMLInputElement* inputElement = domNode->toInputElement();
- if (inputElement && inputElement->isPasswordField())
- return;
- }
</del><ins>+ if (is<HTMLInputElement>(*domNode) && downcast<HTMLInputElement>(*domNode).isPasswordField())
+ return;
</ins><span class="cx">
</span><span class="cx"> // find or create an accessibility object for this node
</span><span class="cx"> AXObjectCache* cache = domNode->document().axObjectCache();
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -494,10 +494,11 @@
</span><span class="cx"> if (roleValue() == SearchFieldRole)
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- HTMLInputElement* inputElement = node->toInputElement();
- if (!inputElement)
</del><ins>+ if (!is<HTMLInputElement>(*node))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><ins>+ auto& inputElement = downcast<HTMLInputElement>(*node);
+
</ins><span class="cx"> // Some websites don't label their search fields as such. However, they will
</span><span class="cx"> // use the word "search" in either the form or input type. This won't catch every case,
</span><span class="cx"> // but it will catch google.com for example.
</span><span class="lines">@@ -508,7 +509,7 @@
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // Check the form action and the name, which will sometimes be "search".
</span><del>- HTMLFormElement* form = inputElement->form();
</del><ins>+ auto* form = inputElement.form();
</ins><span class="cx"> if (form && (form->name().contains("search", false) || form->action().contains("search", false)))
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="lines">@@ -542,18 +543,14 @@
</span><span class="cx">
</span><span class="cx"> bool AccessibilityNodeObject::isPasswordField() const
</span><span class="cx"> {
</span><del>- Node* node = this->node();
- if (!node || !node->isHTMLElement())
</del><ins>+ auto* node = this->node();
+ if (!is<HTMLInputElement>(node))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (ariaRoleAttribute() != UnknownRole)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- HTMLInputElement* inputElement = node->toInputElement();
- if (!inputElement)
- return false;
-
- return inputElement->isPasswordField();
</del><ins>+ return downcast<HTMLInputElement>(*node).isPasswordField();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> AccessibilityObject* AccessibilityNodeObject::passwordFieldOrContainingPasswordField()
</span><span class="lines">@@ -562,16 +559,14 @@
</span><span class="cx"> if (!node)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- if (HTMLInputElement* inputElement = node->toInputElement()) {
- if (inputElement->isPasswordField())
- return this;
- }
</del><ins>+ if (is<HTMLInputElement>(*node) && downcast<HTMLInputElement>(*node).isPasswordField())
+ return this;
</ins><span class="cx">
</span><del>- Element* element = node->shadowHost();
- if (!element || !is<HTMLInputElement>(element))
</del><ins>+ auto* element = node->shadowHost();
+ if (!is<HTMLInputElement>(element))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- if (AXObjectCache* cache = axObjectCache())
</del><ins>+ if (auto* cache = axObjectCache())
</ins><span class="cx"> return cache->getOrCreate(element);
</span><span class="cx">
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -643,14 +638,11 @@
</span><span class="cx"> bool AccessibilityNodeObject::isNativeCheckboxOrRadio() const
</span><span class="cx"> {
</span><span class="cx"> Node* node = this->node();
</span><del>- if (!node)
</del><ins>+ if (!is<HTMLInputElement>(node))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- HTMLInputElement* input = node->toInputElement();
- if (input)
- return input->isCheckbox() || input->isRadioButton();
-
- return false;
</del><ins>+ auto& input = downcast<HTMLInputElement>(*node);
+ return input.isCheckbox() || input.isRadioButton();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool AccessibilityNodeObject::isEnabled() const
</span><span class="lines">@@ -676,15 +668,8 @@
</span><span class="cx">
</span><span class="cx"> bool AccessibilityNodeObject::isIndeterminate() const
</span><span class="cx"> {
</span><del>- Node* node = this->node();
- if (!node)
- return false;
-
- HTMLInputElement* inputElement = node->toInputElement();
- if (!inputElement)
- return false;
-
- return inputElement->shouldAppearIndeterminate();
</del><ins>+ auto* node = this->node();
+ return is<HTMLInputElement>(node) && downcast<HTMLInputElement>(*node).shouldAppearIndeterminate();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool AccessibilityNodeObject::isPressed() const
</span><span class="lines">@@ -716,9 +701,8 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // First test for native checkedness semantics
</span><del>- HTMLInputElement* inputElement = node->toInputElement();
- if (inputElement)
- return inputElement->shouldAppearChecked();
</del><ins>+ if (is<HTMLInputElement>(*node))
+ return downcast<HTMLInputElement>(*node).shouldAppearChecked();
</ins><span class="cx">
</span><span class="cx"> // Else, if this is an ARIA checkbox or radio, respect the aria-checked attribute
</span><span class="cx"> bool validRole = false;
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -903,7 +903,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::PseudoClassAutofill:
</span><del>- return isAutofilled(element);
</del><ins>+ return isAutofilled(*element);
</ins><span class="cx"> case CSSSelector::PseudoClassAnyLink:
</span><span class="cx"> case CSSSelector::PseudoClassAnyLinkDeprecated:
</span><span class="cx"> case CSSSelector::PseudoClassLink:
</span><span class="lines">@@ -972,7 +972,7 @@
</span><span class="cx"> case CSSSelector::PseudoClassInvalid:
</span><span class="cx"> return isInvalid(element);
</span><span class="cx"> case CSSSelector::PseudoClassChecked:
</span><del>- return isChecked(element);
</del><ins>+ return isChecked(*element);
</ins><span class="cx"> case CSSSelector::PseudoClassIndeterminate:
</span><span class="cx"> return shouldAppearIndeterminate(element);
</span><span class="cx"> case CSSSelector::PseudoClassRoot:
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckerTestFunctionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -41,13 +41,9 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-ALWAYS_INLINE bool isAutofilled(const Element* element)
</del><ins>+ALWAYS_INLINE bool isAutofilled(const Element& element)
</ins><span class="cx"> {
</span><del>- if (is<HTMLFormControlElement>(*element)) {
- if (const HTMLInputElement* inputElement = element->toInputElement())
- return inputElement->isAutoFilled();
- }
- return false;
</del><ins>+ return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isAutoFilled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ALWAYS_INLINE bool isDefaultButtonForForm(const Element* element)
</span><span class="lines">@@ -72,16 +68,18 @@
</span><span class="cx"> return element->document().isMediaDocument();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ALWAYS_INLINE bool isChecked(Element* element)
</del><ins>+ALWAYS_INLINE bool isChecked(Element& element)
</ins><span class="cx"> {
</span><span class="cx"> // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that
</span><span class="cx"> // you can't be both checked and indeterminate. We will behave like WinIE behind the scenes and just
</span><span class="cx"> // obey the CSS spec here in the test for matching the pseudo.
</span><del>- const HTMLInputElement* inputElement = element->toInputElement();
- if (inputElement && inputElement->shouldAppearChecked() && !inputElement->shouldAppearIndeterminate())
- return true;
- if (is<HTMLOptionElement>(*element) && downcast<HTMLOptionElement>(*element).selected())
- return true;
</del><ins>+ if (is<HTMLInputElement>(element)) {
+ auto& inputElement = downcast<HTMLInputElement>(element);
+ return inputElement.shouldAppearChecked() && !inputElement.shouldAppearIndeterminate();
+ }
+ if (is<HTMLOptionElement>(element))
+ return downcast<HTMLOptionElement>(element).selected();
+
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -479,84 +479,84 @@
</span><span class="cx"> return collector.hasAnyMatchingRules(ruleSet);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool StyleResolver::canShareStyleWithControl(StyledElement* element) const
</del><ins>+bool StyleResolver::canShareStyleWithControl(StyledElement& element) const
</ins><span class="cx"> {
</span><span class="cx"> const State& state = m_state;
</span><del>- HTMLInputElement* thisInputElement = element->toInputElement();
- HTMLInputElement* otherInputElement = state.element()->toInputElement();
-
- if (!thisInputElement || !otherInputElement)
</del><ins>+ if (!is<HTMLInputElement>(element) || !is<HTMLInputElement>(*state.element()))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (thisInputElement->isAutoFilled() != otherInputElement->isAutoFilled())
</del><ins>+ auto& thisInputElement = downcast<HTMLInputElement>(element);
+ auto& otherInputElement = downcast<HTMLInputElement>(*state.element());
+
+ if (thisInputElement.isAutoFilled() != otherInputElement.isAutoFilled())
</ins><span class="cx"> return false;
</span><del>- if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
</del><ins>+ if (thisInputElement.shouldAppearChecked() != otherInputElement.shouldAppearChecked())
</ins><span class="cx"> return false;
</span><del>- if (thisInputElement->shouldAppearIndeterminate() != otherInputElement->shouldAppearIndeterminate())
</del><ins>+ if (thisInputElement.shouldAppearIndeterminate() != otherInputElement.shouldAppearIndeterminate())
</ins><span class="cx"> return false;
</span><del>- if (thisInputElement->isRequired() != otherInputElement->isRequired())
</del><ins>+ if (thisInputElement.isRequired() != otherInputElement.isRequired())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->isDisabledFormControl() != state.element()->isDisabledFormControl())
</del><ins>+ if (element.isDisabledFormControl() != state.element()->isDisabledFormControl())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->isDefaultButtonForForm() != state.element()->isDefaultButtonForForm())
</del><ins>+ if (element.isDefaultButtonForForm() != state.element()->isDefaultButtonForForm())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->isInRange() != state.element()->isInRange())
</del><ins>+ if (element.isInRange() != state.element()->isInRange())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->isOutOfRange() != state.element()->isOutOfRange())
</del><ins>+ if (element.isOutOfRange() != state.element()->isOutOfRange())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline bool elementHasDirectionAuto(Element* element)
</del><ins>+static inline bool elementHasDirectionAuto(Element& element)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
</span><del>- return is<HTMLElement>(*element) && downcast<HTMLElement>(*element).hasDirectionAuto();
</del><ins>+ return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement* sharingCandidate) const
</del><ins>+bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement& sharingCandidate) const
</ins><span class="cx"> {
</span><span class="cx"> const State& state = m_state;
</span><del>- if (state.element()->elementData() == sharingCandidate->elementData())
</del><ins>+ if (state.element()->elementData() == sharingCandidate.elementData())
</ins><span class="cx"> return true;
</span><del>- if (state.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))
</del><ins>+ if (state.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate.fastGetAttribute(XMLNames::langAttr))
</ins><span class="cx"> return false;
</span><del>- if (state.element()->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr))
</del><ins>+ if (state.element()->fastGetAttribute(langAttr) != sharingCandidate.fastGetAttribute(langAttr))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!state.elementAffectedByClassRules()) {
</span><del>- if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames()))
</del><ins>+ if (sharingCandidate.hasClass() && classNamesAffectedByRules(sharingCandidate.classNames()))
</ins><span class="cx"> return false;
</span><del>- } else if (sharingCandidate->hasClass()) {
</del><ins>+ } else if (sharingCandidate.hasClass()) {
</ins><span class="cx"> // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG.
</span><span class="cx"> if (state.element()->isSVGElement()) {
</span><del>- if (state.element()->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))
</del><ins>+ if (state.element()->getAttribute(classAttr) != sharingCandidate.getAttribute(classAttr))
</ins><span class="cx"> return false;
</span><span class="cx"> } else {
</span><del>- if (state.element()->classNames() != sharingCandidate->classNames())
</del><ins>+ if (state.element()->classNames() != sharingCandidate.classNames())
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> } else
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (state.styledElement()->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())
</del><ins>+ if (state.styledElement()->presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (state.element()->hasTagName(progressTag)) {
</span><del>- if (state.element()->shouldAppearIndeterminate() != sharingCandidate->shouldAppearIndeterminate())
</del><ins>+ if (state.element()->shouldAppearIndeterminate() != sharingCandidate.shouldAppearIndeterminate())
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool StyleResolver::canShareStyleWithElement(StyledElement* element) const
</del><ins>+bool StyleResolver::canShareStyleWithElement(StyledElement& element) const
</ins><span class="cx"> {
</span><del>- RenderStyle* style = element->renderStyle();
</del><ins>+ auto* style = element.renderStyle();
</ins><span class="cx"> const State& state = m_state;
</span><span class="cx">
</span><span class="cx"> if (!style)
</span><span class="lines">@@ -565,37 +565,37 @@
</span><span class="cx"> return false;
</span><span class="cx"> if (style->hasUniquePseudoStyle())
</span><span class="cx"> return false;
</span><del>- if (element->tagQName() != state.element()->tagQName())
</del><ins>+ if (element.tagQName() != state.element()->tagQName())
</ins><span class="cx"> return false;
</span><del>- if (element->inlineStyle())
</del><ins>+ if (element.inlineStyle())
</ins><span class="cx"> return false;
</span><del>- if (element->needsStyleRecalc())
</del><ins>+ if (element.needsStyleRecalc())
</ins><span class="cx"> return false;
</span><del>- if (element->isSVGElement() && downcast<SVGElement>(*element).animatedSMILStyleProperties())
</del><ins>+ if (element.isSVGElement() && downcast<SVGElement>(element).animatedSMILStyleProperties())
</ins><span class="cx"> return false;
</span><del>- if (element->isLink() != state.element()->isLink())
</del><ins>+ if (element.isLink() != state.element()->isLink())
</ins><span class="cx"> return false;
</span><del>- if (element->hovered() != state.element()->hovered())
</del><ins>+ if (element.hovered() != state.element()->hovered())
</ins><span class="cx"> return false;
</span><del>- if (element->active() != state.element()->active())
</del><ins>+ if (element.active() != state.element()->active())
</ins><span class="cx"> return false;
</span><del>- if (element->focused() != state.element()->focused())
</del><ins>+ if (element.focused() != state.element()->focused())
</ins><span class="cx"> return false;
</span><del>- if (element->shadowPseudoId() != state.element()->shadowPseudoId())
</del><ins>+ if (element.shadowPseudoId() != state.element()->shadowPseudoId())
</ins><span class="cx"> return false;
</span><del>- if (element == element->document().cssTarget())
</del><ins>+ if (&element == element.document().cssTarget())
</ins><span class="cx"> return false;
</span><span class="cx"> if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element))
</span><span class="cx"> return false;
</span><del>- if (element->additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle())
</del><ins>+ if (element.additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle())
</ins><span class="cx"> return false;
</span><del>- if (element->affectsNextSiblingElementStyle() || element->styleIsAffectedByPreviousSibling())
</del><ins>+ if (element.affectsNextSiblingElementStyle() || element.styleIsAffectedByPreviousSibling())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->hasID() && m_ruleSets.features().idsInRules.contains(element->idForStyleResolution().impl()))
</del><ins>+ if (element.hasID() && m_ruleSets.features().idsInRules.contains(element.idForStyleResolution().impl()))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- bool isControl = is<HTMLFormControlElement>(*element);
</del><ins>+ bool isControl = is<HTMLFormControlElement>(element);
</ins><span class="cx">
</span><span class="cx"> if (isControl != is<HTMLFormControlElement>(*state.element()))
</span><span class="cx"> return false;
</span><span class="lines">@@ -608,31 +608,31 @@
</span><span class="cx">
</span><span class="cx"> // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
</span><span class="cx"> // See comments in RenderObject::setStyle().
</span><del>- if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag) || element->hasTagName(canvasTag))
</del><ins>+ if (element.hasTagName(iframeTag) || element.hasTagName(frameTag) || element.hasTagName(embedTag) || element.hasTagName(objectTag) || element.hasTagName(appletTag) || element.hasTagName(canvasTag))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (elementHasDirectionAuto(element))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->isLink() && state.elementLinkState() != style->insideLink())
</del><ins>+ if (element.isLink() && state.elementLinkState() != style->insideLink())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->elementData() != state.element()->elementData()) {
- if (element->fastGetAttribute(readonlyAttr) != state.element()->fastGetAttribute(readonlyAttr))
</del><ins>+ if (element.elementData() != state.element()->elementData()) {
+ if (element.fastGetAttribute(readonlyAttr) != state.element()->fastGetAttribute(readonlyAttr))
</ins><span class="cx"> return false;
</span><del>- if (element->isSVGElement()) {
- if (element->getAttribute(typeAttr) != state.element()->getAttribute(typeAttr))
</del><ins>+ if (element.isSVGElement()) {
+ if (element.getAttribute(typeAttr) != state.element()->getAttribute(typeAttr))
</ins><span class="cx"> return false;
</span><span class="cx"> } else {
</span><del>- if (element->fastGetAttribute(typeAttr) != state.element()->fastGetAttribute(typeAttr))
</del><ins>+ if (element.fastGetAttribute(typeAttr) != state.element()->fastGetAttribute(typeAttr))
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (element->matchesValidPseudoClass() != state.element()->matchesValidPseudoClass())
</del><ins>+ if (element.matchesValidPseudoClass() != state.element()->matchesValidPseudoClass())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element->matchesInvalidPseudoClass() != state.element()->matchesValidPseudoClass())
</del><ins>+ if (element.matchesInvalidPseudoClass() != state.element()->matchesValidPseudoClass())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="lines">@@ -642,7 +642,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><del>- if (element == element->document().webkitCurrentFullScreenElement() || state.element() == state.document().webkitCurrentFullScreenElement())
</del><ins>+ if (&element == element.document().webkitCurrentFullScreenElement() || state.element() == state.document().webkitCurrentFullScreenElement())
</ins><span class="cx"> return false;
</span><span class="cx"> #endif
</span><span class="cx"> return true;
</span><span class="lines">@@ -653,7 +653,7 @@
</span><span class="cx"> for (; node; node = node->previousSibling()) {
</span><span class="cx"> if (!is<StyledElement>(*node))
</span><span class="cx"> continue;
</span><del>- if (canShareStyleWithElement(downcast<StyledElement>(node)))
</del><ins>+ if (canShareStyleWithElement(downcast<StyledElement>(*node)))
</ins><span class="cx"> break;
</span><span class="cx"> if (count++ == cStyleSearchThreshold)
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -679,7 +679,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> if (state.element() == state.document().cssTarget())
</span><span class="cx"> return nullptr;
</span><del>- if (elementHasDirectionAuto(state.element()))
</del><ins>+ if (elementHasDirectionAuto(*state.element()))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> // Cache whether state.element is affected by any known class selectors.
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/css/StyleResolver.h        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx"> bool styleSharingCandidateMatchesRuleSet(RuleSet*);
</span><span class="cx"> Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
</span><span class="cx"> StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const;
</span><del>- bool canShareStyleWithElement(StyledElement*) const;
</del><ins>+ bool canShareStyleWithElement(StyledElement&) const;
</ins><span class="cx">
</span><span class="cx"> Ref<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
</span><span class="cx">
</span><span class="lines">@@ -530,7 +530,7 @@
</span><span class="cx">
</span><span class="cx"> void cacheBorderAndBackground();
</span><span class="cx">
</span><del>- bool canShareStyleWithControl(StyledElement*) const;
</del><ins>+ bool canShareStyleWithControl(StyledElement&) const;
</ins><span class="cx">
</span><span class="cx"> void applyProperty(CSSPropertyID, CSSValue*, SelectorChecker::LinkMatchMask = SelectorChecker::MatchDefault, const MatchResult* = nullptr);
</span><span class="cx"> RefPtr<CSSValue> resolvedVariableValue(CSSPropertyID, const CSSVariableDependentValue&);
</span><span class="lines">@@ -559,7 +559,7 @@
</span><span class="cx"> void sweepMatchedPropertiesCache();
</span><span class="cx">
</span><span class="cx"> bool classNamesAffectedByRules(const SpaceSplitString&) const;
</span><del>- bool sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement*) const;
</del><ins>+ bool sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement&) const;
</ins><span class="cx">
</span><span class="cx"> unsigned m_matchedPropertiesCacheAdditionsSinceLastSweep;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/dom/Node.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -357,15 +357,6 @@
</span><span class="cx"> return this;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HTMLInputElement* Node::toInputElement()
-{
- // If one of the below ASSERTs trigger, you are calling this function
- // directly or indirectly from a constructor or destructor of this object.
- // Don't do this!
- ASSERT(!(isHTMLElement() && hasTagName(inputTag)));
- return 0;
-}
-
</del><span class="cx"> String Node::nodeValue() const
</span><span class="cx"> {
</span><span class="cx"> return String();
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/dom/Node.h        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -512,8 +512,6 @@
</span><span class="cx"> WEBCORE_EXPORT unsigned short compareDocumentPosition(Node*);
</span><span class="cx">
</span><span class="cx"> virtual Node* toNode() override;
</span><del>- virtual HTMLInputElement* toInputElement();
- const HTMLInputElement* toInputElement() const { return const_cast<Node*>(this)->toInputElement(); }
</del><span class="cx">
</span><span class="cx"> virtual EventTargetInterface eventTargetInterface() const override;
</span><span class="cx"> virtual ScriptExecutionContext* scriptExecutionContext() const override final; // Implemented in Document.h
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -858,7 +858,7 @@
</span><span class="cx"> auto* renderer = node->renderer();
</span><span class="cx"> if (!(renderer ? renderer->isBR() : node->hasTagName(brTag)))
</span><span class="cx"> return false;
</span><del>- return emitsOriginalText || !(node->isInShadowTree() && node->shadowHost()->toInputElement());
</del><ins>+ return emitsOriginalText || !(node->isInShadowTree() && is<HTMLInputElement>(*node->shadowHost()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool hasHeaderTag(HTMLElement& element)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.h (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.h        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/html/HTMLInputElement.h        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -66,8 +66,6 @@
</span><span class="cx"> static Ref<HTMLInputElement> create(const QualifiedName&, Document&, HTMLFormElement*, bool createdByParser);
</span><span class="cx"> virtual ~HTMLInputElement();
</span><span class="cx">
</span><del>- virtual HTMLInputElement* toInputElement() override final { return this; }
-
</del><span class="cx"> WEBCORE_EXPORT virtual bool shouldAutocomplete() const override final;
</span><span class="cx">
</span><span class="cx"> // For ValidityState
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlRadioNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/RadioNodeList.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/RadioNodeList.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/html/RadioNodeList.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -50,20 +50,22 @@
</span><span class="cx"> ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_name);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline HTMLInputElement* toRadioButtonInputElement(Node* node)
</del><ins>+static inline HTMLInputElement* toRadioButtonInputElement(Node& node)
</ins><span class="cx"> {
</span><del>- ASSERT(node->isElementNode());
- HTMLInputElement* inputElement = node->toInputElement();
- if (!inputElement || !inputElement->isRadioButton() || inputElement->value().isEmpty())
- return 0;
- return inputElement;
</del><ins>+ if (!is<HTMLInputElement>(node))
+ return nullptr;
+
+ auto& inputElement = downcast<HTMLInputElement>(node);
+ if (!inputElement.isRadioButton() || inputElement.value().isEmpty())
+ return nullptr;
+ return &inputElement;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String RadioNodeList::value() const
</span><span class="cx"> {
</span><del>- for (unsigned i = 0; i < length(); ++i) {
- Node* node = item(i);
- const HTMLInputElement* inputElement = toRadioButtonInputElement(node);
</del><ins>+ auto length = this->length();
+ for (unsigned i = 0; i < length; ++i) {
+ auto* inputElement = toRadioButtonInputElement(*item(i));
</ins><span class="cx"> if (!inputElement || !inputElement->checked())
</span><span class="cx"> continue;
</span><span class="cx"> return inputElement->value();
</span><span class="lines">@@ -73,9 +75,9 @@
</span><span class="cx">
</span><span class="cx"> void RadioNodeList::setValue(const String& value)
</span><span class="cx"> {
</span><del>- for (unsigned i = 0; i < length(); ++i) {
- Node* node = item(i);
- HTMLInputElement* inputElement = toRadioButtonInputElement(node);
</del><ins>+ auto length = this->length();
+ for (unsigned i = 0; i < length; ++i) {
+ auto* inputElement = toRadioButtonInputElement(*item(i));
</ins><span class="cx"> if (!inputElement || inputElement->value() != value)
</span><span class="cx"> continue;
</span><span class="cx"> inputElement->setChecked(true);
</span><span class="lines">@@ -104,10 +106,8 @@
</span><span class="cx"> if (!is<HTMLObjectElement>(testElement) && !is<HTMLFormControlElement>(testElement))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (HTMLInputElement* inputElement = testElement.toInputElement()) {
- if (inputElement->isImageButton())
- return false;
- }
</del><ins>+ if (is<HTMLInputElement>(testElement) && downcast<HTMLInputElement>(testElement).isImageButton())
+ return false;
</ins><span class="cx">
</span><span class="cx"> return checkElementMatchesRadioNodeListFilter(testElement);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowSliderThumbElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -55,20 +55,20 @@
</span><span class="cx">
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><del>-inline static Decimal sliderPosition(HTMLInputElement* element)
</del><ins>+inline static Decimal sliderPosition(HTMLInputElement& element)
</ins><span class="cx"> {
</span><del>- const StepRange stepRange(element->createStepRange(RejectAny));
- const Decimal oldValue = parseToDecimalForNumberType(element->value(), stepRange.defaultValue());
</del><ins>+ const StepRange stepRange(element.createStepRange(RejectAny));
+ const Decimal oldValue = parseToDecimalForNumberType(element.value(), stepRange.defaultValue());
</ins><span class="cx"> return stepRange.proportionFromValue(stepRange.clampValue(oldValue));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline static bool hasVerticalAppearance(HTMLInputElement* input)
</del><ins>+inline static bool hasVerticalAppearance(HTMLInputElement& input)
</ins><span class="cx"> {
</span><del>- ASSERT(input->renderer());
- const RenderStyle& sliderStyle = input->renderer()->style();
</del><ins>+ ASSERT(input.renderer());
+ const RenderStyle& sliderStyle = input.renderer()->style();
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>- if (sliderStyle.appearance() == MediaVolumeSliderPart && input->renderer()->theme().usesVerticalVolumeSlider())
</del><ins>+ if (sliderStyle.appearance() == MediaVolumeSliderPart && input.renderer()->theme().usesVerticalVolumeSlider())
</ins><span class="cx"> return true;
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -126,11 +126,12 @@
</span><span class="cx">
</span><span class="cx"> void RenderSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
</span><span class="cx"> {
</span><del>- HTMLInputElement* input = element()->shadowHost()->toInputElement();
</del><ins>+ ASSERT(element()->shadowHost());
+ auto& input = downcast<HTMLInputElement>(*element()->shadowHost());
</ins><span class="cx"> bool isVertical = hasVerticalAppearance(input);
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DATALIST_ELEMENT)
</span><del>- if (input->renderer()->isSlider() && !isVertical && input->list()) {
</del><ins>+ if (input.renderer()->isSlider() && !isVertical && input.list()) {
</ins><span class="cx"> int offsetFromCenter = theme().sliderTickOffsetFromTrackCenter();
</span><span class="cx"> LayoutUnit trackHeight = 0;
</span><span class="cx"> if (offsetFromCenter < 0)
</span><span class="lines">@@ -154,7 +155,8 @@
</span><span class="cx">
</span><span class="cx"> void RenderSliderContainer::layout()
</span><span class="cx"> {
</span><del>- HTMLInputElement* input = element()->shadowHost()->toInputElement();
</del><ins>+ ASSERT(element()->shadowHost());
+ auto& input = downcast<HTMLInputElement>(*element()->shadowHost());
</ins><span class="cx"> bool isVertical = hasVerticalAppearance(input);
</span><span class="cx"> style().setFlexDirection(isVertical ? FlowColumn : FlowRow);
</span><span class="cx"> TextDirection oldTextDirection = style().direction();
</span><span class="lines">@@ -165,8 +167,8 @@
</span><span class="cx"> style().setDirection(LTR);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RenderBox* thumb = input->sliderThumbElement() ? input->sliderThumbElement()->renderBox() : 0;
- RenderBox* track = input->sliderTrackElement() ? input->sliderTrackElement()->renderBox() : 0;
</del><ins>+ RenderBox* thumb = input.sliderThumbElement() ? input.sliderThumbElement()->renderBox() : nullptr;
+ RenderBox* track = input.sliderTrackElement() ? input.sliderTrackElement()->renderBox() : nullptr;
</ins><span class="cx"> // Force a layout to reset the position of the thumb so the code below doesn't move the thumb to the wrong place.
</span><span class="cx"> // FIXME: Make a custom Render class for the track and move the thumb positioning code there.
</span><span class="cx"> if (track)
</span><span class="lines">@@ -261,7 +263,7 @@
</span><span class="cx"> RenderBox& inputRenderer = downcast<RenderBox>(*input->renderer());
</span><span class="cx"> RenderBox& trackRenderer = *trackElement->renderBox();
</span><span class="cx">
</span><del>- bool isVertical = hasVerticalAppearance(input.get());
</del><ins>+ bool isVertical = hasVerticalAppearance(*input);
</ins><span class="cx"> bool isLeftToRightDirection = renderBox()->style().isLeftToRightDirection();
</span><span class="cx">
</span><span class="cx"> LayoutPoint offset(inputRenderer.absoluteToLocal(absolutePoint, UseTransforms));
</span><span class="lines">@@ -569,8 +571,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes.
</span><span class="cx"> // So, shadowHost() must be an HTMLInputElement.
</span><del>- Element* host = shadowHost();
- return host ? host->toInputElement() : 0;
</del><ins>+ return downcast<HTMLInputElement>(shadowHost());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const AtomicString& sliderThumbShadowPseudoId()
</span><span class="lines">@@ -644,13 +645,14 @@
</span><span class="cx"> DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderContainer, ("-webkit-media-slider-container", AtomicString::ConstructFromLiteral));
</span><span class="cx"> DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, sliderContainer, ("-webkit-slider-container", AtomicString::ConstructFromLiteral));
</span><span class="cx">
</span><del>- HTMLInputElement* input = shadowHost()->toInputElement();
- if (!input)
</del><ins>+ if (!is<HTMLInputElement>(*shadowHost()))
</ins><span class="cx"> return sliderContainer;
</span><del>- if (!input->renderer())
</del><ins>+
+ auto& input = downcast<HTMLInputElement>(*shadowHost());
+ if (!input.renderer())
</ins><span class="cx"> return emptyAtom;
</span><span class="cx">
</span><del>- const RenderStyle& sliderStyle = input->renderer()->style();
</del><ins>+ const RenderStyle& sliderStyle = input.renderer()->style();
</ins><span class="cx"> switch (sliderStyle.appearance()) {
</span><span class="cx"> case MediaSliderPart:
</span><span class="cx"> case MediaSliderThumbPart:
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -421,9 +421,9 @@
</span><span class="cx"> if (unloadEventPolicy != UnloadEventPolicyNone) {
</span><span class="cx"> if (m_frame.document()) {
</span><span class="cx"> if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) {
</span><del>- Element* currentFocusedElement = m_frame.document()->focusedElement();
- if (currentFocusedElement && currentFocusedElement->toInputElement())
- currentFocusedElement->toInputElement()->endEditing();
</del><ins>+ auto* currentFocusedElement = m_frame.document()->focusedElement();
+ if (is<HTMLInputElement>(currentFocusedElement))
+ downcast<HTMLInputElement>(*currentFocusedElement).endEditing();
</ins><span class="cx"> if (m_pageDismissalEventBeingDispatched == PageDismissalType::None) {
</span><span class="cx"> if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) {
</span><span class="cx"> m_pageDismissalEventBeingDispatched = PageDismissalType::PageHide;
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/page/DragController.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -281,17 +281,20 @@
</span><span class="cx"> return dragOperation;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static HTMLInputElement* asFileInput(Node* node)
</del><ins>+static HTMLInputElement* asFileInput(Node& node)
</ins><span class="cx"> {
</span><del>- ASSERT(node);
</del><ins>+ if (!is<HTMLInputElement>(node))
+ return nullptr;
</ins><span class="cx">
</span><del>- HTMLInputElement* inputElement = node->toInputElement();
</del><ins>+ auto* inputElement = &downcast<HTMLInputElement>(node);
</ins><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 && inputElement->isTextButton() && is<ShadowRoot>(inputElement->treeScope().rootNode()))
- inputElement = downcast<ShadowRoot>(inputElement->treeScope().rootNode()).host()->toInputElement();
</del><ins>+ if (inputElement->isTextButton() && is<ShadowRoot>(inputElement->treeScope().rootNode())) {
+ auto& host = *downcast<ShadowRoot>(inputElement->treeScope().rootNode()).host();
+ inputElement = is<HTMLInputElement>(host) ? &downcast<HTMLInputElement>(host) : nullptr;
+ }
</ins><span class="cx">
</span><del>- return inputElement && inputElement->isFileUpload() ? inputElement : 0;
</del><ins>+ return inputElement && inputElement->isFileUpload() ? inputElement : nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This can return null if an empty document is loaded.
</span><span class="lines">@@ -355,7 +358,7 @@
</span><span class="cx"> if (!element)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- HTMLInputElement* elementAsFileInput = asFileInput(element);
</del><ins>+ HTMLInputElement* elementAsFileInput = asFileInput(*element);
</ins><span class="cx"> if (m_fileInputElementUnderMouse != elementAsFileInput) {
</span><span class="cx"> if (m_fileInputElementUnderMouse)
</span><span class="cx"> m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false);
</span><span class="lines">@@ -565,7 +568,7 @@
</span><span class="cx"> if (!result.innerNonSharedNode())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (dragData.containsFiles() && asFileInput(result.innerNonSharedNode()))
</del><ins>+ if (dragData.containsFiles() && asFileInput(*result.innerNonSharedNode()))
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> if (is<HTMLPlugInElement>(*result.innerNonSharedNode())) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderButtoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderButton.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderButton.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/rendering/RenderButton.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">
</span><span class="cx"> bool RenderButton::hasLineIfEmpty() const
</span><span class="cx"> {
</span><del>- return formControlElement().toInputElement();
</del><ins>+ return is<HTMLInputElement>(formControlElement());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderButton::addChild(RenderObject* newChild, RenderObject* beforeChild)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -785,26 +785,12 @@
</span><span class="cx">
</span><span class="cx"> bool RenderTheme::isChecked(const RenderObject& o) const
</span><span class="cx"> {
</span><del>- if (!o.node())
- return false;
-
- HTMLInputElement* inputElement = o.node()->toInputElement();
- if (!inputElement)
- return false;
-
- return inputElement->shouldAppearChecked();
</del><ins>+ return is<HTMLInputElement>(o.node()) && downcast<HTMLInputElement>(*o.node()).shouldAppearChecked();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderTheme::isIndeterminate(const RenderObject& o) const
</span><span class="cx"> {
</span><del>- if (!o.node())
- return false;
-
- HTMLInputElement* inputElement = o.node()->toInputElement();
- if (!inputElement)
- return false;
-
- return inputElement->shouldAppearIndeterminate();
</del><ins>+ return is<HTMLInputElement>(o.node()) && downcast<HTMLInputElement>(*o.node()).shouldAppearIndeterminate();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderTheme::isEnabled(const RenderObject& renderer) const
</span><span class="lines">@@ -993,20 +979,16 @@
</span><span class="cx">
</span><span class="cx"> void RenderTheme::paintSliderTicks(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- Node* node = o.node();
- if (!node)
</del><ins>+ if (!is<HTMLInputElement>(o.node()))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- HTMLInputElement* input = node->toInputElement();
- if (!input)
- return;
-
- HTMLDataListElement* dataList = downcast<HTMLDataListElement>(input->list());
</del><ins>+ auto& input = downcast<HTMLInputElement>(*o.node());
+ auto* dataList = downcast<HTMLDataListElement>(input.list());
</ins><span class="cx"> if (!dataList)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- double min = input->minimum();
- double max = input->maximum();
</del><ins>+ double min = input.minimum();
+ double max = input.maximum();
</ins><span class="cx"> ControlPart part = o.style().appearance();
</span><span class="cx"> // We don't support ticks on alternate sliders like MediaVolumeSliders.
</span><span class="cx"> if (part != SliderHorizontalPart && part != SliderVerticalPart)
</span><span class="lines">@@ -1014,7 +996,7 @@
</span><span class="cx"> bool isHorizontal = part == SliderHorizontalPart;
</span><span class="cx">
</span><span class="cx"> IntSize thumbSize;
</span><del>- const RenderObject* thumbRenderer = input->sliderThumbElement()->renderer();
</del><ins>+ const RenderObject* thumbRenderer = input.sliderThumbElement()->renderer();
</ins><span class="cx"> if (thumbRenderer) {
</span><span class="cx"> const RenderStyle& thumbStyle = thumbRenderer->style();
</span><span class="cx"> int thumbWidth = thumbStyle.width().intValue();
</span><span class="lines">@@ -1029,7 +1011,7 @@
</span><span class="cx"> int tickRegionSideMargin = 0;
</span><span class="cx"> int tickRegionWidth = 0;
</span><span class="cx"> IntRect trackBounds;
</span><del>- RenderObject* trackRenderer = input->sliderTrackElement()->renderer();
</del><ins>+ RenderObject* trackRenderer = input.sliderTrackElement()->renderer();
</ins><span class="cx"> // We can ignoring transforms because transform is handled by the graphics context.
</span><span class="cx"> if (trackRenderer)
</span><span class="cx"> trackBounds = trackRenderer->absoluteBoundingBoxRectIgnoringTransforms();
</span><span class="lines">@@ -1059,9 +1041,9 @@
</span><span class="cx"> ASSERT(is<HTMLOptionElement>(*node));
</span><span class="cx"> HTMLOptionElement& optionElement = downcast<HTMLOptionElement>(*node);
</span><span class="cx"> String value = optionElement.value();
</span><del>- if (!input->isValidValue(value))
</del><ins>+ if (!input.isValidValue(value))
</ins><span class="cx"> continue;
</span><del>- double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(value));
</del><ins>+ double parsedValue = parseToDoubleForNumberType(input.sanitizeValue(value));
</ins><span class="cx"> double tickFraction = (parsedValue - min) / (max - min);
</span><span class="cx"> double tickRatio = isHorizontal && o.style().isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction;
</span><span class="cx"> double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tickRatio);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (191326 => 191327)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-10-20 02:43:59 UTC (rev 191326)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-10-20 03:29:34 UTC (rev 191327)
</span><span class="lines">@@ -1188,8 +1188,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (HTMLInputElement* inputElement = textField->toInputElement())
- return inputElement->lastChangeWasUserEdit();
</del><ins>+ if (is<HTMLInputElement>(*textField))
+ return downcast<HTMLInputElement>(*textField).lastChangeWasUserEdit();
</ins><span class="cx">
</span><span class="cx"> if (is<HTMLTextAreaElement>(*textField))
</span><span class="cx"> return downcast<HTMLTextAreaElement>(*textField).lastChangeWasUserEdit();
</span><span class="lines">@@ -1205,11 +1205,12 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (HTMLInputElement* inputElement = element->toInputElement())
- return inputElement->shouldAutocomplete();
</del><ins>+ if (!is<HTMLInputElement>(*element)) {
+ ec = INVALID_NODE_TYPE_ERR;
+ return false;
+ }
</ins><span class="cx">
</span><del>- ec = INVALID_NODE_TYPE_ERR;
- return false;
</del><ins>+ return downcast<HTMLInputElement>(*element).shouldAutocomplete();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Internals::setEditingValue(Element* element, const String& value, ExceptionCode& ec)
</span><span class="lines">@@ -1219,33 +1220,42 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- HTMLInputElement* inputElement = element->toInputElement();
- if (!inputElement) {
</del><ins>+ if (!is<HTMLInputElement>(*element)) {
</ins><span class="cx"> ec = INVALID_NODE_TYPE_ERR;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- inputElement->setEditingValue(value);
</del><ins>+ downcast<HTMLInputElement>(*element).setEditingValue(value);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- HTMLInputElement* inputElement = element->toInputElement();
- if (!inputElement) {
</del><ins>+ if (!element) {
</ins><span class="cx"> ec = INVALID_ACCESS_ERR;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- inputElement->setAutoFilled(enabled);
</del><ins>+
+ if (!is<HTMLInputElement>(*element)) {
+ ec = INVALID_NODE_TYPE_ERR;
+ return;
+ }
+
+ downcast<HTMLInputElement>(*element).setAutoFilled(enabled);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Internals::setShowAutoFillButton(Element* element, bool show, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- HTMLInputElement* inputElement = element->toInputElement();
- if (!inputElement) {
</del><ins>+ if (!element) {
</ins><span class="cx"> ec = INVALID_ACCESS_ERR;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- inputElement->setShowAutoFillButton(show);
</del><ins>+
+ if (!is<HTMLInputElement>(*element)) {
+ ec = INVALID_NODE_TYPE_ERR;
+ return;
+ }
+
+ downcast<HTMLInputElement>(*element).setShowAutoFillButton(show);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>