⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 237647 in webkit


Ignore:
Timestamp:
Oct 31, 2018, 1:08:43 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Zach Li <zacharyli323@gmail.com> 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.
Location:
trunk
Files:
6 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r237644 r237647  
     12018-10-31  Zach Li  <zacharyli323@gmail.com>
     2
     3        Add credit card autofill button
     4        https://bugs.webkit.org/show_bug.cgi?id=191051
     5        <rdar://problem/45657011>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
     10        * fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html: Added.
     11        * fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt:
     12        * fast/forms/auto-fill-button/last-auto-fill-button-type.html:
     13        * platform/ios-simulator/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
     14        * platform/mac/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.png: Added.
     15        * platform/win/fast/forms/auto-fill-button/input-credit-card-auto-fill-button-expected.txt: Added.
     16
    1172018-10-31  Devin Rousso  <drousso@apple.com>
    218
  • trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt

    r233578 r237647  
    1717PASS internals.autoFillButtonType(inputElement) is "Credentials"
    1818PASS internals.lastAutoFillButtonType(inputElement) is "StrongPassword"
     19internals.setShowAutoFillButton(inputElement, 'CreditCard')
     20PASS internals.autoFillButtonType(inputElement) is "CreditCard"
     21PASS internals.lastAutoFillButtonType(inputElement) is "Credentials"
    1922internals.setShowAutoFillButton(inputElement, 'None')
    2023PASS internals.autoFillButtonType(inputElement) is "None"
    21 PASS internals.lastAutoFillButtonType(inputElement) is "Credentials"
     24PASS internals.lastAutoFillButtonType(inputElement) is "CreditCard"
    2225PASS successfullyParsed is true
    2326
  • trunk/LayoutTests/fast/forms/auto-fill-button/last-auto-fill-button-type.html

    r233578 r237647  
    2626    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "Credentials");
    2727    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "StrongPassword");
     28    evalAndLog("internals.setShowAutoFillButton(inputElement, 'CreditCard')");
     29    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "CreditCard");
     30    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Credentials");
    2831    evalAndLog("internals.setShowAutoFillButton(inputElement, 'None')");
    2932    shouldBeEqualToString("internals.autoFillButtonType(inputElement)", "None");
    30     shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "Credentials");
     33    shouldBeEqualToString("internals.lastAutoFillButtonType(inputElement)", "CreditCard");
    3134}
    3235</script>
  • trunk/Source/WebCore/ChangeLog

    r237643 r237647  
     12018-10-31  Zach Li  <zacharyli323@gmail.com>
     2
     3        Add credit card autofill button
     4        https://bugs.webkit.org/show_bug.cgi?id=191051
     5        <rdar://problem/45657011>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Test: fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html
     10
     11        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     12        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     13        * css/html.css:
     14        (input::-webkit-credit-card-auto-fill-button):
     15        Add credit card autofill button.
     16        (input::-webkit-credit-card-auto-fill-button:hover):
     17        (input::-webkit-credit-card-auto-fill-button:active):
     18        * html/HTMLTextFormControlElement.h:
     19        * html/TextFieldInputType.cpp:
     20        (WebCore::autoFillButtonTypeToAccessibilityLabel):
     21        (WebCore::autoFillButtonTypeToAutoFillButtonText):
     22        (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
     23        (WebCore::isAutoFillButtonTypeChanged):
     24        * platform/LocalizedStrings.cpp:
     25        (WebCore::AXAutoFillCreditCardLabel):
     26        * platform/LocalizedStrings.h:
     27        * testing/Internals.cpp:
     28        (WebCore::toAutoFillButtonType):
     29        (WebCore::toInternalsAutoFillButtonType):
     30        * testing/Internals.h:
     31        * testing/Internals.idl:
     32
    1332018-10-31  Eric Carlson  <eric.carlson@apple.com>
    234
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r236832 r237647  
    31113111        case AutoFillButtonType::StrongPassword:
    31123112            return @"strong password";
     3113        case AutoFillButtonType::CreditCard:
     3114            return @"credit card";
    31133115        }
    31143116    }
  • trunk/Source/WebCore/css/html.css

    r237266 r237647  
    603603}
    604604
     605input::-webkit-credit-card-auto-fill-button {
     606    -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);
     607    -webkit-mask-size: 22px 12px;
     608    width: 22px;
     609    height: 12px;
     610    margin-left: 3px;
     611    margin-right: 2px;
     612    background-color: black;
     613    flex: none;
     614    -webkit-user-select: none;
     615}
     616
     617input::-webkit-credit-card-auto-fill-button:hover {
     618    background-color: rgb(0, 122, 255);
     619}
     620
     621input::-webkit-credit-card-auto-fill-button:active {
     622    background-color: rgb(0, 60, 219);
     623}
     624
    605625input::-webkit-caps-lock-indicator {
    606626    -webkit-appearance: caps-lock-indicator;
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.h

    r237266 r237647  
    3434class VisiblePosition;
    3535
    36 enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongPassword };
     36enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongPassword, CreditCard };
    3737enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardDirection, SelectionHasBackwardDirection };
    3838enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInputAndChangeEvent };
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r237266 r237647  
    481481    case AutoFillButtonType::StrongPassword:
    482482        return AXAutoFillStrongPasswordLabel();
     483    case AutoFillButtonType::CreditCard:
     484        return AXAutoFillCreditCardLabel();
    483485    case AutoFillButtonType::None:
    484486        ASSERT_NOT_REACHED();
     
    494496    case AutoFillButtonType::Contacts:
    495497    case AutoFillButtonType::Credentials:
     498    case AutoFillButtonType::CreditCard:
    496499        return emptyString();
    497500    case AutoFillButtonType::StrongPassword:
     
    514517    case AutoFillButtonType::StrongPassword:
    515518        return { "-webkit-strong-password-auto-fill-button", AtomicString::ConstructFromLiteral };
     519    case AutoFillButtonType::CreditCard:
     520        return { "-webkit-credit-card-auto-fill-button", AtomicString::ConstructFromLiteral };
    516521    case AutoFillButtonType::None:
    517522        ASSERT_NOT_REACHED();
     
    529534        return true;
    530535    if (attribute == "-webkit-strong-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongPassword)
     536        return true;
     537    if (attribute == "-webkit-credit-card-auto-fill-button" && autoFillButtonType != AutoFillButtonType::CreditCard)
    531538        return true;
    532539    return false;
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r237266 r237647  
    624624{
    625625    return WEB_UI_STRING("strong password auto fill", "Label for the strong password auto fill button inside a text field.");
     626}
     627
     628String AXAutoFillCreditCardLabel()
     629{
     630    return WEB_UI_STRING("credit card auto fill", "Label for the credit card auto fill button inside a text field.");
    626631}
    627632
  • trunk/Source/WebCore/platform/LocalizedStrings.h

    r237266 r237647  
    217217    String AXAutoFillContactsLabel();
    218218    String AXAutoFillStrongPasswordLabel();
     219    String AXAutoFillCreditCardLabel();
    219220    String autoFillStrongPasswordLabel();
    220221
  • trunk/Source/WebCore/testing/Internals.cpp

    r237597 r237647  
    17791779    case Internals::AutoFillButtonType::StrongPassword:
    17801780        return AutoFillButtonType::StrongPassword;
     1781    case Internals::AutoFillButtonType::CreditCard:
     1782        return AutoFillButtonType::CreditCard;
    17811783    }
    17821784    ASSERT_NOT_REACHED();
     
    17951797    case AutoFillButtonType::StrongPassword:
    17961798        return Internals::AutoFillButtonType::StrongPassword;
     1799    case AutoFillButtonType::CreditCard:
     1800        return Internals::AutoFillButtonType::CreditCard;
    17971801    }
    17981802    ASSERT_NOT_REACHED();
  • trunk/Source/WebCore/testing/Internals.h

    r237597 r237647  
    255255    void setEditingValue(HTMLInputElement&, const String&);
    256256    void setAutofilled(HTMLInputElement&, bool enabled);
    257     enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword };
     257    enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, CreditCard };
    258258    void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
    259259    AutoFillButtonType autoFillButtonType(const HTMLInputElement&);
  • trunk/Source/WebCore/testing/Internals.idl

    r237597 r237647  
    6363    "Contacts",
    6464    "Credentials",
    65     "StrongPassword"
     65    "StrongPassword",
     66    "CreditCard"
    6667};
    6768
  • trunk/Source/WebKit/ChangeLog

    r237639 r237647  
     12018-10-31  Zach Li  <zacharyli323@gmail.com>
     2
     3        Add credit card autofill button
     4        https://bugs.webkit.org/show_bug.cgi?id=191051
     5        <rdar://problem/45657011>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
     10        (toAutoFillButtonType):
     11        (toWKAutoFillButtonType):
     12        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
     13        Introduce a new button type for credit card autofill.
     14        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
     15        (toAutoFillButtonType):
     16        (toWKAutoFillButtonType):
     17        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
     18
    1192018-10-31  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm

    r237266 r237647  
    128128    case _WKAutoFillButtonTypeStrongPassword:
    129129        return WebCore::AutoFillButtonType::StrongPassword;
     130    case _WKAutoFillButtonTypeCreditCard:
     131        return WebCore::AutoFillButtonType::CreditCard;
    130132    }
    131133    ASSERT_NOT_REACHED();
     
    144146    case WebCore::AutoFillButtonType::StrongPassword:
    145147        return _WKAutoFillButtonTypeStrongPassword;
     148    case WebCore::AutoFillButtonType::CreditCard:
     149        return _WKAutoFillButtonTypeCreditCard;
    146150    }
    147151    ASSERT_NOT_REACHED();
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h

    r233578 r237647  
    3333    _WKAutoFillButtonTypeContacts,
    3434    _WKAutoFillButtonTypeStrongPassword,
     35    _WKAutoFillButtonTypeCreditCard WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
    3536} WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
    3637
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp

    r233578 r237647  
    4949    case kWKAutoFillButtonTypeStrongPassword:
    5050        return WebCore::AutoFillButtonType::StrongPassword;
     51    case kWKAutoFillButtonTypeCreditCard:
     52        return WebCore::AutoFillButtonType::CreditCard;
    5153    }
    5254    ASSERT_NOT_REACHED();
     
    6567    case WebCore::AutoFillButtonType::StrongPassword:
    6668        return kWKAutoFillButtonTypeStrongPassword;
     69    case WebCore::AutoFillButtonType::CreditCard:
     70        return kWKAutoFillButtonTypeCreditCard;
    6771    }
    6872    ASSERT_NOT_REACHED();
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h

    r233578 r237647  
    4141    kWKAutoFillButtonTypeContacts,
    4242    kWKAutoFillButtonTypeStrongPassword,
     43    kWKAutoFillButtonTypeCreditCard,
    4344};
    4445typedef uint8_t WKAutoFillButtonType;
Note: See TracChangeset for help on using the changeset viewer.