Changeset 225879 in webkit


Ignore:
Timestamp:
Dec 13, 2017 4:29:31 PM (6 years ago)
Author:
dbates@webkit.org
Message:

Add more auto fill button types
https://bugs.webkit.org/show_bug.cgi?id=180651
<rdar://problem/35891125>
And
<rdar://problem/35977943>

Reviewed by Brent Fulgham.

Source/WebCore:

Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html

fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html

  • English.lproj/Localizable.strings:
  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.

  • css/CSSSelector.cpp:

(WebCore::CSSSelector::selectorText const):

  • css/CSSSelector.h:
  • css/SelectorChecker.cpp:

(WebCore::SelectorChecker::checkOne const):

  • css/SelectorCheckerTestFunctions.h:

(WebCore::isAutofilledStrongPassword):

  • css/SelectorPseudoClassAndCompatibilityElementMap.in:
  • css/html.css:

(input::-webkit-strong-password-auto-fill-button):
(input:-webkit-autofill-strong-password):
(input:-webkit-autofill, input:-webkit-autofill-strong-password):
(input:-webkit-autofill): Deleted.

  • cssjit/SelectorCompiler.cpp:

(WebCore::SelectorCompiler::addPseudoClassType):
Add new CSS pseudo class and CSS styles.

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
whenever we suspend the page to put it into the page cache.
(WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.

(WebCore::autoFillStrongPasswordMaskImage):
(WebCore::HTMLInputElement::createInnerTextStyle):
(WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
Adjust the look of the inner text field. This function is not const because we may need to resolve style to
generate a mask image.

  • html/HTMLInputElement.h:

(WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
this area.
(WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::createInnerTextStyle):
(WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.

  • html/HTMLTextAreaElement.h:
  • html/HTMLTextFormControlElement.cpp:

(WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
(WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.

  • html/HTMLTextFormControlElement.h:
  • html/TextFieldInputType.cpp:

(WebCore::autoFillButtonTypeToAccessibilityLabel):
(WebCore::autoFillButtonTypeToAutoFillButtonText):
(WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
(WebCore::isAutoFillButtonTypeChanged):
(WebCore::TextFieldInputType::createAutoFillButton):
(WebCore::TextFieldInputType::updateAutoFillButton):
Support having text for the auto fill button.

  • platform/LocalizedStrings.cpp:

(WebCore::AXAutoFillStrongPasswordLabel):
(WebCore::AXAutoFillStrongConfirmationPasswordLabel):
(WebCore::autoFillStrongPasswordLabel):

  • platform/LocalizedStrings.h:

Add localized strings.

  • rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
  • testing/Internals.cpp:

(WebCore::toAutoFillButtonType):

  • testing/Internals.h:
  • testing/Internals.idl:

Add support for testing.

Source/WebKit:

Adds enumerators for the new auto fill button types.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:

(toAutoFillButtonType):

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
  • WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:

(toAutoFillButtonType):

  • WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:

LayoutTests:

  • fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button-expected.html: Added.
  • fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html: Added.
  • fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button-expected.html: Added.
  • fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html: Added.
  • fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added.
  • fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added.
  • fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added.
  • fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added.
  • fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html: Added.
  • fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html: Added.
  • platform/ios/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added.
  • platform/ios/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added.
  • platform/mac/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added.
  • platform/mac/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added.
Location:
trunk
Files:
14 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225872 r225879  
     12017-12-13  Daniel Bates  <dabates@apple.com>
     2
     3        Add more auto fill button types
     4        https://bugs.webkit.org/show_bug.cgi?id=180651
     5        <rdar://problem/35891125>
     6        And
     7        <rdar://problem/35977943>
     8
     9        Reviewed by Brent Fulgham.
     10
     11        * fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button-expected.html: Added.
     12        * fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html: Added.
     13        * fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button-expected.html: Added.
     14        * fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html: Added.
     15        * fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added.
     16        * fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added.
     17        * fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added.
     18        * fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added.
     19        * fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html: Added.
     20        * fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html: Added.
     21        * platform/ios/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added.
     22        * platform/ios/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added.
     23        * platform/mac/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added.
     24        * platform/mac/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added.
     25
    1262017-12-13  Zalan Bujtas  <zalan@apple.com>
    227
  • trunk/Source/WebCore/ChangeLog

    r225878 r225879  
     12017-12-13  Daniel Bates  <dabates@apple.com>
     2
     3        Add more auto fill button types
     4        https://bugs.webkit.org/show_bug.cgi?id=180651
     5        <rdar://problem/35891125>
     6        And
     7        <rdar://problem/35977943>
     8
     9        Reviewed by Brent Fulgham.
     10
     11        Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
     12               fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
     13               fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
     14               fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
     15               fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
     16               fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
     17
     18        * English.lproj/Localizable.strings:
     19        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     20        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
     21
     22        * css/CSSSelector.cpp:
     23        (WebCore::CSSSelector::selectorText const):
     24        * css/CSSSelector.h:
     25        * css/SelectorChecker.cpp:
     26        (WebCore::SelectorChecker::checkOne const):
     27        * css/SelectorCheckerTestFunctions.h:
     28        (WebCore::isAutofilledStrongPassword):
     29        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
     30        * css/html.css:
     31        (input::-webkit-strong-password-auto-fill-button):
     32        (input:-webkit-autofill-strong-password):
     33        (input:-webkit-autofill, input:-webkit-autofill-strong-password):
     34        (input:-webkit-autofill): Deleted.
     35        * cssjit/SelectorCompiler.cpp:
     36        (WebCore::SelectorCompiler::addPseudoClassType):
     37        Add new CSS pseudo class and CSS styles.
     38
     39        * html/HTMLInputElement.cpp:
     40        (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
     41        whenever we suspend the page to put it into the page cache.
     42        (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
     43        and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
     44
     45        (WebCore::autoFillStrongPasswordMaskImage):
     46        (WebCore::HTMLInputElement::createInnerTextStyle):
     47        (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
     48        Adjust the look of the inner text field. This function is not const because we may need to resolve style to
     49        generate a mask image.
     50
     51        * html/HTMLInputElement.h:
     52        (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
     53        this area.
     54        (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
     55
     56        * html/HTMLTextAreaElement.cpp:
     57        (WebCore::HTMLTextAreaElement::createInnerTextStyle):
     58        (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
     59        Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
     60
     61        * html/HTMLTextAreaElement.h:
     62        * html/HTMLTextFormControlElement.cpp:
     63        (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
     64        (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
     65        Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
     66        and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
     67        or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
     68
     69        * html/HTMLTextFormControlElement.h:
     70        * html/TextFieldInputType.cpp:
     71        (WebCore::autoFillButtonTypeToAccessibilityLabel):
     72        (WebCore::autoFillButtonTypeToAutoFillButtonText):
     73        (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
     74        (WebCore::isAutoFillButtonTypeChanged):
     75        (WebCore::TextFieldInputType::createAutoFillButton):
     76        (WebCore::TextFieldInputType::updateAutoFillButton):
     77        Support having text for the auto fill button.
     78
     79        * platform/LocalizedStrings.cpp:
     80        (WebCore::AXAutoFillStrongPasswordLabel):
     81        (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
     82        (WebCore::autoFillStrongPasswordLabel):
     83        * platform/LocalizedStrings.h:
     84        Add localized strings.
     85
     86        * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
     87
     88        * testing/Internals.cpp:
     89        (WebCore::toAutoFillButtonType):
     90        * testing/Internals.h:
     91        * testing/Internals.idl:
     92        Add support for testing.
     93
    1942017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
    295
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r225223 r225879  
    12551255/* Alternative presentation button subtitle. */
    12561256"alternative presentation button subtitle" = "alternative presentation button subtitle";
     1257
     1258/* Label for strong password. */
     1259"strong password" = "strong password";
     1260
     1261/* Label for the auto fill strong password button inside a text field. */
     1262"strong password auto fill" = "strong password auto fill";
     1263
     1264/* Label for the auto fill strong confirmation password button inside a text field. */
     1265"strong confirmation password auto fill" = "strong confirmation password auto fill";
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r225511 r225879  
    30853085        case AutoFillButtonType::Contacts:
    30863086            return @"contacts";
     3087        case AutoFillButtonType::StrongConfirmationPassword:
     3088            return @"strong confirmation password";
     3089        case AutoFillButtonType::StrongPassword:
     3090            return @"strong password";
    30873091        }
    30883092    }
  • trunk/Source/WebCore/css/CSSSelector.cpp

    r223728 r225879  
    435435                str.appendLiteral(":-webkit-autofill");
    436436                break;
     437            case CSSSelector::PseudoClassAutofillStrongPassword:
     438                str.appendLiteral(":-webkit-autofill-strong-password");
     439                break;
    437440            case CSSSelector::PseudoClassDrag:
    438441                str.appendLiteral(":-webkit-drag");
  • trunk/Source/WebCore/css/CSSSelector.h

    r221788 r225879  
    108108            PseudoClassAnyLinkDeprecated,
    109109            PseudoClassAutofill,
     110            PseudoClassAutofillStrongPassword,
    110111            PseudoClassHover,
    111112            PseudoClassDrag,
  • trunk/Source/WebCore/css/SelectorChecker.cpp

    r221788 r225879  
    943943        case CSSSelector::PseudoClassAutofill:
    944944            return isAutofilled(element);
     945        case CSSSelector::PseudoClassAutofillStrongPassword:
     946            return isAutofilledStrongPassword(element);
    945947        case CSSSelector::PseudoClassAnyLink:
    946948        case CSSSelector::PseudoClassAnyLinkDeprecated:
  • trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h

    r208668 r225879  
    4646}
    4747
     48ALWAYS_INLINE bool isAutofilledStrongPassword(const Element& element)
     49{
     50    return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isAutoFilled() && downcast<HTMLInputElement>(element).hasAutoFillStrongPasswordButton();
     51}
     52
    4853ALWAYS_INLINE bool matchesDefaultPseudoClass(const Element& element)
    4954{
  • trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in

    r209670 r225879  
    33-webkit-any-link, PseudoClassAnyLinkDeprecated, PseudoElementUnknown
    44-webkit-autofill
     5-webkit-autofill-strong-password
    56-webkit-drag
    67-webkit-full-page-media
  • trunk/Source/WebCore/css/html.css

    r217418 r225879  
    543543}
    544544
     545input::-webkit-strong-password-auto-fill-button {
     546    flex: none !important;
     547    font-family: -apple-system !important;
     548    -webkit-text-security: none !important;
     549    -webkit-user-select: none !important;
     550    pointer-events: none !important;
     551    text-align: right !important;
     552    color: black !important;
     553    padding-left: 6px !important;
     554}
     555
    545556input::-webkit-credentials-auto-fill-button {
    546557    -webkit-mask-image: -webkit-image-set(url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAMCAYAAAC9QufkAAAAAXNSR0IB2cksfwAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAADyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS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kOFL79xJXfQhwlQTjsnu61r+2fEs/b4ZbzrEPMzEAAAAASUVORK5CYII=") 2x);
     
    647658}
    648659
    649 input:-webkit-autofill {
     660input:-webkit-autofill-strong-password {
     661    -webkit-text-security: none !important;
     662    -webkit-user-select: none !important;
     663    cursor: default !important;
     664    font-family: monospace;
     665}
     666
     667input:-webkit-autofill, input:-webkit-autofill-strong-password {
    650668#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
    651669    background-color: #F7EC87 !important;
  • trunk/Source/WebCore/cssjit/SelectorCompiler.cpp

    r225837 r225879  
    532532    case CSSSelector::PseudoClassAutofill:
    533533        fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isAutofilled));
     534        return FunctionType::SimpleSelectorChecker;
     535    case CSSSelector::PseudoClassAutofillStrongPassword:
     536        fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isAutofilledStrongPassword));
    534537        return FunctionType::SimpleSelectorChecker;
    535538    case CSSSelector::PseudoClassChecked:
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r225878 r225879  
    3232#include "AXObjectCache.h"
    3333#include "BeforeTextInsertedEvent.h"
     34#include "CSSGradientValue.h"
    3435#include "CSSPropertyNames.h"
     36#include "CSSValuePool.h"
    3537#include "DateTimeChooser.h"
    3638#include "Document.h"
     
    918920
    919921    setAutoFilled(false);
     922    setShowAutoFillButton(AutoFillButtonType::None);
    920923    setChecked(hasAttributeWithoutSynchronization(checkedAttr));
    921924    m_reflectsCheckedAttribute = true;
     
    13761379    m_autoFillButtonType = static_cast<uint8_t>(autoFillButtonType);
    13771380    m_inputType->updateAutoFillButton();
     1381    updateInnerTextElementEditability();
     1382    invalidateStyleForSubtree();
    13781383}
    13791384
     
    20402045}
    20412046
    2042 RenderStyle HTMLInputElement::createInnerTextStyle(const RenderStyle& style) const
     2047static Ref<CSSLinearGradientValue> autoFillStrongPasswordMaskImage()
     2048{
     2049    CSSGradientColorStop firstStop;
     2050    firstStop.m_color = CSSValuePool::singleton().createColorValue(Color::black);
     2051    firstStop.m_position = CSSValuePool::singleton().createValue(3, CSSPrimitiveValue::UnitType::CSS_EMS);
     2052
     2053    CSSGradientColorStop secondStop;
     2054    secondStop.m_color = CSSValuePool::singleton().createColorValue(Color::transparent);
     2055    secondStop.m_position = CSSValuePool::singleton().createValue(7, CSSPrimitiveValue::UnitType::CSS_EMS);
     2056
     2057    auto gradient = CSSLinearGradientValue::create(CSSGradientRepeat::NonRepeating, CSSGradientType::CSSLinearGradient);
     2058    gradient->setAngle(CSSValuePool::singleton().createValue(90, CSSPrimitiveValue::UnitType::CSS_DEG));
     2059    gradient->addStop(firstStop);
     2060    gradient->addStop(secondStop);
     2061    return gradient;
     2062}
     2063
     2064RenderStyle HTMLInputElement::createInnerTextStyle(const RenderStyle& style)
    20432065{
    20442066    auto textBlockStyle = RenderStyle::create();
     
    20522074    textBlockStyle.setTextOverflow(shouldTruncateText(style) ? TextOverflowEllipsis : TextOverflowClip);
    20532075
     2076    textBlockStyle.setDisplay(BLOCK);
     2077
     2078    if (hasAutoFillStrongPasswordButton()) {
     2079        textBlockStyle.setColor({ 0.0f, 0.0f, 0.0f, 0.6f });
     2080        textBlockStyle.setTextOverflow(TextOverflowClip);
     2081        textBlockStyle.setMaskImage(styleResolver().styleImage(autoFillStrongPasswordMaskImage()));
     2082        // A stacking context is needed for the mask.
     2083        if (textBlockStyle.hasAutoZIndex())
     2084            textBlockStyle.setZIndex(0);
     2085    }
     2086
    20542087    // Do not allow line-height to be smaller than our default.
    20552088    if (textBlockStyle.fontMetrics().lineSpacing() > style.computedLineHeight())
    20562089        textBlockStyle.setLineHeight(RenderStyle::initialLineHeight());
    2057 
    2058     textBlockStyle.setDisplay(BLOCK);
    20592090
    20602091    return textBlockStyle;
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r225837 r225879  
    136136   
    137137    RefPtr<TextControlInnerTextElement> innerTextElement() const final;
    138     RenderStyle createInnerTextStyle(const RenderStyle&) const override;
     138    RenderStyle createInnerTextStyle(const RenderStyle&) override;
    139139
    140140    HTMLElement* innerBlockElement() const;
     
    245245    WEBCORE_EXPORT void setAutoFilled(bool = true);
    246246
    247     AutoFillButtonType autoFillButtonType() const { return (AutoFillButtonType)m_autoFillButtonType; }
     247    AutoFillButtonType autoFillButtonType() const { return static_cast<AutoFillButtonType>(m_autoFillButtonType); }
    248248    WEBCORE_EXPORT void setShowAutoFillButton(AutoFillButtonType);
     249
     250    bool hasAutoFillStrongPasswordButton() const  { return autoFillButtonType() == AutoFillButtonType::StrongPassword || autoFillButtonType() == AutoFillButtonType::StrongConfirmationPassword; }
    249251
    250252    bool isAutoFillAvailable() const { return m_isAutoFillAvailable; }
     
    371373    void updateFocusAppearance(SelectionRestorationMode, SelectionRevealMode) final;
    372374    bool shouldUseInputMethod() final;
     375
     376    bool isInnerTextElementEditable() const final { return !hasAutoFillStrongPasswordButton() && HTMLTextFormControlElement::isInnerTextElementEditable(); }
    373377
    374378    bool canTriggerImplicitSubmission() const final { return isTextField(); }
     
    459463    unsigned m_autocomplete : 2; // AutoCompleteSetting
    460464    bool m_isAutoFilled : 1;
    461     unsigned m_autoFillButtonType : 2; // AutoFillButtonType;
     465    unsigned m_autoFillButtonType : 3; // AutoFillButtonType;
    462466    bool m_isAutoFillAvailable : 1;
    463467#if ENABLE(DATALIST_ELEMENT)
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r225499 r225879  
    547547}
    548548
    549 RenderStyle HTMLTextAreaElement::createInnerTextStyle(const RenderStyle& style) const
     549RenderStyle HTMLTextAreaElement::createInnerTextStyle(const RenderStyle& style)
    550550{
    551551    auto textBlockStyle = RenderStyle::create();
  • trunk/Source/WebCore/html/HTMLTextAreaElement.h

    r225837 r225879  
    5555   
    5656    RefPtr<TextControlInnerTextElement> innerTextElement() const final;
    57     RenderStyle createInnerTextStyle(const RenderStyle&) const final;
     57    RenderStyle createInnerTextStyle(const RenderStyle&) final;
    5858    void copyNonAttributePropertiesFromElement(const Element&) final;
    5959
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp

    r225855 r225879  
    512512}
    513513
     514bool HTMLTextFormControlElement::isInnerTextElementEditable() const
     515{
     516    return !isDisabledOrReadOnly();
     517}
     518
    514519void HTMLTextFormControlElement::updateInnerTextElementEditability()
    515520{
    516     if (auto innerText = innerTextElement())
    517         innerText->setAttributeWithoutSynchronization(contenteditableAttr, isDisabledOrReadOnly() ? "false" : "plaintext-only");
     521    if (auto innerText = innerTextElement()) {
     522        auto value = isInnerTextElementEditable() ? AtomicString { "plaintext-only", AtomicString::ConstructFromLiteral } : AtomicString { "false", AtomicString::ConstructFromLiteral };
     523        innerText->setAttributeWithoutSynchronization(contenteditableAttr, value);
     524    }
    518525}
    519526
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.h

    r225837 r225879  
    3434class VisiblePosition;
    3535
    36 enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts };
     36enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongConfirmationPassword, StrongPassword };
    3737enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardDirection, SelectionHasBackwardDirection };
    3838enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInputAndChangeEvent };
     
    8383
    8484    virtual RefPtr<TextControlInnerTextElement> innerTextElement() const = 0;
    85     virtual RenderStyle createInnerTextStyle(const RenderStyle&) const = 0;
     85    virtual RenderStyle createInnerTextStyle(const RenderStyle&) = 0;
    8686
    8787    void selectionChanged(bool shouldFireSelectEvent);
     
    107107    void disabledStateChanged() override;
    108108    void readOnlyAttributeChanged() override;
     109    virtual bool isInnerTextElementEditable() const;
    109110    void updateInnerTextElementEditability();
    110111
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r224260 r225879  
    407407    case AutoFillButtonType::Credentials:
    408408        return AXAutoFillCredentialsLabel();
    409     default:
     409    case AutoFillButtonType::StrongConfirmationPassword:
     410        return AXAutoFillStrongConfirmationPasswordLabel();
     411    case AutoFillButtonType::StrongPassword:
     412        return AXAutoFillStrongPasswordLabel();
    410413    case AutoFillButtonType::None:
    411414        ASSERT_NOT_REACHED();
    412         return String();
    413     }
    414 }
    415    
    416 static AtomicString autoFillButtonTypeToAutoFillButtonPseudoClassName(AutoFillButtonType autoFillButtonType)
    417 {
    418     AtomicString pseudoClassName;
     415        return { };
     416    }
     417}
     418
     419static String autoFillButtonTypeToAutoFillButtonText(AutoFillButtonType autoFillButtonType)
     420{
    419421    switch (autoFillButtonType) {
    420422    case AutoFillButtonType::Contacts:
    421         pseudoClassName = AtomicString("-webkit-contacts-auto-fill-button", AtomicString::ConstructFromLiteral);
    422         break;
    423423    case AutoFillButtonType::Credentials:
    424         pseudoClassName = AtomicString("-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral);
    425         break;
     424    case AutoFillButtonType::StrongConfirmationPassword:
     425        return emptyString();
     426    case AutoFillButtonType::StrongPassword:
     427        return autoFillStrongPasswordLabel();
    426428    case AutoFillButtonType::None:
    427429        ASSERT_NOT_REACHED();
    428         break;
    429     }
    430 
    431     return pseudoClassName;
     430        return { };
     431    }
     432}
     433
     434static AtomicString autoFillButtonTypeToAutoFillButtonPseudoClassName(AutoFillButtonType autoFillButtonType)
     435{
     436    switch (autoFillButtonType) {
     437    case AutoFillButtonType::Contacts:
     438        return { "-webkit-contacts-auto-fill-button", AtomicString::ConstructFromLiteral };
     439    case AutoFillButtonType::Credentials:
     440        return { "-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral };
     441    case AutoFillButtonType::StrongConfirmationPassword:
     442        return { "-webkit-strong-confirmation-password-auto-fill-button", AtomicString::ConstructFromLiteral };
     443    case AutoFillButtonType::StrongPassword:
     444        return { "-webkit-strong-password-auto-fill-button", AtomicString::ConstructFromLiteral };
     445    case AutoFillButtonType::None:
     446        ASSERT_NOT_REACHED();
     447        return emptyAtom();
     448    }
    432449}
    433450
     
    436453    if (attribute == "-webkit-contacts-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Contacts)
    437454        return true;
    438 
    439455    if (attribute == "-webkit-credentials-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Credentials)
    440456        return true;
    441 
     457    if (attribute == "-webkit-strong-confirmation-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongConfirmationPassword)
     458        return true;
     459    if (attribute == "-webkit-strong-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongPassword)
     460        return true;
    442461    return false;
    443462}
     
    664683    m_autoFillButton->setAttributeWithoutSynchronization(roleAttr, AtomicString("button", AtomicString::ConstructFromLiteral));
    665684    m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType));
     685    m_autoFillButton->setTextContent(autoFillButtonTypeToAutoFillButtonText(autoFillButtonType));
    666686    m_container->appendChild(*m_autoFillButton);
    667687}
     
    673693            createContainer();
    674694
     695        AutoFillButtonType autoFillButtonType = element().autoFillButtonType();
    675696        if (!m_autoFillButton)
    676             createAutoFillButton(element().autoFillButtonType());
     697            createAutoFillButton(autoFillButtonType);
    677698
    678699        const AtomicString& attribute = m_autoFillButton->attributeWithoutSynchronization(pseudoAttr);
    679         bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, element().autoFillButtonType());
     700        bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, autoFillButtonType);
    680701        if (shouldUpdateAutoFillButtonType) {
    681             m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));
    682             m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(element().autoFillButtonType()));
     702            m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType));
     703            m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType));
     704            m_autoFillButton->setTextContent(autoFillButtonTypeToAutoFillButtonText(autoFillButtonType));
    683705        }
    684706        m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true);
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r225223 r225879  
    639639{
    640640    return WEB_UI_STRING("alternative presentation button subtitle", "Subtitle text for alternative presentation button");
     641}
     642
     643String AXAutoFillStrongPasswordLabel()
     644{
     645    return WEB_UI_STRING("strong password auto fill", "Label for the strong password auto fill button inside a text field.");
     646}
     647
     648String AXAutoFillStrongConfirmationPasswordLabel()
     649{
     650    return WEB_UI_STRING("strong confirmation password auto fill", "Label for the strong confirmation password auto fill button inside a text field.");
     651}
     652
     653String autoFillStrongPasswordLabel()
     654{
     655    return WEB_UI_STRING("strong password", "Label for strong password.");
    641656}
    642657
  • trunk/Source/WebCore/platform/LocalizedStrings.h

    r225223 r225879  
    216216    String AXAutoFillCredentialsLabel();
    217217    String AXAutoFillContactsLabel();
     218    String AXAutoFillStrongPasswordLabel();
     219    String AXAutoFillStrongConfirmationPasswordLabel();
     220    String autoFillStrongPasswordLabel();
    218221
    219222    String missingPluginText();
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h

    r224537 r225879  
    9696    bool hasLineIfEmpty() const override { return true; }
    9797    bool isTextControlInnerBlock() const override { return true; }
    98     bool canBeProgramaticallyScrolled() const override { return true; }
     98    bool canBeProgramaticallyScrolled() const override
     99    {
     100        auto* shadowHost = element()->shadowHost();
     101        if (is<HTMLInputElement>(shadowHost))
     102            return !downcast<HTMLInputElement>(*shadowHost).hasAutoFillStrongPasswordButton();
     103        return true;
     104    }
    99105};
    100106
  • trunk/Source/WebCore/testing/Internals.cpp

    r225707 r225879  
    16641664    case Internals::AutoFillButtonType::Contacts:
    16651665        return AutoFillButtonType::Contacts;
     1666    case Internals::AutoFillButtonType::StrongPassword:
     1667        return AutoFillButtonType::StrongPassword;
     1668    case Internals::AutoFillButtonType::StrongConfirmationPassword:
     1669        return AutoFillButtonType::StrongConfirmationPassword;
    16661670    }
    16671671    ASSERT_NOT_REACHED();
  • trunk/Source/WebCore/testing/Internals.h

    r225707 r225879  
    235235    void setEditingValue(HTMLInputElement&, const String&);
    236236    void setAutofilled(HTMLInputElement&, bool enabled);
    237     enum class AutoFillButtonType { None, Contacts, Credentials };
     237    enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, StrongConfirmationPassword };
    238238    void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
    239239    ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h);
  • trunk/Source/WebCore/testing/Internals.idl

    r225707 r225879  
    6262    "None",
    6363    "Contacts",
    64     "Credentials"
     64    "Credentials",
     65    "StrongPassword",
     66    "StrongConfirmationPassword"
    6567};
    6668
  • trunk/Source/WebKit/ChangeLog

    r225877 r225879  
     12017-12-13  Daniel Bates  <dabates@apple.com>
     2
     3        Add more auto fill button types
     4        https://bugs.webkit.org/show_bug.cgi?id=180651
     5        <rdar://problem/35891125>
     6        And
     7        <rdar://problem/35977943>
     8
     9        Reviewed by Brent Fulgham.
     10
     11        Adds enumerators for the new auto fill button types.
     12
     13        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
     14        (toAutoFillButtonType):
     15        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
     16        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
     17        (toAutoFillButtonType):
     18        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
     19
    1202017-12-13  Matt Lewis  <jlewis3@apple.com>
    221
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm

    r225833 r225879  
    136136    case _WKAutoFillButtonTypeCredentials:
    137137        return WebCore::AutoFillButtonType::Credentials;
     138    case _WKAutoFillButtonTypeStrongConfirmationPassword:
     139        return WebCore::AutoFillButtonType::StrongConfirmationPassword;
     140    case _WKAutoFillButtonTypeStrongPassword:
     141        return WebCore::AutoFillButtonType::StrongPassword;
    138142    }
    139143    ASSERT_NOT_REACHED();
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h

    r225833 r225879  
    3232    _WKAutoFillButtonTypeCredentials,
    3333    _WKAutoFillButtonTypeContacts,
     34    _WKAutoFillButtonTypeStrongConfirmationPassword,
     35    _WKAutoFillButtonTypeStrongPassword,
    3436} WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    3537
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp

    r222013 r225879  
    4747    case kWKAutoFillButtonTypeCredentials:
    4848        return WebCore::AutoFillButtonType::Credentials;
     49    case kWKAutoFillButtonTypeStrongConfirmationPassword:
     50        return WebCore::AutoFillButtonType::StrongConfirmationPassword;
     51    case kWKAutoFillButtonTypeStrongPassword:
     52        return WebCore::AutoFillButtonType::StrongPassword;
    4953    }
    5054    ASSERT_NOT_REACHED();
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h

    r222013 r225879  
    3939    kWKAutoFillButtonTypeNone,
    4040    kWKAutoFillButtonTypeCredentials,
    41     kWKAutoFillButtonTypeContacts
     41    kWKAutoFillButtonTypeContacts,
     42    kWKAutoFillButtonTypeStrongPassword,
     43    kWKAutoFillButtonTypeStrongConfirmationPassword,
    4244};
    4345typedef uint8_t WKAutoFillButtonType;
Note: See TracChangeset for help on using the changeset viewer.