⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 238519 in webkit


Ignore:
Timestamp:
Nov 26, 2018, 1:50:17 PM (8 years ago)
Author:
dbates@webkit.org
Message:

Placeholder text is not repainted after caps lock indicator is hidden
https://bugs.webkit.org/show_bug.cgi?id=191968
<rdar://problem/46247234>

Reviewed by Zalan Bujtas.

Source/WebCore:

Fixes an issue where the placeholder text in a password field is not repainted when the
caps lock indicator is hidden.

The placeholder renderer is special. It is an excluded child renderer and does not take
part in normal flow layout. It is also created and destroyed as needed. The caps lock
indicator is also special in that it is implemented as a RenderImage and we do not know
its dimensions before it is loaded and the load happens asynchronously. As a result we
detect when the inner text size changes and mark the placeholder as dirty as a way to
keep the dimensions of the placeholder in sync with the dimensions of the inner text.

Test: fast/repaint/placeholder-after-caps-lock-hidden.html

  • rendering/RenderTextControlSingleLine.cpp:

(WebCore::RenderTextControlSingleLine::layout): Mark the placeholder as needing layout
the size of the inner text changes.

LayoutTests:

Add a test to ensure to that the placeholder text is repainted when the caps lock indicator is hidden.

  • TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in

WebKit2 on Mac at the moment.

  • fast/repaint/placeholder-after-caps-lock-hidden.html: Added.
  • platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238513 r238519  
     12018-11-26  Daniel Bates  <dabates@apple.com>
     2
     3        Placeholder text is not repainted after caps lock indicator is hidden
     4        https://bugs.webkit.org/show_bug.cgi?id=191968
     5        <rdar://problem/46247234>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Add a test to ensure to that the placeholder text is repainted when the caps lock indicator is hidden.
     10
     11        * TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
     12        WebKit2 on Mac at the moment.
     13        * fast/repaint/placeholder-after-caps-lock-hidden.html: Added.
     14        * platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.
     15
    1162018-11-26  Daniel Bates  <dabates@apple.com>
    217
  • trunk/LayoutTests/TestExpectations

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

    r238513 r238519  
    7171[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html [ Pass ]
    7272[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Pass ]
     73[ Mojave+ ] fast/repaint/placeholder-after-caps-lock-hidden.html [ Pass ]
    7374
    7475fast/events/inactive-window-no-mouse-event.html [ Pass ]
  • trunk/Source/WebCore/ChangeLog

    r238516 r238519  
     12018-11-26  Daniel Bates  <dabates@apple.com>
     2
     3        Placeholder text is not repainted after caps lock indicator is hidden
     4        https://bugs.webkit.org/show_bug.cgi?id=191968
     5        <rdar://problem/46247234>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Fixes an issue where the placeholder text in a password field is not repainted when the
     10        caps lock indicator is hidden.
     11
     12        The placeholder renderer is special. It is an excluded child renderer and does not take
     13        part in normal flow layout. It is also created and destroyed as needed. The caps lock
     14        indicator is also special in that it is implemented as a RenderImage and we do not know
     15        its dimensions before it is loaded and the load happens asynchronously. As a result we
     16        detect when the inner text size changes and mark the placeholder as dirty as a way to
     17        keep the dimensions of the placeholder in sync with the dimensions of the inner text.
     18
     19        Test: fast/repaint/placeholder-after-caps-lock-hidden.html
     20
     21        * rendering/RenderTextControlSingleLine.cpp:
     22        (WebCore::RenderTextControlSingleLine::layout): Mark the placeholder as needing layout
     23        the size of the inner text changes.
     24
    1252018-11-26  Jeremy Jones  <jeremyj@apple.com>
    226
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r237266 r238519  
    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.
     115    LayoutSize oldInnerTextSize;
     116    if (innerTextRenderer)
     117        oldInnerTextSize = innerTextRenderer->size();
     118
    113119    RenderBlockFlow::layoutBlock(false);
    114120
     
    174180        bool neededLayout = placeholderBox->needsLayout();
    175181        bool placeholderBoxHadLayout = placeholderBox->everHadLayout();
     182        if (innerTextSize != oldInnerTextSize) {
     183            // The caps lock indicator was hidden. Layout the placeholder. Its layout does not affect its parent.
     184            placeholderBox->setChildNeedsLayout(MarkOnlyThis);
     185        }
    176186        placeholderBox->layoutIfNeeded();
    177187        LayoutPoint textOffset;
Note: See TracChangeset for help on using the changeset viewer.