[webkit-changes] [WebKit/WebKit] 3d85c9: setSelectionRange will reset the m_latestFocusTrig...
wentao
noreply at github.com
Tue Oct 31 23:09:29 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3d85c92f718f3ce85c7e71c800810dfde1669403
https://github.com/WebKit/WebKit/commit/3d85c92f718f3ce85c7e71c800810dfde1669403
Author: Shu Ren <2471314 at gmail.com>
Date: 2023-10-31 (Tue, 31 Oct 2023)
Changed paths:
A LayoutTests/fast/selectors/focus-visible-setSelectionRange-expected.txt
A LayoutTests/fast/selectors/focus-visible-setSelectionRange.html
M Source/WebCore/editing/FrameSelection.cpp
M Source/WebCore/editing/FrameSelection.h
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/html/HTMLTextAreaElement.cpp
M Source/WebCore/html/HTMLTextAreaElement.h
M Source/WebCore/html/HTMLTextAreaElement.idl
M Source/WebCore/html/HTMLTextFormControlElement.cpp
M Source/WebCore/html/HTMLTextFormControlElement.h
Log Message:
-----------
setSelectionRange will reset the m_latestFocusTrigger variable, causing the subsequently focused element to match the :focus-visible selector
https://bugs.webkit.org/show_bug.cgi?id=256929
<rdar://problem/109803748>
Reviewed by Ryosuke Niwa.
This patch adds ForBindings to differentiate when setSelectionRange is called from Javascript.
In this way, if it is called from Javascript and focus occurs,
its behavior can be consistent with Element::focusForBindings.
* LayoutTests/fast/selectors/focus-visible-setSelectionRange-expected.txt: Added.
* LayoutTests/fast/selectors/focus-visible-setSelectionRange.html: Added.
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
(WebCore::FrameSelection::setFocusedElementIfNeeded):
* Source/WebCore/editing/FrameSelection.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setSelectionRangeForBindings):
* Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setSelectionRangeForBindings):
* Source/WebCore/html/HTMLTextAreaElement.h:
* Source/WebCore/html/HTMLTextAreaElement.idl:
* Source/WebCore/html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setSelectionRange):
* Source/WebCore/html/HTMLTextFormControlElement.h:
Canonical link: https://commits.webkit.org/270043@main
More information about the webkit-changes
mailing list