Changeset 175970 in webkit
- Timestamp:
- Nov 11, 2014, 1:13:59 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
dom/Element.cpp (modified) (1 diff)
-
dom/Element.h (modified) (1 diff)
-
html/HTMLInputElement.cpp (modified) (7 diffs)
-
html/HTMLInputElement.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175968 r175970 1 2014-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 1 16 2014-11-11 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebCore/dom/Element.cpp
r175852 r175970 1234 1234 ASSERT(!m_elementData); 1235 1235 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); 1252 1247 } 1253 1248 -
trunk/Source/WebCore/dom/Element.h
r175852 r175970 556 556 virtual void childrenChanged(const ChildChange&) override; 557 557 virtual void removeAllEventListeners() override final; 558 virtual void parserDidFinishParsingAttributes();559 558 560 559 void clearTabIndexExplicitlyIfNeeded(); -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r175852 r175970 122 122 , m_hasTouchEventHandler(false) 123 123 #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)) 127 125 { 128 126 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); … … 132 130 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser) 133 131 { 134 bool shouldCreateShadowRootLazily = createdByParser;135 132 RefPtr<HTMLInputElement> inputElement = adoptRef(new HTMLInputElement(tagName, document, form, createdByParser)); 136 if (!shouldCreateShadowRootLazily) 137 inputElement->ensureUserAgentShadowRoot(); 133 inputElement->ensureUserAgentShadowRoot(); 138 134 return inputElement.release(); 139 135 } … … 437 433 void HTMLInputElement::updateType() 438 434 { 439 ASSERT(m_inputType);440 435 auto newType = InputType::create(*this, fastGetAttribute(typeAttr)); 441 436 bool hadType = m_hasType; … … 462 457 m_inputType->createShadowSubtree(); 463 458 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 464 470 465 471 setNeedsWillValidateCheck(); … … 497 503 attributeChanged(alignAttr, nullAtom, align->value()); 498 504 } 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 else512 document().didRemoveTouchEventHandler(this);513 m_hasTouchEventHandler = hasTouchEventHandler;514 }515 #endif516 505 517 506 if (renderer()) … … 608 597 } 609 598 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 629 599 void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 630 600 { 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 have634 // been set on the element already so there is no point in delaying m_inputType635 // initialization further.636 ensureInputType();637 }638 639 601 if (name == nameAttr) { 640 602 removeFromRadioButtonGroup(); … … 744 706 } 745 707 746 void HTMLInputElement::parserDidFinishParsingAttributes()747 {748 ASSERT(m_inputType || !hasAttributes());749 ensureInputType();750 }751 752 708 void HTMLInputElement::finishParsingChildren() 753 709 { -
trunk/Source/WebCore/html/HTMLInputElement.h
r175852 r175970 360 360 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; 361 361 virtual void finishParsingChildren() override; 362 virtual void parserDidFinishParsingAttributes() override final;363 362 364 363 virtual void copyNonAttributePropertiesFromElement(const Element&) override; … … 400 399 virtual void requiredAttributeChanged() override; 401 400 402 void ensureInputType();403 401 void updateType(); 404 void runPostTypeUpdateTasks();405 402 406 403 virtual void subtreeHasChanged() override;
Note:
See TracChangeset
for help on using the changeset viewer.