<!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>[176069] trunk</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/176069">176069</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-11-13 00:21:54 -0800 (Thu, 13 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Lazily create HTMLInputElement's inputType and shadow subtree
https://bugs.webkit.org/show_bug.cgi?id=138524

Reviewed by Ryosuke Niwa.

Source/WebCore:

When an HTMLInputElement was created by the parser, we would first call
HTMLInputElement::create(), then call Element::parserSetAttributes() on
the constructed input. With the previous implementation, this was a bit
inefficient because HTMLInputElement::create() would construct a
TextInputType inputType (as this is the default) as well as its
corresponding shadow subtree. Then, parserSetAttributes() would often
set the |type| attribute and would need to destroy this input type as
well as its subtree if the new |type| is not 'text', to create a new
inputType / shadow subtree of the right type. The profiler showed that
this was fairly expensive.

To improve this, this patch delays the inputType / shadow subtree
creation when the HTMLInputElement is constructed by the parser, until
the attributes are actually set by the parser. This way, we directly
create an inputType / shadow subtree of the right type.

I see a 1.4% speed up on speedometer (73.95 -&gt; 75.0).

Test: fast/dom/HTMLInputElement/border-attribute-crash.html

* dom/Element.cpp:
(WebCore::Element::parserSetAttributes):
(WebCore::Element::parserDidSetAttributes):
* dom/Element.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::create):
(WebCore::HTMLInputElement::updateType):
(WebCore::HTMLInputElement::runPostTypeUpdateTasks):
(WebCore::HTMLInputElement::initializeInputType):
(WebCore::HTMLInputElement::parseAttribute):
(WebCore::HTMLInputElement::parserDidSetAttributes):
(WebCore::HTMLInputElement::finishParsingChildren):
* html/HTMLInputElement.h:

LayoutTests:

Add a test case to make sure we don't crash when parsing an &lt;input&gt;
Element that has a |border| attribute as first attribute. This is what
was happening with the first version of this patch that landed in
<a href="http://trac.webkit.org/projects/webkit/changeset/175852">r175852</a>. When attributeChanged() was called for the |border| attribute
HTMLInputElement::isPresentationAttribute() would get called before
m_inputType is initialized, and &quot;name == borderAttr &amp;&amp; isImageButton()&quot;
would crash because isImageButton() dereferences m_inputType.

* fast/dom/HTMLInputElement/border-attribute-crash-expected.txt: Added.
* fast/dom/HTMLInputElement/border-attribute-crash.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementcpp">trunk/Source/WebCore/html/HTMLInputElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementh">trunk/Source/WebCore/html/HTMLInputElement.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLInputElementborderattributecrashexpectedtxt">trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLInputElementborderattributecrashhtml">trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/LayoutTests/ChangeLog        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-11-13  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Lazily create HTMLInputElement's inputType and shadow subtree
+        https://bugs.webkit.org/show_bug.cgi?id=138524
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a test case to make sure we don't crash when parsing an &lt;input&gt;
+        Element that has a |border| attribute as first attribute. This is what
+        was happening with the first version of this patch that landed in
+        r175852. When attributeChanged() was called for the |border| attribute
+        HTMLInputElement::isPresentationAttribute() would get called before
+        m_inputType is initialized, and &quot;name == borderAttr &amp;&amp; isImageButton()&quot;
+        would crash because isImageButton() dereferences m_inputType.
+
+        * fast/dom/HTMLInputElement/border-attribute-crash-expected.txt: Added.
+        * fast/dom/HTMLInputElement/border-attribute-crash.html: Added.
+
</ins><span class="cx"> 2014-11-12  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed GTK gardening. Skip more test failing after r175776.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLInputElementborderattributecrashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash-expected.txt (0 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash-expected.txt        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests that we don't crash when parsing an input element with a border attribute and image type.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS input.getAttribute('border') is &quot;0&quot;
+PASS input.getAttribute('type') is &quot;image&quot;
+PASS input.getAttribute('src') is &quot;submit.gif&quot;
+PASS input.getAttribute('alt') is &quot;Submit&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLInputElementborderattributecrashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash.html (0 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/border-attribute-crash.html        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;div id=&quot;testDiv&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Tests that we don't crash when parsing an input element with a border attribute and image type.&quot;);
+
+var testDiv = document.getElementById(&quot;testDiv&quot;);
+testDiv.innerHTML = &quot;&lt;input border='0' type='image' src='submit.gif' alt='Submit'&gt;&quot;;
+
+var input = testDiv.firstChild;
+shouldBeEqualToString(&quot;input.getAttribute('border')&quot;, &quot;0&quot;);
+shouldBeEqualToString(&quot;input.getAttribute('type')&quot;, &quot;image&quot;);
+shouldBeEqualToString(&quot;input.getAttribute('src')&quot;, &quot;submit.gif&quot;);
+shouldBeEqualToString(&quot;input.getAttribute('alt')&quot;, &quot;Submit&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/Source/WebCore/ChangeLog        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-11-13  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Lazily create HTMLInputElement's inputType and shadow subtree
+        https://bugs.webkit.org/show_bug.cgi?id=138524
+
+        Reviewed by Ryosuke Niwa.
+
+        When an HTMLInputElement was created by the parser, we would first call
+        HTMLInputElement::create(), then call Element::parserSetAttributes() on
+        the constructed input. With the previous implementation, this was a bit
+        inefficient because HTMLInputElement::create() would construct a
+        TextInputType inputType (as this is the default) as well as its
+        corresponding shadow subtree. Then, parserSetAttributes() would often
+        set the |type| attribute and would need to destroy this input type as
+        well as its subtree if the new |type| is not 'text', to create a new
+        inputType / shadow subtree of the right type. The profiler showed that
+        this was fairly expensive.
+
+        To improve this, this patch delays the inputType / shadow subtree
+        creation when the HTMLInputElement is constructed by the parser, until
+        the attributes are actually set by the parser. This way, we directly
+        create an inputType / shadow subtree of the right type.
+
+        I see a 1.4% speed up on speedometer (73.95 -&gt; 75.0).
+
+        Test: fast/dom/HTMLInputElement/border-attribute-crash.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::parserSetAttributes):
+        (WebCore::Element::parserDidSetAttributes):
+        * dom/Element.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::HTMLInputElement):
+        (WebCore::HTMLInputElement::create):
+        (WebCore::HTMLInputElement::updateType):
+        (WebCore::HTMLInputElement::runPostTypeUpdateTasks):
+        (WebCore::HTMLInputElement::initializeInputType):
+        (WebCore::HTMLInputElement::parseAttribute):
+        (WebCore::HTMLInputElement::parserDidSetAttributes):
+        (WebCore::HTMLInputElement::finishParsingChildren):
+        * html/HTMLInputElement.h:
+
</ins><span class="cx"> 2014-11-12  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Have DOMTimer deal with more ScriptExecutionContext references
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -1233,19 +1233,25 @@
</span><span class="cx">     ASSERT(!parentNode());
</span><span class="cx">     ASSERT(!m_elementData);
</span><span class="cx"> 
</span><del>-    if (attributeVector.isEmpty())
-        return;
</del><ins>+    if (!attributeVector.isEmpty()) {
+        if (document().sharedObjectPool())
+            m_elementData = document().sharedObjectPool()-&gt;cachedShareableElementDataWithAttributes(attributeVector);
+        else
+            m_elementData = ShareableElementData::createWithAttributes(attributeVector);
</ins><span class="cx"> 
</span><del>-    if (document().sharedObjectPool())
-        m_elementData = document().sharedObjectPool()-&gt;cachedShareableElementDataWithAttributes(attributeVector);
-    else
-        m_elementData = ShareableElementData::createWithAttributes(attributeVector);
</del><ins>+    }
</ins><span class="cx"> 
</span><ins>+    parserDidSetAttributes();
+
</ins><span class="cx">     // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData.
</span><del>-    for (unsigned i = 0; i &lt; attributeVector.size(); ++i)
-        attributeChanged(attributeVector[i].name(), nullAtom, attributeVector[i].value(), ModifiedDirectly);
</del><ins>+    for (const auto&amp; attribute : attributeVector)
+        attributeChanged(attribute.name(), nullAtom, attribute.value(), ModifiedDirectly);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Element::parserDidSetAttributes()
+{
+}
+
</ins><span class="cx"> bool Element::hasAttributes() const
</span><span class="cx"> {
</span><span class="cx">     synchronizeAllAttributes();
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/Source/WebCore/dom/Element.h        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -555,6 +555,7 @@
</span><span class="cx">     virtual void removedFrom(ContainerNode&amp;) override;
</span><span class="cx">     virtual void childrenChanged(const ChildChange&amp;) override;
</span><span class="cx">     virtual void removeAllEventListeners() override final;
</span><ins>+    virtual void parserDidSetAttributes();
</ins><span class="cx"> 
</span><span class="cx">     void clearTabIndexExplicitlyIfNeeded();    
</span><span class="cx">     void setTabIndexExplicitly(short);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.cpp        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -121,7 +121,9 @@
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx">     , m_hasTouchEventHandler(false)
</span><span class="cx"> #endif
</span><del>-    , m_inputType(InputType::createText(*this))
</del><ins>+    // m_inputType is lazily created when constructed by the parser to avoid constructing unnecessarily a text inputType and
+    // its shadow subtree, just to destroy them when the |type| attribute gets set by the parser to something else than 'text'.
+    , m_inputType(createdByParser ? nullptr : InputType::createText(*this))
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
</span><span class="cx">     setHasCustomStyleResolveCallbacks();
</span><span class="lines">@@ -129,8 +131,10 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;HTMLInputElement&gt; HTMLInputElement::create(const QualifiedName&amp; tagName, Document&amp; document, HTMLFormElement* form, bool createdByParser)
</span><span class="cx"> {
</span><ins>+    bool shouldCreateShadowRootLazily = createdByParser;
</ins><span class="cx">     RefPtr&lt;HTMLInputElement&gt; inputElement = adoptRef(new HTMLInputElement(tagName, document, form, createdByParser));
</span><del>-    inputElement-&gt;ensureUserAgentShadowRoot();
</del><ins>+    if (!shouldCreateShadowRootLazily)
+        inputElement-&gt;ensureUserAgentShadowRoot();
</ins><span class="cx">     return inputElement.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -432,6 +436,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLInputElement::updateType()
</span><span class="cx"> {
</span><ins>+    ASSERT(m_inputType);
</ins><span class="cx">     auto newType = InputType::create(*this, fastGetAttribute(typeAttr));
</span><span class="cx">     bool hadType = m_hasType;
</span><span class="cx">     m_hasType = true;
</span><span class="lines">@@ -457,17 +462,6 @@
</span><span class="cx">     m_inputType-&gt;createShadowSubtree();
</span><span class="cx">     updateInnerTextElementEditability();
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
-    bool hasTouchEventHandler = m_inputType-&gt;hasTouchEventHandler();
-    if (hasTouchEventHandler != m_hasTouchEventHandler) {
-        if (hasTouchEventHandler)
-            document().didAddTouchEventHandler(this);
-        else
-            document().didRemoveTouchEventHandler(this);
-        m_hasTouchEventHandler = hasTouchEventHandler;
-    }
-#endif
-
</del><span class="cx">     setNeedsWillValidateCheck();
</span><span class="cx"> 
</span><span class="cx">     bool willStoreValue = m_inputType-&gt;storesValueSeparateFromAttribute();
</span><span class="lines">@@ -503,6 +497,23 @@
</span><span class="cx">             attributeChanged(alignAttr, nullAtom, align-&gt;value());
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    runPostTypeUpdateTasks();
+}
+
+inline void HTMLInputElement::runPostTypeUpdateTasks()
+{
+    ASSERT(m_inputType);
+#if ENABLE(TOUCH_EVENTS)
+    bool hasTouchEventHandler = m_inputType-&gt;hasTouchEventHandler();
+    if (hasTouchEventHandler != m_hasTouchEventHandler) {
+        if (hasTouchEventHandler)
+            document().didAddTouchEventHandler(this);
+        else
+            document().didRemoveTouchEventHandler(this);
+        m_hasTouchEventHandler = hasTouchEventHandler;
+    }
+#endif
+
</ins><span class="cx">     if (renderer())
</span><span class="cx">         setNeedsStyleRecalc(ReconstructRenderTree);
</span><span class="cx"> 
</span><span class="lines">@@ -596,8 +607,29 @@
</span><span class="cx">         HTMLTextFormControlElement::collectStyleForPresentationAttribute(name, value, style);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void HTMLInputElement::initializeInputType()
+{
+    ASSERT(m_parsingInProgress);
+    ASSERT(!m_inputType);
+
+    const AtomicString&amp; type = fastGetAttribute(typeAttr);
+    if (type.isNull()) {
+        m_inputType = InputType::createText(*this);
+        ensureUserAgentShadowRoot();
+        return;
+    }
+
+    m_hasType = true;
+    m_inputType = InputType::create(*this, type);
+    ensureUserAgentShadowRoot();
+    registerForSuspensionCallbackIfNeeded();
+    runPostTypeUpdateTasks();
+}
+
</ins><span class="cx"> void HTMLInputElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><ins>+    ASSERT(m_inputType);
+
</ins><span class="cx">     if (name == nameAttr) {
</span><span class="cx">         removeFromRadioButtonGroup();
</span><span class="cx">         m_name = value;
</span><span class="lines">@@ -705,9 +737,16 @@
</span><span class="cx">     m_inputType-&gt;attributeChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HTMLInputElement::parserDidSetAttributes()
+{
+    ASSERT(m_parsingInProgress);
+    initializeInputType();
+}
+
</ins><span class="cx"> void HTMLInputElement::finishParsingChildren()
</span><span class="cx"> {
</span><span class="cx">     m_parsingInProgress = false;
</span><ins>+    ASSERT(m_inputType);
</ins><span class="cx">     HTMLTextFormControlElement::finishParsingChildren();
</span><span class="cx">     if (!m_stateRestored) {
</span><span class="cx">         bool checked = fastHasAttribute(checkedAttr);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.h (176068 => 176069)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.h        2014-11-13 07:59:17 UTC (rev 176068)
+++ trunk/Source/WebCore/html/HTMLInputElement.h        2014-11-13 08:21:54 UTC (rev 176069)
</span><span class="lines">@@ -359,6 +359,7 @@
</span><span class="cx">     virtual bool isPresentationAttribute(const QualifiedName&amp;) const override final;
</span><span class="cx">     virtual void collectStyleForPresentationAttribute(const QualifiedName&amp;, const AtomicString&amp;, MutableStyleProperties&amp;) override final;
</span><span class="cx">     virtual void finishParsingChildren() override final;
</span><ins>+    virtual void parserDidSetAttributes() override final;
</ins><span class="cx"> 
</span><span class="cx">     virtual void copyNonAttributePropertiesFromElement(const Element&amp;) override final;
</span><span class="cx"> 
</span><span class="lines">@@ -398,7 +399,9 @@
</span><span class="cx">     virtual bool recalcWillValidate() const override final;
</span><span class="cx">     virtual void requiredAttributeChanged() override final;
</span><span class="cx"> 
</span><ins>+    void initializeInputType();
</ins><span class="cx">     void updateType();
</span><ins>+    void runPostTypeUpdateTasks();
</ins><span class="cx">     
</span><span class="cx">     virtual void subtreeHasChanged() override final;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>