Add more auto fill button types
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 00:29:31 +0000 (00:29 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 00:29:31 +0000 (00:29 +0000)
commitac0f27ee01113e8c81893faf21e7a15d48e8f6c2
tree123077076852066538d3242efa6128bac97f9d29
parent3ef1c1fd397c5cc70e25dd17db3e08b44fa96e6b
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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@225879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
43 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html [new file with mode: 0644]
LayoutTests/platform/ios/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/CSSSelector.h
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorCheckerTestFunctions.h
Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
Source/WebCore/css/html.css
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.h
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/rendering/RenderTextControlSingleLine.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h