Allow clients to toggle a text input field between being viewable and having characte...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Aug 2019 17:24:19 +0000 (17:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Aug 2019 17:24:19 +0000 (17:24 +0000)
commita61575d30b068836246a5ca102c12901c62ff82e
tree4cb35ff46f3dd5612a73e0a8089e3f8d2bbbb77d
parentb794c4a8d2a329f827c3bf4e3a6b50480ff6ead0
Allow clients to toggle a text input field between being viewable and having characters hidden while maintaining
a yellow auto-filled appearance
https://bugs.webkit.org/show_bug.cgi?id=200037
rdar://problem/51900961

Patch by Priyanka Agarwal <pagarwal999@apple.com> on 2019-08-07
Reviewed by Daniel Bates.

Source/WebCore:

Tests: fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html
       fast/forms/auto-fill-button/input-strong-password-viewable.html

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
Adding CSSSelector case for new pseudo class of AutofillStrongPasswordViewable.

* css/CSSSelector.h: Added PseudoClassAutofillStrongPasswordViewable

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const): Added handling for SelectorChecker.cpp

* css/SelectorCheckerTestFunctions.h:
(WebCore::isAutofilledStrongPasswordViewable):
Checking if the element is an input element and considered to be
AutoFilled and Viewable. Returns a boolean accordingly.

* css/SelectorPseudoClassAndCompatibilityElementMap.in:
Add -webkit-autofill-strong-password-viewable css class.

* css/html.css:
(input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable):
(input:-webkit-autofill-strong-password-viewable):
(input:-webkit-autofill, input:-webkit-autofill-strong-password): Deleted. Updated to include viewable pseudo class.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
Add case handling for PseudoClassAutofillStrongPasswordViewable.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
Add boolean m_isAutoFilledAndViewable for representing if the
input element is both AutoFilled and should be viewable.
Don't update the viewable treatment in setValueFromRenderer() because even if the user makes edits to the input field
the visual treatment should still be applied.

(WebCore::HTMLInputElement::resignStrongPasswordAppearance):
Updates boolean representing if input element is autofilled and viewable to false.

(WebCore::HTMLInputElement::reset):
Updates boolean representing if input element is autofilled and viewable to false.

(WebCore::HTMLInputElement::setAutoFilledAndViewable):
Setter function for the boolean of m_isAutoFilledAndViewable.

* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::isAutoFilledAndViewable const):
Creating boolean value for m_isAutoFilledAndViewable.

* testing/Internals.cpp:
(WebCore::Internals::setAutoFilledAndViewable): Adding for testing purposes.
* testing/Internals.h: Adding for testing purposes.
* testing/Internals.idl:

Source/WebKit:

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilledAndViewable]):
Accessor function for boolean which represents if the input element is autofilled and viewable.

(-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilledAndViewable:]):
Setter function for boolean which represents if the input element is autofilled and viewable.

* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(WKBundleNodeHandleSetHTMLInputElementAutoFilledAndViewable):
Accessor function for boolean which represents if the input element is autofilled and viewable.

       * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
Creating function declaration for boolean setter.

* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
Accessor function for boolean which represents if the input element is autofilled and viewable.

(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndViewable const):
Setter function for boolean which represents if the input element is autofilled and viewable.

(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndViewable):
Setter function for boolean which represents if the input element is autofilled and viewable.

* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
Adding setter and getter functions for the boolean which represents if the input element is autofilled
and viewable.

Source/WebKitLegacy/mac:

* DOM/WebDOMOperations.mm:
(-[DOMHTMLInputElement _isAutoFilledAndViewable]):
(-[DOMHTMLInputElement _setAutoFilledAndViewable:]):
* DOM/WebDOMOperationsPrivate.h:

LayoutTests:

* fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html: Added.
Test for when the form is reset to no longer be autofilled.

* fast/forms/auto-fill-button/input-strong-password-viewable.html: Added.
Test for when the form is set to being autofilled and viewable.

* fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js:
(window.onload): Javascript used by test to set the element to be autofilled and viewable added

* platform/mac/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.txt: Added.
* platform/mac/fast/forms/auto-fill-button/input-strong-password-viewable-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-strong-password-viewable.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-strong-password-viewable-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/input-strong-password-viewable-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/auto-fill-button/input-strong-password-viewable-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
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/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h
Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm
Source/WebKitLegacy/mac/DOM/WebDOMOperationsPrivate.h