Title: [175970] trunk/Source/WebCore
Revision
175970
Author
[email protected]
Date
2014-11-11 13:13:59 -0800 (Tue, 11 Nov 2014)

Log Message

Unreviewed, rolling out r175852.
https://bugs.webkit.org/show_bug.cgi?id=138626

Broke PLT by introducing a crash. (Requested by rniwa on
#webkit).

Reverted changeset:

"Lazily create HTMLInputElement's inputType and shadow
subtree"
https://bugs.webkit.org/show_bug.cgi?id=138524
http://trac.webkit.org/changeset/175852

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175969 => 175970)


--- trunk/Source/WebCore/ChangeLog	2014-11-11 20:56:20 UTC (rev 175969)
+++ trunk/Source/WebCore/ChangeLog	2014-11-11 21:13:59 UTC (rev 175970)
@@ -1,3 +1,18 @@
+2014-11-11  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r175852.
+        https://bugs.webkit.org/show_bug.cgi?id=138626
+
+        Broke PLT by introducing a crash. (Requested by rniwa on
+        #webkit).
+
+        Reverted changeset:
+
+        "Lazily create HTMLInputElement's inputType and shadow
+        subtree"
+        https://bugs.webkit.org/show_bug.cgi?id=138524
+        http://trac.webkit.org/changeset/175852
+
 2014-11-11  Chris Dumez  <[email protected]>
 
         Regression(r175947): Caused assertions in debug builds

Modified: trunk/Source/WebCore/dom/Element.cpp (175969 => 175970)


--- trunk/Source/WebCore/dom/Element.cpp	2014-11-11 20:56:20 UTC (rev 175969)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-11-11 21:13:59 UTC (rev 175970)
@@ -1233,24 +1233,19 @@
     ASSERT(!parentNode());
     ASSERT(!m_elementData);
 
-    if (!attributeVector.isEmpty()) {
-        if (document().sharedObjectPool())
-            m_elementData = document().sharedObjectPool()->cachedShareableElementDataWithAttributes(attributeVector);
-        else
-            m_elementData = ShareableElementData::createWithAttributes(attributeVector);
+    if (attributeVector.isEmpty())
+        return;
 
-        // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData.
-        for (const auto& attribute : attributeVector)
-            attributeChanged(attribute.name(), nullAtom, attribute.value(), ModifiedDirectly);
-    }
+    if (document().sharedObjectPool())
+        m_elementData = document().sharedObjectPool()->cachedShareableElementDataWithAttributes(attributeVector);
+    else
+        m_elementData = ShareableElementData::createWithAttributes(attributeVector);
 
-    parserDidFinishParsingAttributes();
+    // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData.
+    for (unsigned i = 0; i < attributeVector.size(); ++i)
+        attributeChanged(attributeVector[i].name(), nullAtom, attributeVector[i].value(), ModifiedDirectly);
 }
 
-void Element::parserDidFinishParsingAttributes()
-{
-}
-
 bool Element::hasAttributes() const
 {
     synchronizeAllAttributes();

Modified: trunk/Source/WebCore/dom/Element.h (175969 => 175970)


--- trunk/Source/WebCore/dom/Element.h	2014-11-11 20:56:20 UTC (rev 175969)
+++ trunk/Source/WebCore/dom/Element.h	2014-11-11 21:13:59 UTC (rev 175970)
@@ -555,7 +555,6 @@
     virtual void removedFrom(ContainerNode&) override;
     virtual void childrenChanged(const ChildChange&) override;
     virtual void removeAllEventListeners() override final;
-    virtual void parserDidFinishParsingAttributes();
 
     void clearTabIndexExplicitlyIfNeeded();    
     void setTabIndexExplicitly(short);

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (175969 => 175970)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-11-11 20:56:20 UTC (rev 175969)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-11-11 21:13:59 UTC (rev 175970)
@@ -121,9 +121,7 @@
 #if ENABLE(TOUCH_EVENTS)
     , m_hasTouchEventHandler(false)
 #endif
-    // 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))
+    , m_inputType(InputType::createText(*this))
 {
     ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
     setHasCustomStyleResolveCallbacks();
@@ -131,10 +129,8 @@
 
 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser)
 {
-    bool shouldCreateShadowRootLazily = createdByParser;
     RefPtr<HTMLInputElement> inputElement = adoptRef(new HTMLInputElement(tagName, document, form, createdByParser));
-    if (!shouldCreateShadowRootLazily)
-        inputElement->ensureUserAgentShadowRoot();
+    inputElement->ensureUserAgentShadowRoot();
     return inputElement.release();
 }
 
@@ -436,7 +432,6 @@
 
 void HTMLInputElement::updateType()
 {
-    ASSERT(m_inputType);
     auto newType = InputType::create(*this, fastGetAttribute(typeAttr));
     bool hadType = m_hasType;
     m_hasType = true;
@@ -462,6 +457,17 @@
     m_inputType->createShadowSubtree();
     updateInnerTextElementEditability();
 
+#if ENABLE(TOUCH_EVENTS)
+    bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
+    if (hasTouchEventHandler != m_hasTouchEventHandler) {
+        if (hasTouchEventHandler)
+            document().didAddTouchEventHandler(this);
+        else
+            document().didRemoveTouchEventHandler(this);
+        m_hasTouchEventHandler = hasTouchEventHandler;
+    }
+#endif
+
     setNeedsWillValidateCheck();
 
     bool willStoreValue = m_inputType->storesValueSeparateFromAttribute();
@@ -497,23 +503,6 @@
             attributeChanged(alignAttr, nullAtom, align->value());
     }
 
-    runPostTypeUpdateTasks();
-}
-
-inline void HTMLInputElement::runPostTypeUpdateTasks()
-{
-    ASSERT(m_inputType);
-#if ENABLE(TOUCH_EVENTS)
-    bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
-    if (hasTouchEventHandler != m_hasTouchEventHandler) {
-        if (hasTouchEventHandler)
-            document().didAddTouchEventHandler(this);
-        else
-            document().didRemoveTouchEventHandler(this);
-        m_hasTouchEventHandler = hasTouchEventHandler;
-    }
-#endif
-
     if (renderer())
         setNeedsStyleRecalc(ReconstructRenderTree);
 
@@ -607,35 +596,8 @@
         HTMLTextFormControlElement::collectStyleForPresentationAttribute(name, value, style);
 }
 
-inline void HTMLInputElement::ensureInputType()
-{
-    ASSERT(m_parsingInProgress);
-    if (m_inputType)
-        return;
-
-    if (!hasAttribute(typeAttr)) {
-        m_inputType = InputType::createText(*this);
-        ensureUserAgentShadowRoot();
-        return;
-    }
-
-    m_hasType = true;
-    m_inputType = InputType::create(*this, fastGetAttribute(typeAttr));
-    ensureUserAgentShadowRoot();
-    registerForSuspensionCallbackIfNeeded();
-    runPostTypeUpdateTasks();
-}
-
 void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    if (m_parsingInProgress) {
-        // A lot of the code below requires m_inputType to be initialized so make sure we do.
-        // By the time parseAttribute() is called during parsing anyway, all attributes have
-        // been set on the element already so there is no point in delaying m_inputType
-        // initialization further.
-        ensureInputType();
-    }
-
     if (name == nameAttr) {
         removeFromRadioButtonGroup();
         m_name = value;
@@ -743,12 +705,6 @@
     m_inputType->attributeChanged();
 }
 
-void HTMLInputElement::parserDidFinishParsingAttributes()
-{
-    ASSERT(m_inputType || !hasAttributes());
-    ensureInputType();
-}
-
 void HTMLInputElement::finishParsingChildren()
 {
     m_parsingInProgress = false;

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (175969 => 175970)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2014-11-11 20:56:20 UTC (rev 175969)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2014-11-11 21:13:59 UTC (rev 175970)
@@ -359,7 +359,6 @@
     virtual bool isPresentationAttribute(const QualifiedName&) const override;
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
     virtual void finishParsingChildren() override;
-    virtual void parserDidFinishParsingAttributes() override final;
 
     virtual void copyNonAttributePropertiesFromElement(const Element&) override;
 
@@ -399,9 +398,7 @@
     virtual bool recalcWillValidate() const override;
     virtual void requiredAttributeChanged() override;
 
-    void ensureInputType();
     void updateType();
-    void runPostTypeUpdateTasks();
     
     virtual void subtreeHasChanged() override;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to