Changeset 190800 in webkit


Ignore:
Timestamp:
Oct 9, 2015 8:18:42 AM (8 years ago)
Author:
Wenson Hsieh
Message:

Backgrounds bleed out of natively rendered text fields
https://bugs.webkit.org/show_bug.cgi?id=149843
<rdar://problem/22896977>

Reviewed by Darin Adler.

Source/WebCore:

When natively rendering a text field with a background on Mac, the background bleeds out
of the text field's border when the graphics context is scaled (as a result of a retina
display or zoom/scale effects). This is because when we render the text field in bezeled
style within a certain frame, AppKit adds 1 device pixel insets on all sides of the frame,
which renders a text field that is slightly smaller than the frame. To adjust for this, we
inflate the paint rect.

Test: fast/forms/hidpi-textfield-background-bleeding.html

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintTextField):

LayoutTests:

Add a layout test to check that the background of a natively rendered text field
cell does not bleed.

  • TestExpectations:
  • fast/forms/hidpi-textfield-background-bleeding-expected.html: Added.
  • fast/forms/hidpi-textfield-background-bleeding.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r190780 r190800  
     12015-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Backgrounds bleed out of natively rendered text fields
     4        https://bugs.webkit.org/show_bug.cgi?id=149843
     5        <rdar://problem/22896977>
     6
     7        Reviewed by Darin Adler.
     8
     9        Add a layout test to check that the background of a natively rendered text field
     10        cell does not bleed.
     11
     12        * TestExpectations:
     13        * fast/forms/hidpi-textfield-background-bleeding-expected.html: Added.
     14        * fast/forms/hidpi-textfield-background-bleeding.html: Added.
     15
    1162015-10-08  Nikita Vasilyev  <nvasilyev@apple.com>
    217
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r190659 r190800  
    17151715fast/forms/focus-selection-input.html [ Failure ]
    17161716fast/forms/hidpi-textarea-on-subpixel-position.html [ ImageOnlyFailure ]
     1717fast/forms/hidpi-textfield-background-bleeding.html [ ImageOnlyFailure ]
    17171718fast/forms/implicit-submission.html [ Failure ]
    17181719fast/forms/input-baseline.html [ Failure ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r190777 r190800  
    728728
    729729webkit.org/b/147254 media/restore-from-page-cache.html [ Pass Failure ]
     730
     731# After Mavericks, native text fields are rendered slightly smaller, causing backgrounds to bleed on platforms.
     732[ Mavericks ] fast/forms/hidpi-textfield-background-bleeding.html [ ImageOnlyFailure ]
    730733
    731734# These fast/forms/select tests open a pop-up menu (visible on screen even when using run-webkit-tests), and get stuck in its nested event loop.
  • trunk/Source/WebCore/ChangeLog

    r190794 r190800  
     12015-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Backgrounds bleed out of natively rendered text fields
     4        https://bugs.webkit.org/show_bug.cgi?id=149843
     5        <rdar://problem/22896977>
     6
     7        Reviewed by Darin Adler.
     8
     9        When natively rendering a text field with a background on Mac, the background bleeds out
     10        of the text field's border when the graphics context is scaled (as a result of a retina
     11        display or zoom/scale effects). This is because when we render the text field in bezeled
     12        style within a certain frame, AppKit adds 1 device pixel insets on all sides of the frame,
     13        which renders a text field that is slightly smaller than the frame. To adjust for this, we
     14        inflate the paint rect.
     15
     16        Test: fast/forms/hidpi-textfield-background-bleeding.html
     17
     18        * rendering/RenderThemeMac.mm:
     19        (WebCore::RenderThemeMac::paintTextField):
     20
    1212015-10-09  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
    222
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r190627 r190800  
    854854    LocalCurrentGraphicsContext localContext(paintInfo.context());
    855855
     856    // <rdar://problem/22896977> We adjust the paint rect here to account for how AppKit draws the text
     857    // field cell slightly smaller than the rect we pass to drawWithFrame.
     858    FloatRect adjustedPaintRect(r);
     859    AffineTransform transform = paintInfo.context().getCTM();
     860    if (transform.xScale() > 1 || transform.yScale() > 1) {
     861        adjustedPaintRect.inflateX(1 / transform.xScale());
     862        adjustedPaintRect.inflateY(1 / transform.yScale());
     863    }
    856864    NSTextFieldCell *textField = this->textField();
    857865
     
    859867
    860868    [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))];
    861     [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)];
     869    [textField drawWithFrame:NSRect(adjustedPaintRect) inView:documentViewFor(o)];
    862870
    863871    [textField setControlView:nil];
Note: See TracChangeset for help on using the changeset viewer.