Title: [237647] trunk
Revision
237647
Author
[email protected]
Date
2018-10-31 13:08:43 -0700 (Wed, 31 Oct 2018)

Log Message

Add credit card autofill button
https://bugs.webkit.org/show_bug.cgi?id=191051
<rdar://problem/45657011>

Patch by Zach Li <[email protected]> on 2018-10-31
Reviewed by Wenson Hsieh.

Source/WebCore:

Test: fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* css/html.css:
(input::-webkit-credit-card-auto-fill-button):
Add credit card autofill button.
(input::-webkit-credit-card-auto-fill-button:hover):
(input::-webkit-credit-card-auto-fill-button:active):
* html/HTMLTextFormControlElement.h:
* html/TextFieldInputType.cpp:
(WebCore::autoFillButtonTypeToAccessibilityLabel):
(WebCore::autoFillButtonTypeToAutoFillButtonText):
(WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
(WebCore::isAutoFillButtonTypeChanged):
* platform/LocalizedStrings.cpp:
(WebCore::AXAutoFillCreditCardLabel):
* platform/LocalizedStrings.h:
* testing/Internals.cpp:
(WebCore::toAutoFillButtonType):
(WebCore::toInternalsAutoFillButtonType):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(toAutoFillButtonType):
(toWKAutoFillButtonType):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
Introduce a new button type for credit card autofill.
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(toAutoFillButtonType):
(toWKAutoFillButtonType):
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:

LayoutTests:

* fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
* fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html: Added.
* fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt:
* fast/forms/auto-fill-button/last-auto-fill-button-type.html:
* platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
* platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png: Added.
* platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237646 => 237647)


--- trunk/LayoutTests/ChangeLog	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/LayoutTests/ChangeLog	2018-10-31 20:08:43 UTC (rev 237647)
@@ -1,3 +1,19 @@
+2018-10-31  Zach Li  <[email protected]>
+
+        Add credit card autofill button
+        https://bugs.webkit.org/show_bug.cgi?id=191051
+        <rdar://problem/45657011>
+
+        Reviewed by Wenson Hsieh.
+
+        * fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
+        * fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html: Added.
+        * fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt:
+        * fast/forms/auto-fill-button/last-auto-fill-button-type.html:
+        * platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
+        * platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png: Added.
+        * platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
+
 2018-10-31  Devin Rousso  <[email protected]>
 
         Web Inspector: Audit: show metadata for results

Added: trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt (0 => 237647)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	2018-10-31 20:08:43 UTC (rev 237647)
@@ -0,0 +1,44 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x81
+  RenderBlock {HTML} at (0,0) size 800x81
+    RenderBody {BODY} at (8,16) size 784x57
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 582x18
+          text run at (0,0) width 196: "This tests that the Credit Card "
+          text run at (195,0) width 387: "AutoFill button renders. It can only be tested in the test tool."
+      RenderBlock {DIV} at (0,34) size 784x23
+        RenderTextControl {INPUT} at (2,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 113x13
+        RenderText {#text} at (149,2) size 5x18
+          text run at (149,2) width 5: " "
+        RenderTextControl {INPUT} at (155,2) size 147x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 113x13
+        RenderText {#text} at (303,2) size 5x18
+          text run at (303,2) width 5: " "
+        RenderTextControl {INPUT} at (309,2) size 147x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 113x13
+        RenderText {#text} at (457,2) size 5x18
+          text run at (457,2) width 5: " "
+        RenderTextControl {INPUT} at (463,2) size 147x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 113x13
+layer at (13,55) size 113x13
+  RenderBlock {DIV} at (0,0) size 113x13
+layer at (167,55) size 113x13
+  RenderBlock {DIV} at (0,0) size 113x13
+layer at (321,55) size 113x13
+  RenderBlock {DIV} at (0,0) size 113x13
+layer at (475,55) size 113x13
+  RenderBlock {DIV} at (0,0) size 113x13
+layer at (129,56) size 22x12
+  RenderBlock {DIV} at (115,0) size 23x13 [bgcolor=#000000]
+layer at (283,56) size 22x12
+  RenderBlock {DIV} at (115,0) size 23x13 [bgcolor=#000000]
+layer at (437,56) size 22x12
+  RenderBlock {DIV} at (115,0) size 23x13 [bgcolor=#000000]
+layer at (591,56) size 22x12
+  RenderBlock {DIV} at (115,0) size 23x13 [bgcolor=#000000]

Added: trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html (0 => 237647)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html	2018-10-31 20:08:43 UTC (rev 237647)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the Credit Card  AutoFill button renders. It can only be tested in the test tool.</p>
+<div id="container">
+    <input type="text">
+    <input type="text" name="cc_number">
+    <input type="text" name="cc_holder">
+</div>
+<script>
+
+if (window.internals) {
+    var inputs = document.querySelectorAll("input");
+    for (var i = 0; i < inputs.length; ++i)
+        window.internals.setShowAutoFillButton(inputs[i], "CreditCard");
+
+    var dynamicInput = document.createElement("input");
+    window.internals.setShowAutoFillButton(dynamicInput, "CreditCard");
+    document.querySelector("#container").appendChild(dynamicInput);
+}
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt (237646 => 237647)


--- trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt	2018-10-31 20:08:43 UTC (rev 237647)
@@ -16,9 +16,12 @@
 internals.setShowAutoFillButton(inputElement, 'Credentials')
 PASS internals.autoFillButtonType(inputElement) is "Credentials"
 PASS internals.lastAutoFillButtonType(inputElement) is "StrongPassword"
+internals.setShowAutoFillButton(inputElement, 'CreditCard')
+PASS internals.autoFillButtonType(inputElement) is "CreditCard"
+PASS internals.lastAutoFillButtonType(inputElement) is "Credentials"
 internals.setShowAutoFillButton(inputElement, 'None')
 PASS internals.autoFillButtonType(inputElement) is "None"
-PASS internals.lastAutoFillButtonType(inputElement) is "Credentials"
+PASS internals.lastAutoFillButtonType(inputElement) is "CreditCard"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html (237646 => 237647)


--- trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html	2018-10-31 20:08:43 UTC (rev 237647)
@@ -25,9 +25,12 @@
     evalAndLog("internals.setShowAutoFillButton(inputElement, 'Credentials')");
     shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "Credentials");
     shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "StrongPassword");
+    evalAndLog("internals.setShowAutoFillButton(inputElement, 'CreditCard')");
+    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "CreditCard");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Credentials");
     evalAndLog("internals.setShowAutoFillButton(inputElement, 'None')");
     shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "None");
-    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Credentials");
+    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "CreditCard");
 }
 </script>
 </body>

Added: trunk/LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt (0 => 237647)


--- trunk/LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	2018-10-31 20:08:43 UTC (rev 237647)
@@ -0,0 +1,44 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x85
+  RenderBlock {HTML} at (0,0) size 800x85
+    RenderBody {BODY} at (8,16) size 784x61
+      RenderBlock {P} at (0,0) size 784x20
+        RenderText {#text} at (0,0) size 582x19
+          text run at (0,0) width 196: "This tests that the Credit Card "
+          text run at (195,0) width 387: "AutoFill button renders. It can only be tested in the test tool."
+      RenderBlock {DIV} at (0,36) size 784x25
+        RenderTextControl {INPUT} at (2,2) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
+          RenderFlexibleBox {DIV} at (6,3) size 123x15
+            RenderBlock {DIV} at (0,0) size 96x14
+        RenderText {#text} at (139,1) size 5x19
+          text run at (139,1) width 5: " "
+        RenderTextControl {INPUT} at (145,2) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
+          RenderFlexibleBox {DIV} at (6,3) size 123x15
+            RenderBlock {DIV} at (0,0) size 96x14
+        RenderText {#text} at (282,1) size 5x19
+          text run at (282,1) width 5: " "
+        RenderTextControl {INPUT} at (288,2) size 137x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
+          RenderFlexibleBox {DIV} at (6,3) size 123x15
+            RenderBlock {DIV} at (0,0) size 96x14
+        RenderText {#text} at (426,1) size 5x19
+          text run at (426,1) width 5: " "
+        RenderTextControl {INPUT} at (432,2) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
+          RenderFlexibleBox {DIV} at (6,3) size 123x15
+            RenderBlock {DIV} at (0,0) size 96x14
+layer at (17,57) size 95x14
+  RenderBlock {DIV} at (0,0) size 96x14
+layer at (160,57) size 95x14
+  RenderBlock {DIV} at (0,0) size 96x14
+layer at (303,57) size 95x14
+  RenderBlock {DIV} at (0,0) size 96x14
+layer at (447,57) size 95x14
+  RenderBlock {DIV} at (0,0) size 96x14
+layer at (115,58) size 22x12
+  RenderBlock {DIV} at (98,1) size 23x12 [bgcolor=#000000]
+layer at (258,58) size 22x12
+  RenderBlock {DIV} at (98,1) size 23x12 [bgcolor=#000000]
+layer at (402,58) size 22x12
+  RenderBlock {DIV} at (98,1) size 23x12 [bgcolor=#000000]
+layer at (545,58) size 22x12
+  RenderBlock {DIV} at (98,1) size 23x12 [bgcolor=#000000]

Added: trunk/LayoutTests/platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png


(Binary files differ)
Index: trunk/LayoutTests/platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png =================================================================== --- trunk/LayoutTests/platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png 2018-10-31 20:05:46 UTC (rev 237646) +++ trunk/LayoutTests/platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png 2018-10-31 20:08:43 UTC (rev 237647) Property changes on: trunk/LayoutTests/platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png ___________________________________________________________________

Added: svn:mime-type

+image/png \ No newline at end of property

Added: trunk/LayoutTests/platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt (0 => 237647)


--- trunk/LayoutTests/platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt	2018-10-31 20:08:43 UTC (rev 237647)
@@ -0,0 +1,44 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x83
+  RenderBlock {HTML} at (0,0) size 800x83
+    RenderBody {BODY} at (8,16) size 784x59
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 568x18
+          text run at (0,0) width 191: "This tests that the Credit Card "
+          text run at (191,0) width 377: "AutoFill button renders. It can only be tested in the test tool."
+      RenderBlock {DIV} at (0,34) size 784x25
+        RenderTextControl {INPUT} at (2,2) size 149x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (2,3) size 145x15
+            RenderBlock {DIV} at (0,0) size 118x15
+        RenderText {#text} at (153,3) size 4x18
+          text run at (153,3) width 4: " "
+        RenderTextControl {INPUT} at (159,2) size 149x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (2,3) size 145x15
+            RenderBlock {DIV} at (0,0) size 118x15
+        RenderText {#text} at (310,3) size 4x18
+          text run at (310,3) width 4: " "
+        RenderTextControl {INPUT} at (316,2) size 149x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (2,3) size 145x15
+            RenderBlock {DIV} at (0,0) size 118x15
+        RenderText {#text} at (467,3) size 4x18
+          text run at (467,3) width 4: " "
+        RenderTextControl {INPUT} at (473,2) size 149x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (2,3) size 145x15
+            RenderBlock {DIV} at (0,0) size 118x15
+layer at (12,55) size 118x15
+  RenderBlock {DIV} at (0,0) size 118x15
+layer at (169,55) size 118x15
+  RenderBlock {DIV} at (0,0) size 118x15
+layer at (326,55) size 118x15
+  RenderBlock {DIV} at (0,0) size 118x15
+layer at (483,55) size 118x15
+  RenderBlock {DIV} at (0,0) size 118x15
+layer at (133,57) size 22x12
+  RenderBlock {DIV} at (121,1) size 22x13 [bgcolor=#000000]
+layer at (290,57) size 22x12
+  RenderBlock {DIV} at (121,1) size 22x13 [bgcolor=#000000]
+layer at (447,57) size 22x12
+  RenderBlock {DIV} at (121,1) size 22x13 [bgcolor=#000000]
+layer at (604,57) size 22x12
+  RenderBlock {DIV} at (121,1) size 22x13 [bgcolor=#000000]

Modified: trunk/Source/WebCore/ChangeLog (237646 => 237647)


--- trunk/Source/WebCore/ChangeLog	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/ChangeLog	2018-10-31 20:08:43 UTC (rev 237647)
@@ -1,3 +1,35 @@
+2018-10-31  Zach Li  <[email protected]>
+
+        Add credit card autofill button
+        https://bugs.webkit.org/show_bug.cgi?id=191051
+        <rdar://problem/45657011>
+
+        Reviewed by Wenson Hsieh.
+
+        Test: fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * css/html.css:
+        (input::-webkit-credit-card-auto-fill-button):
+        Add credit card autofill button.
+        (input::-webkit-credit-card-auto-fill-button:hover):
+        (input::-webkit-credit-card-auto-fill-button:active):
+        * html/HTMLTextFormControlElement.h:
+        * html/TextFieldInputType.cpp:
+        (WebCore::autoFillButtonTypeToAccessibilityLabel):
+        (WebCore::autoFillButtonTypeToAutoFillButtonText):
+        (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
+        (WebCore::isAutoFillButtonTypeChanged):
+        * platform/LocalizedStrings.cpp:
+        (WebCore::AXAutoFillCreditCardLabel):
+        * platform/LocalizedStrings.h:
+        * testing/Internals.cpp:
+        (WebCore::toAutoFillButtonType):
+        (WebCore::toInternalsAutoFillButtonType):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2018-10-31  Eric Carlson  <[email protected]>
 
         [MediaStream] Don't reveal device IDs until the user has granted permission to capture

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (237646 => 237647)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-10-31 20:08:43 UTC (rev 237647)
@@ -3110,6 +3110,8 @@
             return @"contacts";
         case AutoFillButtonType::StrongPassword:
             return @"strong password";
+        case AutoFillButtonType::CreditCard:
+            return @"credit card";
         }
     }
     

Modified: trunk/Source/WebCore/css/html.css (237646 => 237647)


--- trunk/Source/WebCore/css/html.css	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/css/html.css	2018-10-31 20:08:43 UTC (rev 237647)
@@ -602,6 +602,26 @@
     background-color: rgb(0, 60, 219);
 }
 
+input::-webkit-credit-card-auto-fill-button {
+    -webkit-mask-image: -webkit-image-set(url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAAYCAYAAAC1Ft6mAAAAAXNSR0IArs4c6QAAAYlJREFUWAntmD1OA0EMhQMFBBACCRqq5F4cANHDAZAoaBB00NAiDkSXggvQIAp+JH7eVziYkZddKTOzKPAka2yPx/aLN5NVBoM5xKo4XUmeJB8VhDrUo24RkLwGkbQGdbNjQRn5xIbZM7cnfFbISnvYH49gQjwKfYH6WbGYNdsvSPZPqNIQblTnRbLXsR5xXDKcK3Zlj5R7M5GtpJ7MEK/y2jW/H0Z8Odm3WM5NDXPmWiETweeP9vEdSHxcEykm4+MOOewdOfVZCNHXkevtXfouTgfsN4n1fGx75si9zkqI/k5cwzRvpFIyxE2Rm4jl4/uSYlkO22ftgpTUpQ75yXwjQ0JfoLbehRAxpw19nkUJapPw9aJ+Ih9vFBcSfxY7fNPwQbX1qPkmH80zEa7mc0lIBickDGMpD2ZoHUruJDvOh7ouuZWMMBy2pU+c3aaGTbUd+mk/ffXZSIL59eUTSW+sR/mWJGsSj3tv9KGnE6rdQ5EJMYU+UKQuj9x1H2xK1p27P0l6GlCZsp/oV3aRfWEA1gAAAABJRU5ErkJggg==") 2x);
+    -webkit-mask-size: 22px 12px;
+    width: 22px;
+    height: 12px;
+    margin-left: 3px;
+    margin-right: 2px;
+    background-color: black;
+    flex: none;
+    -webkit-user-select: none;
+}
+
+input::-webkit-credit-card-auto-fill-button:hover {
+    background-color: rgb(0, 122, 255);
+}
+
+input::-webkit-credit-card-auto-fill-button:active {
+    background-color: rgb(0, 60, 219);
+}
+
 input::-webkit-caps-lock-indicator {
     -webkit-appearance: caps-lock-indicator;
     content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17"><path fill="black" fill-opacity="0.4" d="M12.5 0.5A 4 4 0 0 1 16.5 4.5L 16.5 12.5A 4 4 0 0 1 12.5 16.5L 4.5 16.5A 4 4 0 0 1 0.5 12.5L 0.5 4.5A 4 4 0 0 1 4.5 0.5L 12.5 0.5M 8.5 2L 4 7L 6.25 7L 6.25 10.25L 10.75 10.25L 10.75 7L 13 7L 8.5 2M 10.75 12L 6.25 12L 6.25 14.25L 10.75 14.25L 10.75 12"/></svg>');

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (237646 => 237647)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2018-10-31 20:08:43 UTC (rev 237647)
@@ -33,7 +33,7 @@
 class TextControlInnerTextElement;
 class VisiblePosition;
 
-enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongPassword };
+enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongPassword, CreditCard };
 enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardDirection, SelectionHasBackwardDirection };
 enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInputAndChangeEvent };
 

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (237646 => 237647)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2018-10-31 20:08:43 UTC (rev 237647)
@@ -480,6 +480,8 @@
         return AXAutoFillCredentialsLabel();
     case AutoFillButtonType::StrongPassword:
         return AXAutoFillStrongPasswordLabel();
+    case AutoFillButtonType::CreditCard:
+        return AXAutoFillCreditCardLabel();
     case AutoFillButtonType::None:
         ASSERT_NOT_REACHED();
         return { };
@@ -493,6 +495,7 @@
     switch (autoFillButtonType) {
     case AutoFillButtonType::Contacts:
     case AutoFillButtonType::Credentials:
+    case AutoFillButtonType::CreditCard:
         return emptyString();
     case AutoFillButtonType::StrongPassword:
         return autoFillStrongPasswordLabel();
@@ -513,6 +516,8 @@
         return { "-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral };
     case AutoFillButtonType::StrongPassword:
         return { "-webkit-strong-password-auto-fill-button", AtomicString::ConstructFromLiteral };
+    case AutoFillButtonType::CreditCard:
+        return { "-webkit-credit-card-auto-fill-button", AtomicString::ConstructFromLiteral };
     case AutoFillButtonType::None:
         ASSERT_NOT_REACHED();
         return emptyAtom();
@@ -529,6 +534,8 @@
         return true;
     if (attribute == "-webkit-strong-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongPassword)
         return true;
+    if (attribute == "-webkit-credit-card-auto-fill-button" && autoFillButtonType != AutoFillButtonType::CreditCard)
+        return true;
     return false;
 }
 

Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (237646 => 237647)


--- trunk/Source/WebCore/platform/LocalizedStrings.cpp	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp	2018-10-31 20:08:43 UTC (rev 237647)
@@ -625,6 +625,11 @@
     return WEB_UI_STRING("strong password auto fill", "Label for the strong password auto fill button inside a text field.");
 }
 
+String AXAutoFillCreditCardLabel()
+{
+    return WEB_UI_STRING("credit card auto fill", "Label for the credit card auto fill button inside a text field.");
+}
+
 String autoFillStrongPasswordLabel()
 {
     return WEB_UI_STRING("Strong Password", "Label for strong password.");

Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (237646 => 237647)


--- trunk/Source/WebCore/platform/LocalizedStrings.h	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h	2018-10-31 20:08:43 UTC (rev 237647)
@@ -216,6 +216,7 @@
     String AXAutoFillCredentialsLabel();
     String AXAutoFillContactsLabel();
     String AXAutoFillStrongPasswordLabel();
+    String AXAutoFillCreditCardLabel();
     String autoFillStrongPasswordLabel();
 
     String missingPluginText();

Modified: trunk/Source/WebCore/testing/Internals.cpp (237646 => 237647)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-10-31 20:08:43 UTC (rev 237647)
@@ -1778,6 +1778,8 @@
         return AutoFillButtonType::Contacts;
     case Internals::AutoFillButtonType::StrongPassword:
         return AutoFillButtonType::StrongPassword;
+    case Internals::AutoFillButtonType::CreditCard:
+        return AutoFillButtonType::CreditCard;
     }
     ASSERT_NOT_REACHED();
     return AutoFillButtonType::None;
@@ -1794,6 +1796,8 @@
         return Internals::AutoFillButtonType::Contacts;
     case AutoFillButtonType::StrongPassword:
         return Internals::AutoFillButtonType::StrongPassword;
+    case AutoFillButtonType::CreditCard:
+        return Internals::AutoFillButtonType::CreditCard;
     }
     ASSERT_NOT_REACHED();
     return Internals::AutoFillButtonType::None;

Modified: trunk/Source/WebCore/testing/Internals.h (237646 => 237647)


--- trunk/Source/WebCore/testing/Internals.h	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/testing/Internals.h	2018-10-31 20:08:43 UTC (rev 237647)
@@ -254,7 +254,7 @@
     bool elementShouldAutoComplete(HTMLInputElement&);
     void setEditingValue(HTMLInputElement&, const String&);
     void setAutofilled(HTMLInputElement&, bool enabled);
-    enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword };
+    enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, CreditCard };
     void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
     AutoFillButtonType autoFillButtonType(const HTMLInputElement&);
     AutoFillButtonType lastAutoFillButtonType(const HTMLInputElement&);

Modified: trunk/Source/WebCore/testing/Internals.idl (237646 => 237647)


--- trunk/Source/WebCore/testing/Internals.idl	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebCore/testing/Internals.idl	2018-10-31 20:08:43 UTC (rev 237647)
@@ -62,7 +62,8 @@
     "None",
     "Contacts",
     "Credentials",
-    "StrongPassword"
+    "StrongPassword",
+    "CreditCard"
 };
 
 enum UserInterfaceLayoutDirection {

Modified: trunk/Source/WebKit/ChangeLog (237646 => 237647)


--- trunk/Source/WebKit/ChangeLog	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebKit/ChangeLog	2018-10-31 20:08:43 UTC (rev 237647)
@@ -1,3 +1,21 @@
+2018-10-31  Zach Li  <[email protected]>
+
+        Add credit card autofill button
+        https://bugs.webkit.org/show_bug.cgi?id=191051
+        <rdar://problem/45657011>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
+        (toAutoFillButtonType):
+        (toWKAutoFillButtonType):
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
+        Introduce a new button type for credit card autofill.
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
+        (toAutoFillButtonType):
+        (toWKAutoFillButtonType):
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
+
 2018-10-31  Chris Dumez  <[email protected]>
 
         [PSON] When process-swapping for a POST request the HTTP body gets dropped

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm (237646 => 237647)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2018-10-31 20:08:43 UTC (rev 237647)
@@ -127,6 +127,8 @@
         return WebCore::AutoFillButtonType::Credentials;
     case _WKAutoFillButtonTypeStrongPassword:
         return WebCore::AutoFillButtonType::StrongPassword;
+    case _WKAutoFillButtonTypeCreditCard:
+        return WebCore::AutoFillButtonType::CreditCard;
     }
     ASSERT_NOT_REACHED();
     return WebCore::AutoFillButtonType::None;
@@ -143,6 +145,8 @@
         return _WKAutoFillButtonTypeCredentials;
     case WebCore::AutoFillButtonType::StrongPassword:
         return _WKAutoFillButtonTypeStrongPassword;
+    case WebCore::AutoFillButtonType::CreditCard:
+        return _WKAutoFillButtonTypeCreditCard;
     }
     ASSERT_NOT_REACHED();
     return _WKAutoFillButtonTypeNone;

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h (237646 => 237647)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h	2018-10-31 20:08:43 UTC (rev 237647)
@@ -32,6 +32,7 @@
     _WKAutoFillButtonTypeCredentials,
     _WKAutoFillButtonTypeContacts,
     _WKAutoFillButtonTypeStrongPassword,
+    _WKAutoFillButtonTypeCreditCard WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
 } WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 
 @interface WKWebProcessPlugInNodeHandle (WKPrivate)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp (237646 => 237647)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2018-10-31 20:08:43 UTC (rev 237647)
@@ -48,6 +48,8 @@
         return WebCore::AutoFillButtonType::Credentials;
     case kWKAutoFillButtonTypeStrongPassword:
         return WebCore::AutoFillButtonType::StrongPassword;
+    case kWKAutoFillButtonTypeCreditCard:
+        return WebCore::AutoFillButtonType::CreditCard;
     }
     ASSERT_NOT_REACHED();
     return WebCore::AutoFillButtonType::None;
@@ -64,6 +66,8 @@
         return kWKAutoFillButtonTypeCredentials;
     case WebCore::AutoFillButtonType::StrongPassword:
         return kWKAutoFillButtonTypeStrongPassword;
+    case WebCore::AutoFillButtonType::CreditCard:
+        return kWKAutoFillButtonTypeCreditCard;
     }
     ASSERT_NOT_REACHED();
     return kWKAutoFillButtonTypeNone;

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h (237646 => 237647)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2018-10-31 20:05:46 UTC (rev 237646)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2018-10-31 20:08:43 UTC (rev 237647)
@@ -40,6 +40,7 @@
     kWKAutoFillButtonTypeCredentials,
     kWKAutoFillButtonTypeContacts,
     kWKAutoFillButtonTypeStrongPassword,
+    kWKAutoFillButtonTypeCreditCard,
 };
 typedef uint8_t WKAutoFillButtonType;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to