Changeset 239786 in webkit
- Timestamp:
- Jan 9, 2019, 2:25:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/datalist/datalist-crash-when-dynamic-expected.txt (added)
-
LayoutTests/fast/forms/datalist/datalist-crash-when-dynamic.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/TextFieldInputType.cpp (modified) (4 diffs)
-
Source/WebCore/html/TextFieldInputType.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderThemeMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239780 r239786 1 2019-01-09 Zalan Bujtas <zalan@apple.com> 2 3 [Datalist] Crash when input with datalist is dynamically added. 4 https://bugs.webkit.org/show_bug.cgi?id=193012 5 <rdar://problem/45923457> 6 7 Reviewed by Brent Fulgham. 8 9 * fast/forms/datalist/datalist-crash-when-dynamic-expected.txt: Added. 10 * fast/forms/datalist/datalist-crash-when-dynamic.html: Added. 11 1 12 2019-01-09 Justin Fan <justin_fan@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r239780 r239786 1 2019-01-09 Zalan Bujtas <zalan@apple.com> 2 3 [Datalist] Crash when input with datalist is dynamically added. 4 https://bugs.webkit.org/show_bug.cgi?id=193012 5 <rdar://problem/45923457> 6 7 Reviewed by Brent Fulgham. 8 9 In certain cases (cloning, setAttribute), it's too early to check for the list attribute in createShadowSubtree 10 to see whether the input needs datalist related items. The list attribute is simply not set yet. 11 This patch only addresses the obvious crash. m_dataListDropdownIndicator clearly lacks proper lifecycle management (see webkit.org/b/193032). 12 13 Test: fast/forms/datalist/datalist-crash-when-dynamic.html 14 15 * html/TextFieldInputType.cpp: 16 (WebCore::TextFieldInputType::createShadowSubtree): 17 (WebCore::TextFieldInputType::attributeChanged): 18 (WebCore::TextFieldInputType::createDataListDropdownIndicator): 19 * html/TextFieldInputType.h: 20 1 21 2019-01-09 Justin Fan <justin_fan@apple.com> 2 22 -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r239337 r239786 300 300 bool TextFieldInputType::needsContainer() const 301 301 { 302 #if ENABLE(DATALIST_ELEMENT)303 return element()->hasAttributeWithoutSynchronization(listAttr);304 #endif305 302 return false; 306 303 } … … 359 356 m_container->appendChild(*m_capsLockIndicator); 360 357 } 361 362 358 updateAutoFillButton(); 363 364 #if ENABLE(DATALIST_ELEMENT)365 m_dataListDropdownIndicator = DataListButtonElement::create(element()->document(), *this);366 m_dataListDropdownIndicator->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true);367 m_container->appendChild(*m_dataListDropdownIndicator);368 #endif369 359 } 370 360 … … 456 446 return true; 457 447 } 448 449 #if ENABLE(DATALIST_ELEMENT) 450 void TextFieldInputType::createDataListDropdownIndicator() 451 { 452 ASSERT(!m_dataListDropdownIndicator); 453 if (!m_container) 454 createContainer(); 455 m_dataListDropdownIndicator = DataListButtonElement::create(element()->document(), *this); 456 m_dataListDropdownIndicator->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true); 457 m_container->appendChild(*m_dataListDropdownIndicator); 458 } 459 #endif 458 460 459 461 // FIXME: The name of this function doesn't make clear the two jobs it does: … … 833 835 834 836 if (!m_dataListDropdownIndicator) 835 return;837 createDataListDropdownIndicator(); 836 838 837 839 #if !PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/html/TextFieldInputType.h
r235490 r239786 125 125 126 126 #if ENABLE(DATALIST_ELEMENT) 127 void createDataListDropdownIndicator(); 127 128 bool isPresentingAttachedView() const final; 128 129 void listAttributeTargetChanged() final; -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r239604 r239786 1146 1146 1147 1147 [listButton setHighlighted:input.isPresentingAttachedView()]; 1148 if (!input.isPresentingAttachedView()) 1149 updatePressedState(listButton, *(input.dataListButtonElement()->renderer())); 1148 if (!input.isPresentingAttachedView()) { 1149 ASSERT(input.dataListButtonElement()); 1150 if (auto* buttonElement = input.dataListButtonElement()) 1151 updatePressedState(listButton, *buttonElement->renderer()); 1152 } 1150 1153 1151 1154 [listButton drawWithFrame:listButtonFrame inView:documentViewFor(o)];
Note:
See TracChangeset
for help on using the changeset viewer.