WebKit support for Apple Pay Buttons with custom corner radii
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2020 23:01:25 +0000 (23:01 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2020 23:01:25 +0000 (23:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=207664
Source/WebCore:

<rdar://problem/43718114>

Patch by Nikos Mouchtaris <nmouchtaris@apple.com> 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 <nmouchtaris@apple.com> 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 <nmouchtaris@apple.com> 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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@256648 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/ApplePayButton.html
LayoutTests/http/tests/ssl/applepay/ApplePayButtonV4.html
LayoutTests/platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png
LayoutTests/platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt
LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png
LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt
LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png
LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h
Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm
Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h
Source/WebCore/rendering/RenderThemeCocoa.mm

index e6a5b14..77e7d90 100644 (file)
@@ -1,3 +1,22 @@
+2020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
+
+        WebKit support for Apple Pay Buttons with custom corner radii
+        https://bugs.webkit.org/show_bug.cgi?id=207664
+
+        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:
+
 2020-02-14  Ryan Haddad  <ryanhaddad@apple.com>
 
         [Web Animations] Unflake web-animations/timing-model/timelines/update-and-send-events.html WPT test
index 662bcb5..e1e1e60 100644 (file)
@@ -7,6 +7,7 @@
         .apple-pay-button {
             -webkit-appearance: -apple-pay-button;
             display: block;
+            float: left;
         }
 
         .white {
         .donate {
             -apple-pay-button-type: donate;
         }
+        .borderRadiusLarge {
+            border-top-left-radius: 20px/21px;
+            border-top-right-radius: 25px;
+            border-bottom-left-radius: 10px/1px;
+            border-bottom-right-radius: 5px;
+        }
     </style>
 </head>
-<body>
+<body bgcolor="#E6E6FA">
     <script>
         for (let style of ["white", "white-outline", "black"]) {
             for (let type of ["plain", "buy", "set-up", "donate"]) {
                 var button = document.createElement("button");
-                button.classList.add("apple-pay-button", style, type);
+                button.classList.add("apple-pay-button", style, type, "borderRadiusLarge");
+                var buttonNoRadius = document.createElement("button");
+                buttonNoRadius.classList.add("apple-pay-button", style, type);
                 document.body.appendChild(button);
+                document.body.appendChild(buttonNoRadius);
             }
         }
     </script>
index 689f6e8..f0ee260 100644 (file)
         .subscribe {
             -apple-pay-button-type: subscribe;
         }
+        .borderRadiusLarge {
+            border-top-left-radius: 20px/21px;
+            border-top-right-radius: 25px;
+            border-bottom-left-radius: 10px/1px;
+            border-bottom-right-radius: 5px;
+        }
     </style>
 </head>
-<body>
+<body bgcolor="#E6E6FA">
     <script>
         for (let style of ["white", "white-outline", "black"]) {
             for (let type of ["check-out", "book", "subscribe"]) {
                 var button = document.createElement("button");
-                button.classList.add("apple-pay-button", style, type);
+                button.classList.add("apple-pay-button", style, type, "borderRadiusLarge");
+                var buttonNoRadius = document.createElement("button");
+                buttonNoRadius.classList.add("apple-pay-button", style, type);
                 document.body.appendChild(button);
+                document.body.appendChild(buttonNoRadius);
             }
         }
     </script>
index 6c9d8d4..a8cd941 100644 (file)
Binary files a/LayoutTests/platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png and b/LayoutTests/platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png differ
index 6e30e61..93fb675 100644 (file)
@@ -1,17 +1,29 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x398
-  RenderBlock {HTML} at (0,0) size 800x398
-    RenderBody {BODY} at (8,8) size 784x382
-      RenderButton {BUTTON} at (2,0) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,32) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,64) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,96) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,128) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,160) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,192) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,224) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,256) size 100x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,288) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,320) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,352) size 140x30 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+layer at (0,0) size 800x178
+  RenderBlock {HTML} at (0,0) size 800x178
+    RenderBody {BODY} at (8,8) size 784x0 [bgcolor=#E6E6FA]
+      RenderButton {BUTTON} at (2,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (106,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (210,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (354,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (498,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (642,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (394,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (498,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (642,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (434,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (578,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (682,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (434,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (578,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,138) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
index 1952339..a8cd941 100644 (file)
Binary files a/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png and b/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png differ
index b51a612..93fb675 100644 (file)
@@ -1,17 +1,29 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x398
-  RenderBlock {HTML} at (0,0) size 800x398
-    RenderBody {BODY} at (8,8) size 784x382
-      RenderButton {BUTTON} at (2,0) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,32) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,64) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,96) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,128) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,160) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,192) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,224) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,256) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,288) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,320) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-      RenderButton {BUTTON} at (2,352) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+layer at (0,0) size 800x178
+  RenderBlock {HTML} at (0,0) size 800x178
+    RenderBody {BODY} at (8,8) size 784x0 [bgcolor=#E6E6FA]
+      RenderButton {BUTTON} at (2,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (106,2) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (210,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (354,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (498,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (642,2) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (394,36) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (498,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (642,36) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (434,70) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (578,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (682,70) size 100x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (146,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (290,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (434,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (578,104) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,138) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
index 6b367b4..cc54308 100644 (file)
Binary files a/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png and b/LayoutTests/platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png differ
index 3e8b460..124a852 100644 (file)
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x302
-  RenderBlock {HTML} at (0,0) size 800x302
-    RenderBody {BODY} at (8,8) size 784x286
+layer at (0,0) size 800x590
+  RenderBlock {HTML} at (0,0) size 800x590
+    RenderBody {BODY} at (8,8) size 784x574 [bgcolor=#E6E6FA]
       RenderButton {BUTTON} at (2,0) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
       RenderButton {BUTTON} at (2,32) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
       RenderButton {BUTTON} at (2,64) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
@@ -12,3 +12,12 @@ layer at (0,0) size 800x302
       RenderButton {BUTTON} at (2,192) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
       RenderButton {BUTTON} at (2,224) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
       RenderButton {BUTTON} at (2,256) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,288) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,320) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,352) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,384) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,416) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,448) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,480) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,512) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+      RenderButton {BUTTON} at (2,544) size 140x30 [color=#000000D8] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
index 4575761..705fd5e 100644 (file)
@@ -1,3 +1,19 @@
+2020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
+
+        WebKit support for Apple Pay Buttons with custom corner radii
+        https://bugs.webkit.org/show_bug.cgi?id=207664
+        <rdar://problem/43718114> 
+
+        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):
+
 2020-02-14  Antoine Quint  <graouts@webkit.org>
 
         [Web Animations] Missing call to DocumentTimeline::resumeAnimations() in Frame::resumeActiveDOMObjectsAndAnimations()
index 890a843..2029c14 100644 (file)
@@ -1,3 +1,18 @@
+2020-02-14  Nikos Mouchtaris  <nmouchtaris@apple.com>
+
+        WebKit support for Apple Pay Buttons with custom corner radii
+        https://bugs.webkit.org/show_bug.cgi?id=207664
+        <rdar://problem/43718114>
+
+        Reviewed by Andy Estes.
+
+        Added link for PKDrawApplePayButtonWithCornerRadius and
+        PKApplePayButtonDefaultCornerRadius.
+
+        * pal/cocoa/PassKitSoftLink.h:
+        * pal/cocoa/PassKitSoftLink.mm:
+        * pal/spi/cocoa/PassKitSPI.h:
+
 2020-02-12  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r256010.
index 98d2095..86d9b76 100644 (file)
@@ -47,13 +47,15 @@ SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationController)
 #endif
 
 SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion))
-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))
+SOFT_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))
+
 
 SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationResult)
 SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequestPaymentMethodUpdate)
 SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequestShippingContactUpdate)
 SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequestShippingMethodUpdate)
 
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKApplePayButtonDefaultCornerRadius, CGFloat)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldEmailAddress, PKContactField)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldName, PKContactField)
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, PassKit, PKContactFieldPhoneNumber, PKContactField)
index 4df5255..fca8c6b 100644 (file)
@@ -51,13 +51,14 @@ SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationContr
 #endif
 
 SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion), PAL_EXPORT)
-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))
+SOFT_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))
 
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationResult, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestPaymentMethodUpdate, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestShippingContactUpdate, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentRequestShippingMethodUpdate, PAL_EXPORT)
 
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKApplePayButtonDefaultCornerRadius, CGFloat, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldEmailAddress, PKContactField, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldName, PKContactField, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContactFieldPhoneNumber, PKContactField, PAL_EXPORT)
index 58f2fe4..ed3d216 100644 (file)
@@ -364,7 +364,7 @@ NS_ASSUME_NONNULL_END
 #endif
 
 extern "C"
-void PKDrawApplePayButton(_Nonnull CGContextRef, CGRect drawRect, CGFloat scale, PKPaymentButtonType, PKPaymentButtonStyle, NSString * _Nullable languageCode);
+void PKDrawApplePayButtonWithCornerRadius(_Nonnull CGContextRef, CGRect drawRect, CGFloat scale, CGFloat cornerRadius, PKPaymentButtonType, PKPaymentButtonStyle, NSString * _Nullable languageCode);
 
 NS_ASSUME_NONNULL_BEGIN
 
index 36198f0..8b6c5ed 100644 (file)
@@ -97,6 +97,23 @@ static PKPaymentButtonType toPKPaymentButtonType(ApplePayButtonType type)
     }
 }
 
+static CGFloat largestCornerRadius(const RenderStyle& style)
+{
+    if (!style.hasBorderRadius())
+        return PAL::get_PassKit_PKApplePayButtonDefaultCornerRadius();
+
+    return std::max<CGFloat>({
+        style.borderTopLeftRadius().height.value(),
+        style.borderTopLeftRadius().width.value(),
+        style.borderTopRightRadius().height.value(),
+        style.borderTopRightRadius().width.value(),
+        style.borderBottomLeftRadius().height.value(),
+        style.borderBottomLeftRadius().width.value(),
+        style.borderBottomRightRadius().height.value(),
+        style.borderBottomRightRadius().width.value()
+    });
+}
+
 bool RenderThemeCocoa::paintApplePayButton(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& paintRect)
 {
     GraphicsContextStateSaver stateSaver(paintInfo.context());
@@ -104,8 +121,7 @@ bool RenderThemeCocoa::paintApplePayButton(const RenderObject& renderer, const P
     paintInfo.context().setShouldSmoothFonts(true);
     paintInfo.context().scale(FloatSize(1, -1));
 
-    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());
-
+    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());
     return false;
 }