Caret disappears at end of password field when caps lock indicator is shown; password...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 22:15:16 +0000 (22:15 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 22:15:16 +0000 (22:15 +0000)
commit3e5a09ddb27dbb206a6f7998feb330abaf55ed09
tree2c7208e03e686b8e736c876f1a999bdac8fc547c
parenta7b1859476ae286e385890979e677242f5c1e97a
Caret disappears at end of password field when caps lock indicator is shown; password field
not scrolled when caps lock indicator is shown
https://bugs.webkit.org/show_bug.cgi?id=191164
<rdar://problem/45738179>

Reviewed by Dean Jackson.

Source/WebCore:

Fixes an issue where the caret may be occluded by- or paint on top of- the caps lock indicator on
Mac and iOS, respectively.

If there has not been a previous selection in a focused password field, including a caret
selection made by pressing the arrow keys, then we never scroll the password field to reveal
the current selection when the caps lock indicator is made visible. When the caps lock indicator
is made visible or hidden the size of the inner text renderer changes as it shrinks or expands
to make space for the caps lock indicator or to fill the void of the now hidden caps lock indicator,
respectively. We should detect such size changes and schedule an update and reveal of the current
selection after layout.

Test: fast/forms/password-scrolled-after-caps-lock-toggled.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setNeedsSelectionUpdate): Modified to take an enum to override the current
selection reveal mode for the next update.
* editing/FrameSelection.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout): Schedule post-layout a selection update that
reveals the current selection. We pass FrameSelection::RevealSelectionAfterUpdate::Forced to ensure
that the scheduled selection update scrolls to the reveal the current selection regardless of selection
reveal mode. This is necessary because typing into a password field does not change the current
selection reveal mode.

LayoutTests:

Add a test to ensure that we scroll the password field when caps lock is toggled.

* TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
WebKit2 on Mac at the moment.
* fast/forms/password-scrolled-after-caps-lock-toggled-expected.txt: Added.
* fast/forms/password-scrolled-after-caps-lock-toggled.html: Added.
* platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/forms/password-scrolled-after-caps-lock-toggled-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/password-scrolled-after-caps-lock-toggled.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/FrameSelection.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp