Changeset 237280 in webkit


Ignore:
Timestamp:
Oct 18, 2018 9:39:30 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[CG] Adopt CG SPI for non-even cornered rounded rects
https://bugs.webkit.org/show_bug.cgi?id=190155

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-10-18
Reviewed by Simon Fraser.

Source/WebCore:

Instead of creating bezier curves for the non-even corners of the rounded
rects, we should use the optimized SPI provided by CG.

  • platform/graphics/cg/PathCG.cpp:

(WebCore::Path::platformAddPathForRoundedRect):

Source/WebCore/PAL:

  • pal/spi/cg/CoreGraphicsSPI.h:

LayoutTests:

This test fails on iOS simulator because of just one pixel difference.
I think it happens because of anti aliasing the color at the border of
the black shadow. Since this test is testing the radius attribute of the
CSS box-shadow and this should not be affected by whether the shadow has
non-even rounded corners or not, I am going to change it to have even
rounded corners.

  • fast/box-shadow/box-shadow-with-zero-radius-expected.html:
  • fast/box-shadow/box-shadow-with-zero-radius.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r237279 r237280  
     12018-10-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [CG] Adopt CG SPI for non-even cornered rounded rects
     4        https://bugs.webkit.org/show_bug.cgi?id=190155
     5
     6        Reviewed by Simon Fraser.
     7
     8        This test fails on iOS simulator because of just one pixel difference.
     9        I think it happens because of anti aliasing the color at the border of
     10        the black shadow. Since this test is testing the radius attribute of the
     11        CSS box-shadow and this should not be affected by whether the shadow has
     12        non-even rounded corners or not, I am going to change it to have even
     13        rounded corners.
     14
     15        * fast/box-shadow/box-shadow-with-zero-radius-expected.html:
     16        * fast/box-shadow/box-shadow-with-zero-radius.html:
     17
    1182018-10-18  Justin Fan  <justin_fan@apple.com>
    219
  • trunk/LayoutTests/fast/box-shadow/box-shadow-with-zero-radius-expected.html

    r145474 r237280  
    2121    height: 120px;
    2222    border-top-right-radius: 60px 60px;
    23     border-bottom-left-radius: 70px 60px;
     23    border-bottom-left-radius: 60px 60px;
    2424    background-color: yellow;
    2525}
     
    4343    height: 140px;
    4444    border-top-right-radius: 70px 70px;
    45     border-bottom-left-radius: 80px 70px;
     45    border-bottom-left-radius: 70px 70px;
    4646    background-color: black;
    4747}
  • trunk/LayoutTests/fast/box-shadow/box-shadow-with-zero-radius.html

    r145474 r237280  
    2222    height: 120px;
    2323    border-top-right-radius: 60px 60px;
    24     border-bottom-left-radius: 70px 60px;
     24    border-bottom-left-radius: 60px 60px;
    2525    background-color: yellow;
    2626    box-shadow: 110px 150px 0px 10px #000000;
  • trunk/Source/WebCore/ChangeLog

    r237276 r237280  
     12018-10-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [CG] Adopt CG SPI for non-even cornered rounded rects
     4        https://bugs.webkit.org/show_bug.cgi?id=190155
     5
     6        Reviewed by Simon Fraser.
     7
     8        Instead of creating bezier curves for the non-even corners of the rounded
     9        rects, we should use the optimized SPI provided by CG.
     10
     11        * platform/graphics/cg/PathCG.cpp:
     12        (WebCore::Path::platformAddPathForRoundedRect):
     13
    1142018-10-18  Justin Michaud  <justin_michaud@apple.com>
    215
  • trunk/Source/WebCore/PAL/ChangeLog

    r237266 r237280  
     12018-10-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [CG] Adopt CG SPI for non-even cornered rounded rects
     4        https://bugs.webkit.org/show_bug.cgi?id=190155
     5
     6        Reviewed by Simon Fraser.
     7
     8        * pal/spi/cg/CoreGraphicsSPI.h:
     9
    1102018-10-18  Alexey Proskuryakov  <ap@apple.com>
    211
  • trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h

    r237201 r237280  
    282282
    283283void CGContextDrawConicGradient(CGContextRef, CGGradientRef, CGPoint center, CGFloat angle);
     284
     285#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
     286void CGPathAddUnevenCornersRoundedRect(CGMutablePathRef, const CGAffineTransform *, CGRect, const CGSize corners[4]);
     287#endif
    284288#endif
    285289
  • trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp

    r237201 r237280  
    319319        return;
    320320    }
     321
     322#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
     323    CGRect rectToDraw = rect;
     324    CGSize corners[4] = { bottomLeftRadius, bottomRightRadius, topRightRadius, topLeftRadius };
     325    CGPathAddUnevenCornersRoundedRect(ensurePlatformPath(), nullptr, rectToDraw, corners);
     326    return;
     327#endif
    321328#endif
    322329
Note: See TracChangeset for help on using the changeset viewer.