haikuwebkit/LayoutTests/fast/forms/input-text-autofocus-expect...

10 lines
200 B
Plaintext
Raw Permalink Normal View History

autofocus of text input should not select text https://bugs.webkit.org/show_bug.cgi?id=218585 <rdar://problem/60130704> Reviewed by Wenson Hsieh. Source/WebCore: Test: fast/forms/input-text-autofocus.html * dom/Document.h: * history/CachedPage.cpp: (WebCore::CachedPage::restore): * html/HTMLInputElement.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateFocusAppearance): (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus): (WebCore::HTMLInputElement::runPostTypeUpdateTasks): (WebCore::HTMLInputElement::didAttachRenderers): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::updateFocusAppearance): * html/InputType.cpp: (WebCore::InputType::accessKeyAction): * page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): * page/FocusController.cpp: (WebCore::FocusController::advanceFocusInDocumentOrder): (WebCore::FocusController::advanceFocusDirectionallyInContainer): Slightly rework `SelectionRestorationMode` to replace `SetDefault` with two new values: - `PlaceCaretAtStart` puts the caret at the start, regardless of any cached selection - `SelectAll` selects all text, regardless of any cached selection (existing behavior) In order to preserve existing behavior, the default `Restore` will have the same effect as `SelectAll` if there is no cached selection (and is renamed to `RestoreOrSelectAll` as such). * dom/Element.h: * dom/Element.cpp: (WebCore::Element::focus): * html/HTMLLabelElement.h: * html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::focus): * html/HTMLLegendElement.h: * html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::focus): Replace the `bool restorePreviousSelection` with `SelectionRestorationMode` since that's what it's eventually used for anyways. This also allows for more flexibility in behavior, such as callers using the new `SelectionRestorationMode` values. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::didAttachRenderers): Change to `PlaceCaretAtStart` to match other browsers. Source/WebKit: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreSelectionInFocusedEditableElement): Slightly rework `SelectionRestorationMode` to replace `SetDefault` with two new values: - `PlaceCaretAtStart` puts the caret at the start, regardless of any cached selection - `SelectAll` selects all text, regardless of any cached selection (existing behavior) In order to preserve existing behavior, the default `Restore` will have the same effect as `SelectAll` if there is no cached selection (and is renamed to `RestoreOrSelectAll` as such). LayoutTests: * fast/forms/input-text-autofocus.html: Added. * fast/forms/input-text-autofocus-expected.txt: Added. * fast/forms/input-first-letter-edit.html: * fast/forms/input-first-letter-edit-expected.html: Canonical link: https://commits.webkit.org/231378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-09 19:08:31 +00:00
Test for <input autofocus>
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS inputFocusCount is 1
PASS input.selectionStart is 0
PASS input.selectionEnd is 0