Changeset 275591 in webkit
- Timestamp:
- Apr 7, 2021 12:42:44 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275583 r275591 1 2021-04-07 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION(r274812): Release assert in Document::updateLayout() after calling focus({preventScroll: true}) on a textarea 4 https://bugs.webkit.org/show_bug.cgi?id=224262 5 6 Reviewed by Antti Koivisto. 7 8 Added a regression test. 9 10 * fast/forms/textarea/textarea-focus-prevent-scroll-crash-expected.txt: Added. 11 * fast/forms/textarea/textarea-focus-prevent-scroll-crash.html: Added. 12 1 13 2021-04-06 Sihui Liu <sihui_liu@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r275590 r275591 1 2021-04-07 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION(r274812): Release assert in Document::updateLayout() after calling focus({preventScroll: true}) on a textarea 4 https://bugs.webkit.org/show_bug.cgi?id=224262 5 6 Reviewed by Antti Koivisto. 7 8 The regression was caused by Element::focus not updating the selection when preventScroll is set to true. 9 Fixed it by always updating the selection whenever Element::focus is called. 10 11 Test: fast/forms/textarea/textarea-focus-prevent-scroll-crash.html 12 13 * dom/Element.cpp: 14 (WebCore::Element::focus): 15 (WebCore::Element::findTargetAndUpdateFocusAppearance): Renamed from revealFocusedElement. 16 * dom/Element.h: 17 * page/EventHandler.cpp: 18 (WebCore::EventHandler::dispatchMouseEvent): 19 1 20 2021-04-07 Stephan Szabo <stephan.szabo@sony.com> 2 21 -
trunk/Source/WebCore/dom/Element.cpp
r275410 r275591 3089 3089 } 3090 3090 3091 if (!options.preventScroll) 3092 newTarget->revealFocusedElement(options.selectionRestorationMode); 3093 } 3094 3095 void Element::revealFocusedElement(SelectionRestorationMode selectionMode) 3096 { 3097 SelectionRevealMode revealMode = SelectionRevealMode::Reveal; 3098 3091 newTarget->findTargetAndUpdateFocusAppearance(options.selectionRestorationMode, options.preventScroll ? SelectionRevealMode::DoNotReveal : SelectionRevealMode::Reveal); 3092 } 3093 3094 void Element::findTargetAndUpdateFocusAppearance(SelectionRestorationMode selectionMode, SelectionRevealMode revealMode) 3095 { 3099 3096 #if PLATFORM(IOS_FAMILY) 3100 3097 // Focusing a form element triggers animation in UIKit to scroll to the right position. 3101 3098 // Calling updateFocusAppearance() would generate an unnecessary call to ScrollView::setScrollPosition(), 3102 3099 // which would jump us around during this animation. See <rdar://problem/6699741>. 3103 if ( is<HTMLFormControlElement>(*this))3100 if (revealMode == SelectionRevealMode::Reveal && is<HTMLFormControlElement>(*this)) 3104 3101 revealMode = SelectionRevealMode::RevealUpToMainFrame; 3105 3102 #endif -
trunk/Source/WebCore/dom/Element.h
r275527 r275591 406 406 static AXTextStateChangeIntent defaultFocusTextStateChangeIntent() { return AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true }); } 407 407 virtual void focus(const FocusOptions& = { }); 408 void revealFocusedElement(SelectionRestorationMode);408 void findTargetAndUpdateFocusAppearance(SelectionRestorationMode, SelectionRevealMode = SelectionRevealMode::Reveal); 409 409 virtual RefPtr<Element> focusAppearanceUpdateTarget(); 410 410 virtual void updateFocusAppearance(SelectionRestorationMode, SelectionRevealMode = SelectionRevealMode::Reveal); -
trunk/Source/WebCore/page/EventHandler.cpp
r275527 r275591 2724 2724 2725 2725 if (element && m_mouseDownDelegatedFocus) 2726 element-> revealFocusedElement(SelectionRestorationMode::SelectAll);2726 element->findTargetAndUpdateFocusAppearance(SelectionRestorationMode::SelectAll); 2727 2727 2728 2728 return true;
Note: See TracChangeset
for help on using the changeset viewer.