⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175970 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 1:13:59 PM (12 years ago)
Author:
commit-queue@webkit.org
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

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175968 r175970  
     12014-11-11  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r175852.
     4        https://bugs.webkit.org/show_bug.cgi?id=138626
     5
     6        Broke PLT by introducing a crash. (Requested by rniwa on
     7        #webkit).
     8
     9        Reverted changeset:
     10
     11        "Lazily create HTMLInputElement's inputType and shadow
     12        subtree"
     13        https://bugs.webkit.org/show_bug.cgi?id=138524
     14        http://trac.webkit.org/changeset/175852
     15
    1162014-11-11  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/dom/Element.cpp

    r175852 r175970  
    12341234    ASSERT(!m_elementData);
    12351235
    1236     if (!attributeVector.isEmpty()) {
    1237         if (document().sharedObjectPool())
    1238             m_elementData = document().sharedObjectPool()->cachedShareableElementDataWithAttributes(attributeVector);
    1239         else
    1240             m_elementData = ShareableElementData::createWithAttributes(attributeVector);
    1241 
    1242         // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData.
    1243         for (const auto& attribute : attributeVector)
    1244             attributeChanged(attribute.name(), nullAtom, attribute.value(), ModifiedDirectly);
    1245     }
    1246 
    1247     parserDidFinishParsingAttributes();
    1248 }
    1249 
    1250 void Element::parserDidFinishParsingAttributes()
    1251 {
     1236    if (attributeVector.isEmpty())
     1237        return;
     1238
     1239    if (document().sharedObjectPool())
     1240        m_elementData = document().sharedObjectPool()->cachedShareableElementDataWithAttributes(attributeVector);
     1241    else
     1242        m_elementData = ShareableElementData::createWithAttributes(attributeVector);
     1243
     1244    // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData.
     1245    for (unsigned i = 0; i < attributeVector.size(); ++i)
     1246        attributeChanged(attributeVector[i].name(), nullAtom, attributeVector[i].value(), ModifiedDirectly);
    12521247}
    12531248
  • trunk/Source/WebCore/dom/Element.h

    r175852 r175970  
    556556    virtual void childrenChanged(const ChildChange&) override;
    557557    virtual void removeAllEventListeners() override final;
    558     virtual void parserDidFinishParsingAttributes();
    559558
    560559    void clearTabIndexExplicitlyIfNeeded();   
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r175852 r175970  
    122122    , m_hasTouchEventHandler(false)
    123123#endif
    124     // m_inputType is lazily created when constructed by the parser to avoid constructing unnecessarily a text inputType and
    125     // its shadow subtree, just to destroy them when the |type| attribute gets set by the parser to something else than 'text'.
    126     , m_inputType(createdByParser ? nullptr : InputType::createText(*this))
     124    , m_inputType(InputType::createText(*this))
    127125{
    128126    ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
     
    132130PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser)
    133131{
    134     bool shouldCreateShadowRootLazily = createdByParser;
    135132    RefPtr<HTMLInputElement> inputElement = adoptRef(new HTMLInputElement(tagName, document, form, createdByParser));
    136     if (!shouldCreateShadowRootLazily)
    137         inputElement->ensureUserAgentShadowRoot();
     133    inputElement->ensureUserAgentShadowRoot();
    138134    return inputElement.release();
    139135}
     
    437433void HTMLInputElement::updateType()
    438434{
    439     ASSERT(m_inputType);
    440435    auto newType = InputType::create(*this, fastGetAttribute(typeAttr));
    441436    bool hadType = m_hasType;
     
    462457    m_inputType->createShadowSubtree();
    463458    updateInnerTextElementEditability();
     459
     460#if ENABLE(TOUCH_EVENTS)
     461    bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
     462    if (hasTouchEventHandler != m_hasTouchEventHandler) {
     463        if (hasTouchEventHandler)
     464            document().didAddTouchEventHandler(this);
     465        else
     466            document().didRemoveTouchEventHandler(this);
     467        m_hasTouchEventHandler = hasTouchEventHandler;
     468    }
     469#endif
    464470
    465471    setNeedsWillValidateCheck();
     
    497503            attributeChanged(alignAttr, nullAtom, align->value());
    498504    }
    499 
    500     runPostTypeUpdateTasks();
    501 }
    502 
    503 inline void HTMLInputElement::runPostTypeUpdateTasks()
    504 {
    505     ASSERT(m_inputType);
    506 #if ENABLE(TOUCH_EVENTS)
    507     bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
    508     if (hasTouchEventHandler != m_hasTouchEventHandler) {
    509         if (hasTouchEventHandler)
    510             document().didAddTouchEventHandler(this);
    511         else
    512             document().didRemoveTouchEventHandler(this);
    513         m_hasTouchEventHandler = hasTouchEventHandler;
    514     }
    515 #endif
    516505
    517506    if (renderer())
     
    608597}
    609598
    610 inline void HTMLInputElement::ensureInputType()
    611 {
    612     ASSERT(m_parsingInProgress);
    613     if (m_inputType)
    614         return;
    615 
    616     if (!hasAttribute(typeAttr)) {
    617         m_inputType = InputType::createText(*this);
    618         ensureUserAgentShadowRoot();
    619         return;
    620     }
    621 
    622     m_hasType = true;
    623     m_inputType = InputType::create(*this, fastGetAttribute(typeAttr));
    624     ensureUserAgentShadowRoot();
    625     registerForSuspensionCallbackIfNeeded();
    626     runPostTypeUpdateTasks();
    627 }
    628 
    629599void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    630600{
    631     if (m_parsingInProgress) {
    632         // A lot of the code below requires m_inputType to be initialized so make sure we do.
    633         // By the time parseAttribute() is called during parsing anyway, all attributes have
    634         // been set on the element already so there is no point in delaying m_inputType
    635         // initialization further.
    636         ensureInputType();
    637     }
    638 
    639601    if (name == nameAttr) {
    640602        removeFromRadioButtonGroup();
     
    744706}
    745707
    746 void HTMLInputElement::parserDidFinishParsingAttributes()
    747 {
    748     ASSERT(m_inputType || !hasAttributes());
    749     ensureInputType();
    750 }
    751 
    752708void HTMLInputElement::finishParsingChildren()
    753709{
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r175852 r175970  
    360360    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
    361361    virtual void finishParsingChildren() override;
    362     virtual void parserDidFinishParsingAttributes() override final;
    363362
    364363    virtual void copyNonAttributePropertiesFromElement(const Element&) override;
     
    400399    virtual void requiredAttributeChanged() override;
    401400
    402     void ensureInputType();
    403401    void updateType();
    404     void runPostTypeUpdateTasks();
    405402   
    406403    virtual void subtreeHasChanged() override;
Note: See TracChangeset for help on using the changeset viewer.