Changeset 201907 in webkit


Ignore:
Timestamp:
Jun 9, 2016 10:27:11 PM (8 years ago)
Author:
Alan Bujtas
Message:

Hairline borders do not show up on 3x displays.
https://bugs.webkit.org/show_bug.cgi?id=158604
<rdar://problem/26511679>

Reviewed by Simon Fraser.

On a 3x display, when we convert a 1/3px hairline border from float
to LayoutUnit and pixel floor the result, we end up with a 0px width border.
It's because float to LayoutUnit is lossy and since the current kFixedPointDenominator % 3 != 0,
flooring LayoutUnit(1/3px) ends up being 0px. (float: 1/3 -> LayoutUnit: (1/3 - 1/kFixedPointDenominator) -> floor: 0)
This patch eliminates the (unnecessary) float -> LayoutUnit - float conversion on border width.

Source/WebCore:

Test: fast/borders/hidpi-3x-input-hairline-border.html

  • rendering/BorderEdge.cpp:

(WebCore::BorderEdge::BorderEdge):

  • rendering/BorderEdge.h:

LayoutTests:

  • fast/borders/hidpi-3x-input-hairline-border-expected-mismatch.html: Added.
  • fast/borders/hidpi-3x-input-hairline-border.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201906 r201907  
     12016-06-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        Hairline borders do not show up on 3x displays.
     4        https://bugs.webkit.org/show_bug.cgi?id=158604
     5        <rdar://problem/26511679>
     6
     7        Reviewed by Simon Fraser.
     8
     9        On a 3x display, when we convert a 1/3px hairline border from float
     10        to LayoutUnit and pixel floor the result, we end up with a 0px width border.
     11        It's because float to LayoutUnit is lossy and since the current kFixedPointDenominator % 3 != 0,
     12        flooring LayoutUnit(1/3px) ends up being 0px. (float: 1/3 -> LayoutUnit: (1/3 - 1/kFixedPointDenominator) -> floor: 0)
     13        This patch eliminates the (unnecessary) float -> LayoutUnit - float conversion on border width.   
     14
     15        * fast/borders/hidpi-3x-input-hairline-border-expected-mismatch.html: Added.
     16        * fast/borders/hidpi-3x-input-hairline-border.html: Added.
     17
    1182016-06-09  Commit Queue  <commit-queue@webkit.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r201906 r201907  
     12016-06-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        Hairline borders do not show up on 3x displays.
     4        https://bugs.webkit.org/show_bug.cgi?id=158604
     5        <rdar://problem/26511679>
     6
     7        Reviewed by Simon Fraser.
     8
     9        On a 3x display, when we convert a 1/3px hairline border from float
     10        to LayoutUnit and pixel floor the result, we end up with a 0px width border.
     11        It's because float to LayoutUnit is lossy and since the current kFixedPointDenominator % 3 != 0,
     12        flooring LayoutUnit(1/3px) ends up being 0px. (float: 1/3 -> LayoutUnit: (1/3 - 1/kFixedPointDenominator) -> floor: 0)
     13        This patch eliminates the (unnecessary) float -> LayoutUnit - float conversion on border width.   
     14
     15        Test: fast/borders/hidpi-3x-input-hairline-border.html
     16
     17        * rendering/BorderEdge.cpp:
     18        (WebCore::BorderEdge::BorderEdge):
     19        * rendering/BorderEdge.h:
     20
    1212016-06-09  Commit Queue  <commit-queue@webkit.org>
    222
  • trunk/Source/WebCore/rendering/BorderEdge.cpp

    r192444 r201907  
    3434namespace WebCore {
    3535
    36 BorderEdge::BorderEdge(LayoutUnit edgeWidth, Color edgeColor, EBorderStyle edgeStyle, bool edgeIsTransparent, bool edgeIsPresent, float devicePixelRatio)
     36BorderEdge::BorderEdge(float edgeWidth, Color edgeColor, EBorderStyle edgeStyle, bool edgeIsTransparent, bool edgeIsPresent, float devicePixelRatio)
    3737    : m_width(edgeWidth)
    3838    , m_color(edgeColor)
     
    4444    if (edgeStyle == DOUBLE && edgeWidth  < borderWidthInDevicePixel(3))
    4545        m_style = SOLID;
    46     m_flooredToDevicePixelWidth = floorToDevicePixel(edgeWidth, devicePixelRatio);
     46    m_flooredToDevicePixelWidth = floorf(edgeWidth * devicePixelRatio) / devicePixelRatio;
    4747}
    4848
  • trunk/Source/WebCore/rendering/BorderEdge.h

    r192444 r201907  
    4747
    4848    BorderEdge() = default;
    49     BorderEdge(LayoutUnit edgeWidth, Color edgeColor, EBorderStyle edgeStyle, bool edgeIsTransparent, bool edgeIsPresent, float devicePixelRatio);
     49    BorderEdge(float edgeWidth, Color edgeColor, EBorderStyle edgeStyle, bool edgeIsTransparent, bool edgeIsPresent, float devicePixelRatio);
    5050
    5151    static void getBorderEdgeInfo(BorderEdge edges[], const RenderStyle&, float deviceScaleFactor, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
Note: See TracChangeset for help on using the changeset viewer.