Changeset 256648 in webkit


Ignore:
Timestamp:
Feb 14, 2020 3:01:25 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

WebKit support for Apple Pay Buttons with custom corner radii
https://bugs.webkit.org/show_bug.cgi?id=207664
Source/WebCore:

<rdar://problem/43718114>

Patch by Nikos Mouchtaris <Nikos Mouchtaris> on 2020-02-14
Reviewed by Andy Estes.

Added support for border-radius css property for apple pay
button drawing.

Modified old tests to test this new behavior.

  • rendering/RenderThemeCocoa.mm:

(WebCore::RenderThemeCocoa::paintApplePayButton):

Source/WebCore/PAL:

<rdar://problem/43718114>

Patch by Nikos Mouchtaris <Nikos Mouchtaris> on 2020-02-14
Reviewed by Andy Estes.

Added link for PKDrawApplePayButtonWithCornerRadius and
PKApplePayButtonDefaultCornerRadius.

  • pal/cocoa/PassKitSoftLink.h:
  • pal/cocoa/PassKitSoftLink.mm:
  • pal/spi/cocoa/PassKitSPI.h:

LayoutTests:

Patch by Nikos Mouchtaris <Nikos Mouchtaris> on 2020-02-14
Reviewed by Andy Estes.

Modified both tests to test new functionality for setting custom corner
radii.

  • http/tests/ssl/applepay/ApplePayButton.html:
  • http/tests/ssl/applepay/ApplePayButtonV4.html:
  • platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png:
  • platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt:
  • platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png:
  • platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt:
  • platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png:
  • platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt:
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r256645 r256648  
     12020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        WebKit support for Apple Pay Buttons with custom corner radii
     4        https://bugs.webkit.org/show_bug.cgi?id=207664
     5
     6        Reviewed by Andy Estes.
     7
     8        Modified both tests to test new functionality for setting custom corner
     9        radii.
     10
     11        * http/tests/ssl/applepay/ApplePayButton.html:
     12        * http/tests/ssl/applepay/ApplePayButtonV4.html:
     13        * platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png:
     14        * platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt:
     15        * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png:
     16        * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt:
     17        * platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png:
     18        * platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt:
     19
    1202020-02-14  Ryan Haddad  <ryanhaddad@apple.com>
    221
  • trunk/LayoutTests/http/tests/ssl/applepay/ApplePayButton.html

    r236615 r256648  
    88            -webkit-appearance: -apple-pay-button;
    99            display: block;
     10            float: left;
    1011        }
    1112
     
    3738            -apple-pay-button-type: donate;
    3839        }
     40        .borderRadiusLarge {
     41            border-top-left-radius: 20px/21px;
     42            border-top-right-radius: 25px;
     43            border-bottom-left-radius: 10px/1px;
     44            border-bottom-right-radius: 5px;
     45        }
    3946    </style>
    4047</head>
    41 <body>
     48<body bgcolor="#E6E6FA">
    4249    <script>
    4350        for (let style of ["white", "white-outline", "black"]) {
    4451            for (let type of ["plain", "buy", "set-up", "donate"]) {
    4552                var button = document.createElement("button");
    46                 button.classList.add("apple-pay-button", style, type);
     53                button.classList.add("apple-pay-button", style, type, "borderRadiusLarge");
     54                var buttonNoRadius = document.createElement("button");
     55                buttonNoRadius.classList.add("apple-pay-button", style, type);
    4756                document.body.appendChild(button);
     57                document.body.appendChild(buttonNoRadius);
    4858            }
    4959        }
  • trunk/LayoutTests/http/tests/ssl/applepay/ApplePayButtonV4.html

    r235754 r256648  
    3333            -apple-pay-button-type: subscribe;
    3434        }
     35        .borderRadiusLarge {
     36            border-top-left-radius: 20px/21px;
     37            border-top-right-radius: 25px;
     38            border-bottom-left-radius: 10px/1px;
     39            border-bottom-right-radius: 5px;
     40        }
    3541    </style>
    3642</head>
    37 <body>
     43<body bgcolor="#E6E6FA">
    3844    <script>
    3945        for (let style of ["white", "white-outline", "black"]) {
    4046            for (let type of ["check-out", "book", "subscribe"]) {
    4147                var button = document.createElement("button");
    42                 button.classList.add("apple-pay-button", style, type);
     48                button.classList.add("apple-pay-button", style, type, "borderRadiusLarge");
     49                var buttonNoRadius = document.createElement("button");
     50                buttonNoRadius.classList.add("apple-pay-button", style, type);
    4351                document.body.appendChild(button);
     52                document.body.appendChild(buttonNoRadius);
    4453            }
    4554        }
  • trunk/LayoutTests/platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt

    r236615 r256648  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x398
    4   RenderBlock {HTML} at (0,0) size 800x398
    5     RenderBody {BODY} at (8,8) size 784x382
    6       RenderButton {BUTTON} at (2,0) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    7       RenderButton {BUTTON} at (2,32) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    8       RenderButton {BUTTON} at (2,64) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    9       RenderButton {BUTTON} at (2,96) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    10       RenderButton {BUTTON} at (2,128) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    11       RenderButton {BUTTON} at (2,160) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    12       RenderButton {BUTTON} at (2,192) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    13       RenderButton {BUTTON} at (2,224) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    14       RenderButton {BUTTON} at (2,256) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    15       RenderButton {BUTTON} at (2,288) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    16       RenderButton {BUTTON} at (2,320) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    17       RenderButton {BUTTON} at (2,352) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     3layer at (0,0) size 800x178
     4  RenderBlock {HTML} at (0,0) size 800x178
     5    RenderBody {BODY} at (8,8) size 784x0 [bgcolor=#E6E6FA]
     6      RenderButton {BUTTON} at (2,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     7      RenderButton {BUTTON} at (106,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     8      RenderButton {BUTTON} at (210,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     9      RenderButton {BUTTON} at (354,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     10      RenderButton {BUTTON} at (498,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     11      RenderButton {BUTTON} at (642,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     12      RenderButton {BUTTON} at (2,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     13      RenderButton {BUTTON} at (146,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     14      RenderButton {BUTTON} at (290,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     15      RenderButton {BUTTON} at (394,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     16      RenderButton {BUTTON} at (498,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     17      RenderButton {BUTTON} at (642,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     18      RenderButton {BUTTON} at (2,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     19      RenderButton {BUTTON} at (146,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     20      RenderButton {BUTTON} at (290,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     21      RenderButton {BUTTON} at (434,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     22      RenderButton {BUTTON} at (578,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     23      RenderButton {BUTTON} at (682,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     24      RenderButton {BUTTON} at (2,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     25      RenderButton {BUTTON} at (146,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     26      RenderButton {BUTTON} at (290,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     27      RenderButton {BUTTON} at (434,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     28      RenderButton {BUTTON} at (578,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     29      RenderButton {BUTTON} at (2,138) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
  • trunk/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt

    r236615 r256648  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x398
    4   RenderBlock {HTML} at (0,0) size 800x398
    5     RenderBody {BODY} at (8,8) size 784x382
    6       RenderButton {BUTTON} at (2,0) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    7       RenderButton {BUTTON} at (2,32) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    8       RenderButton {BUTTON} at (2,64) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    9       RenderButton {BUTTON} at (2,96) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    10       RenderButton {BUTTON} at (2,128) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    11       RenderButton {BUTTON} at (2,160) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    12       RenderButton {BUTTON} at (2,192) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    13       RenderButton {BUTTON} at (2,224) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    14       RenderButton {BUTTON} at (2,256) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    15       RenderButton {BUTTON} at (2,288) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    16       RenderButton {BUTTON} at (2,320) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    17       RenderButton {BUTTON} at (2,352) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     3layer at (0,0) size 800x178
     4  RenderBlock {HTML} at (0,0) size 800x178
     5    RenderBody {BODY} at (8,8) size 784x0 [bgcolor=#E6E6FA]
     6      RenderButton {BUTTON} at (2,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     7      RenderButton {BUTTON} at (106,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     8      RenderButton {BUTTON} at (210,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     9      RenderButton {BUTTON} at (354,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     10      RenderButton {BUTTON} at (498,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     11      RenderButton {BUTTON} at (642,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     12      RenderButton {BUTTON} at (2,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     13      RenderButton {BUTTON} at (146,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     14      RenderButton {BUTTON} at (290,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     15      RenderButton {BUTTON} at (394,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     16      RenderButton {BUTTON} at (498,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     17      RenderButton {BUTTON} at (642,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     18      RenderButton {BUTTON} at (2,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     19      RenderButton {BUTTON} at (146,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     20      RenderButton {BUTTON} at (290,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     21      RenderButton {BUTTON} at (434,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     22      RenderButton {BUTTON} at (578,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     23      RenderButton {BUTTON} at (682,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     24      RenderButton {BUTTON} at (2,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     25      RenderButton {BUTTON} at (146,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     26      RenderButton {BUTTON} at (290,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     27      RenderButton {BUTTON} at (434,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     28      RenderButton {BUTTON} at (578,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     29      RenderButton {BUTTON} at (2,138) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
  • trunk/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt

    r235349 r256648  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x302
    4   RenderBlock {HTML} at (0,0) size 800x302
    5     RenderBody {BODY} at (8,8) size 784x286
     3layer at (0,0) size 800x590
     4  RenderBlock {HTML} at (0,0) size 800x590
     5    RenderBody {BODY} at (8,8) size 784x574 [bgcolor=#E6E6FA]
    66      RenderButton {BUTTON} at (2,0) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    77      RenderButton {BUTTON} at (2,32) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     
    1313      RenderButton {BUTTON} at (2,224) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
    1414      RenderButton {BUTTON} at (2,256) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     15      RenderButton {BUTTON} at (2,288) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     16      RenderButton {BUTTON} at (2,320) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     17      RenderButton {BUTTON} at (2,352) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     18      RenderButton {BUTTON} at (2,384) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     19      RenderButton {BUTTON} at (2,416) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     20      RenderButton {BUTTON} at (2,448) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     21      RenderButton {BUTTON} at (2,480) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     22      RenderButton {BUTTON} at (2,512) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
     23      RenderButton {BUTTON} at (2,544) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
  • trunk/Source/WebCore/ChangeLog

    r256636 r256648  
     12020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        WebKit support for Apple Pay Buttons with custom corner radii
     4        https://bugs.webkit.org/show_bug.cgi?id=207664
     5        <rdar://problem/43718114>
     6
     7        Reviewed by Andy Estes.
     8
     9        Added support for border-radius css property for apple pay
     10        button drawing.
     11
     12        Modified old tests to test this new behavior.
     13
     14        * rendering/RenderThemeCocoa.mm:
     15        (WebCore::RenderThemeCocoa::paintApplePayButton):
     16
    1172020-02-14  Antoine Quint  <graouts@webkit.org>
    218
  • trunk/Source/WebCore/PAL/ChangeLog

    r256493 r256648  
     12020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        WebKit support for Apple Pay Buttons with custom corner radii
     4        https://bugs.webkit.org/show_bug.cgi?id=207664
     5        <rdar://problem/43718114>
     6
     7        Reviewed by Andy Estes.
     8
     9        Added link for PKDrawApplePayButtonWithCornerRadius and
     10        PKApplePayButtonDefaultCornerRadius.
     11
     12        * pal/cocoa/PassKitSoftLink.h:
     13        * pal/cocoa/PassKitSoftLink.mm:
     14        * pal/spi/cocoa/PassKitSPI.h:
     15
    1162020-02-12  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h

    r250048 r256648  
    4848
    4949SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion))
    50 SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
     50SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKDrawApplePayButtonWithCornerRadius, void, (CGContextRef context, CGRect drawRect, CGFloat scale, CGFloat cornerRadius, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, cornerRadius, type, style, languageCode))
     51
    5152
    5253SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationResult)
     
    5556SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequestShippingMethodUpdate)
    5657
     58SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKApplePayButtonDefaultCornerRadius, CGFloat)
    5759SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldEmailAddress, PKContactField)
    5860SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldName, PKContactField)
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm

    r250048 r256648  
    5252
    5353SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion), PAL_EXPORT)
    54 SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
     54SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, PassKit, PKDrawApplePayButtonWithCornerRadius, void, (CGContextRef context, CGRect drawRect, CGFloat scale, CGFloat cornerRadius, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, cornerRadius, type, style, languageCode))
    5555
    5656SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationResult, PAL_EXPORT)
     
    5959SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestShippingMethodUpdate, PAL_EXPORT)
    6060
     61SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKApplePayButtonDefaultCornerRadius, CGFloat, PAL_EXPORT)
    6162SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldEmailAddress, PKContactField, PAL_EXPORT)
    6263SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldName, PKContactField, PAL_EXPORT)
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h

    r256071 r256648  
    365365
    366366extern "C"
    367 void PKDrawApplePayButton(_Nonnull CGContextRef, CGRect drawRect, CGFloat scale, PKPaymentButtonType, PKPaymentButtonStyle, NSString * _Nullable languageCode);
     367void PKDrawApplePayButtonWithCornerRadius(_Nonnull CGContextRef, CGRect drawRect, CGFloat scale, CGFloat cornerRadius, PKPaymentButtonType, PKPaymentButtonStyle, NSString * _Nullable languageCode);
    368368
    369369NS_ASSUME_NONNULL_BEGIN
  • trunk/Source/WebCore/rendering/RenderThemeCocoa.mm

    r252308 r256648  
    9898}
    9999
     100static CGFloat largestCornerRadius(const RenderStyle& style)
     101{
     102    if (!style.hasBorderRadius())
     103        return PAL::get_PassKit_PKApplePayButtonDefaultCornerRadius();
     104
     105    return std::max<CGFloat>({
     106        style.borderTopLeftRadius().height.value(),
     107        style.borderTopLeftRadius().width.value(),
     108        style.borderTopRightRadius().height.value(),
     109        style.borderTopRightRadius().width.value(),
     110        style.borderBottomLeftRadius().height.value(),
     111        style.borderBottomLeftRadius().width.value(),
     112        style.borderBottomRightRadius().height.value(),
     113        style.borderBottomRightRadius().width.value()
     114    });
     115}
     116
    100117bool RenderThemeCocoa::paintApplePayButton(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& paintRect)
    101118{
     
    105122    paintInfo.context().scale(FloatSize(1, -1));
    106123
    107     PKDrawApplePayButton(paintInfo.context().platformContext(), CGRectMake(paintRect.x(), -paintRect.maxY(), paintRect.width(), paintRect.height()), 1.0, toPKPaymentButtonType(renderer.style().applePayButtonType()), toPKPaymentButtonStyle(renderer.style().applePayButtonStyle()), renderer.style().locale());
    108 
     124    PKDrawApplePayButtonWithCornerRadius(paintInfo.context().platformContext(), CGRectMake(paintRect.x(), -paintRect.maxY(), paintRect.width(), paintRect.height()), 1.0, largestCornerRadius(renderer.style()), toPKPaymentButtonType(renderer.style().applePayButtonType()), toPKPaymentButtonStyle(renderer.style().applePayButtonStyle()), renderer.style().locale());
    109125    return false;
    110126}
Note: See TracChangeset for help on using the changeset viewer.