Changeset 238522 in webkit


Ignore:
Timestamp:
Nov 26, 2018 2:15:16 PM (5 years ago)
Author:
dbates@webkit.org
Message:

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.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238520 r238522  
     12018-11-26  Daniel Bates  <dabates@apple.com>
     2
     3        Caret disappears at end of password field when caps lock indicator is shown; password field
     4        not scrolled when caps lock indicator is shown
     5        https://bugs.webkit.org/show_bug.cgi?id=191164
     6        <rdar://problem/45738179>
     7
     8        Reviewed by Dean Jackson.
     9
     10        Add a test to ensure that we scroll the password field when caps lock is toggled.
     11
     12        * TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
     13        WebKit2 on Mac at the moment.
     14        * fast/forms/password-scrolled-after-caps-lock-toggled-expected.txt: Added.
     15        * fast/forms/password-scrolled-after-caps-lock-toggled.html: Added.
     16        * platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.
     17
    1182018-11-26  Daniel Bates  <dabates@apple.com>
    219
  • trunk/LayoutTests/TestExpectations

    r238519 r238522  
    403403fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Skip ]
    404404fast/repaint/placeholder-after-caps-lock-hidden.html [ Skip ]
     405fast/forms/password-scrolled-after-caps-lock-toggled.html [ Skip ]
    405406
    406407# This test currently only works for mac-wk2
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r238519 r238522  
    7272[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Pass ]
    7373[ Mojave+ ] fast/repaint/placeholder-after-caps-lock-hidden.html [ Pass ]
     74[ Mojave+ ] fast/forms/password-scrolled-after-caps-lock-toggled.html [ Pass ]
    7475
    7576fast/events/inactive-window-no-mouse-event.html [ Pass ]
  • trunk/Source/WebCore/ChangeLog

    r238519 r238522  
     12018-11-26  Daniel Bates  <dabates@apple.com>
     2
     3        Caret disappears at end of password field when caps lock indicator is shown; password field
     4        not scrolled when caps lock indicator is shown
     5        https://bugs.webkit.org/show_bug.cgi?id=191164
     6        <rdar://problem/45738179>
     7
     8        Reviewed by Dean Jackson.
     9
     10        Fixes an issue where the caret may be occluded by- or paint on top of- the caps lock indicator on
     11        Mac and iOS, respectively.
     12
     13        If there has not been a previous selection in a focused password field, including a caret
     14        selection made by pressing the arrow keys, then we never scroll the password field to reveal
     15        the current selection when the caps lock indicator is made visible. When the caps lock indicator
     16        is made visible or hidden the size of the inner text renderer changes as it shrinks or expands
     17        to make space for the caps lock indicator or to fill the void of the now hidden caps lock indicator,
     18        respectively. We should detect such size changes and schedule an update and reveal of the current
     19        selection after layout.
     20
     21        Test: fast/forms/password-scrolled-after-caps-lock-toggled.html
     22
     23        * editing/FrameSelection.cpp:
     24        (WebCore::FrameSelection::setNeedsSelectionUpdate): Modified to take an enum to override the current
     25        selection reveal mode for the next update.
     26        * editing/FrameSelection.h:
     27        * rendering/RenderTextControlSingleLine.cpp:
     28        (WebCore::RenderTextControlSingleLine::layout): Schedule post-layout a selection update that
     29        reveals the current selection. We pass FrameSelection::RevealSelectionAfterUpdate::Forced to ensure
     30        that the scheduled selection update scrolls to the reveal the current selection regardless of selection
     31        reveal mode. This is necessary because typing into a password field does not change the current
     32        selection reveal mode.
     33
    1342018-11-26  Daniel Bates  <dabates@apple.com>
    235
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r238454 r238522  
    404404}
    405405
    406 void FrameSelection::setNeedsSelectionUpdate()
     406void FrameSelection::setNeedsSelectionUpdate(RevealSelectionAfterUpdate revealMode)
    407407{
    408408    m_selectionRevealIntent = AXTextStateChangeIntent();
     409    if (revealMode == RevealSelectionAfterUpdate::Forced)
     410        m_selectionRevealMode = SelectionRevealMode::Reveal;
    409411    m_pendingSelectionUpdate = true;
    410412    if (RenderView* view = m_frame->contentRenderer())
  • trunk/Source/WebCore/editing/FrameSelection.h

    r238454 r238522  
    160160    void updateAppearanceAfterLayout();
    161161    void scheduleAppearanceUpdateAfterStyleChange();
    162     void setNeedsSelectionUpdate();
     162
     163    enum class RevealSelectionAfterUpdate : bool { NotForced, Forced };
     164    void setNeedsSelectionUpdate(RevealSelectionAfterUpdate = RevealSelectionAfterUpdate::NotForced);
    163165
    164166    bool contains(const LayoutPoint&) const;
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r238519 r238522  
    111111    resetOverriddenHeight(containerRenderer, this);
    112112
    113     // Save the old size of the inner text (if we have one) as we will need to layout the placeholder if
    114     // it changes to keep the size of the placeholder proportional to the size of the inner text.
     113    // Save the old size of the inner text (if we have one) as we will need to layout the placeholder
     114    // and update selection if it changes. One way the size may change is if text decorations are
     115    // toggled. For example, hiding and showing the caps lock indicator will cause a size change.
    115116    LayoutSize oldInnerTextSize;
    116117    if (innerTextRenderer)
     
    171172        centerRenderer(*containerRenderer);
    172173
     174    bool innerTextSizeChanged = innerTextRenderer && innerTextRenderer->size() != oldInnerTextSize;
     175
    173176    HTMLElement* placeholderElement = inputElement().placeholderElement();
    174177    if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->renderBox() : 0) {
     
    180183        bool neededLayout = placeholderBox->needsLayout();
    181184        bool placeholderBoxHadLayout = placeholderBox->everHadLayout();
    182         if (innerTextSize != oldInnerTextSize) {
     185        if (innerTextSizeChanged) {
    183186            // The caps lock indicator was hidden. Layout the placeholder. Its layout does not affect its parent.
    184187            placeholderBox->setChildNeedsLayout(MarkOnlyThis);
     
    210213        RenderThemeIOS::adjustRoundBorderRadius(mutableStyle(), *this);
    211214#endif
     215    if (innerTextSizeChanged) {
     216        // The caps lock indicator was hidden or shown. If it is now visible then it may be occluding
     217        // the current selection (say, the caret was after the last character in the text field).
     218        // Schedule an update and reveal of the current selection.
     219        frame().selection().setNeedsSelectionUpdate(FrameSelection::RevealSelectionAfterUpdate::Forced);
     220    }
    212221}
    213222
Note: See TracChangeset for help on using the changeset viewer.