Title: [285610] trunk
Revision
285610
Author
[email protected]
Date
2021-11-10 16:14:36 -0800 (Wed, 10 Nov 2021)

Log Message

Add support for marking an `<input>` as being autofilled with obscured content
https://bugs.webkit.org/show_bug.cgi?id=232903
<rdar://problem/84276999>

Reviewed by Aditya Keerthi.

Source/WebCore:

Test: fast/forms/auto-fill-button/input-auto-filled-and-obscured.html

* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::isAutoFilledAndObscured const): Added.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::reset):
(WebCore::HTMLInputElement::setAutoFilledAndObscured): Added.
Add a new boolean state member that is used by injected bundle code (and tests).

* css/CSSSelector.h:
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* css/SelectorCheckerTestFunctions.h:
(WebCore::isAutofilledAndObscured): Added.
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::JSC_DEFINE_JIT_OPERATION):
(WebCore::SelectorCompiler::addPseudoClassType):
Create a new `-webkit-autofill-and-obscured` pseudo-class.

* css/html.css:
(input:-webkit-autofill-and-obscured): Added.
(input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable, input:-webkit-autofill-and-obscured): Renamed from `input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable`.
Use `-webkit-autofill-and-obscured` to change the `<input>` text into non-interactable discs.

* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::setAutoFilledAndObscured): Added.

Source/WebKit:

* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndObscured const): Added.
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndObscured): Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilledAndObscured]): Added.
(-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilledAndObscured:]): Added.
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(WKBundleNodeHandleSetHTMLInputElementAutoFilledAndObscured): Added.
Expose a way to get/set the CSS `-webkit-autofill-and-obscured` pseudo-class on an `<input>`.

LayoutTests:

* fast/forms/auto-fill-button/input-auto-filled-and-obscured.html: Added.
* fast/forms/auto-fill-button/input-auto-filled-and-obscured-expected.html: Added.

* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285609 => 285610)


--- trunk/LayoutTests/ChangeLog	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/LayoutTests/ChangeLog	2021-11-11 00:14:36 UTC (rev 285610)
@@ -1,3 +1,16 @@
+2021-11-10  Devin Rousso  <[email protected]>
+
+        Add support for marking an `<input>` as being autofilled with obscured content
+        https://bugs.webkit.org/show_bug.cgi?id=232903
+        <rdar://problem/84276999>
+
+        Reviewed by Aditya Keerthi.
+
+        * fast/forms/auto-fill-button/input-auto-filled-and-obscured.html: Added.
+        * fast/forms/auto-fill-button/input-auto-filled-and-obscured-expected.html: Added.
+
+        * platform/win/TestExpectations:
+
 2021-11-10  Wenson Hsieh  <[email protected]>
 
         Refactor some image overlay logic to work with built-in media controls

Added: trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured-expected.html (0 => 285610)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured-expected.html	2021-11-11 00:14:36 UTC (rev 285610)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the Obscured AutoFill and viewable visual treatment renders in an auto-filled input. It can only be tested in the test tool.</p>
+<div id="container">
+    <input value="1234567890" style="-webkit-text-security: disc; background-color: #FAFFBD">
+    <input value="1234567890" style="-webkit-text-security: disc; background-color: #FAFFBD">
+    <input value="1234567890" style="width: 300px; -webkit-text-security: disc; background-color: #FAFFBD">
+    <input value="1234567890" style="width: 20px; -webkit-text-security: disc; background-color: #FAFFBD">
+    <input value="1234567890" style="height: 100px; -webkit-text-security: disc; background-color: #FAFFBD">
+    <input value="1234567890" style="width: 20px; height:100px; -webkit-text-security: disc; background-color: #FAFFBD">
+    <input style="background-color: #FAFFBD">
+</div>
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured.html (0 => 285610)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-auto-filled-and-obscured.html	2021-11-11 00:14:36 UTC (rev 285610)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the Obscured AutoFill and viewable visual treatment renders in an auto-filled input. It can only be tested in the test tool.</p>
+<div id="container">
+    <input value="1234567890">
+    <input value="1234567890">
+    <input value="1234567890" style="width: 300px">
+    <input value="1234567890" style="width: 20px">
+    <input value="1234567890" style="height: 100px">
+    <input value="1234567890" style="width: 20px; height: 100px">
+</div>
+<script>
+if (window.internals) {
+    var inputs = document.querySelectorAll("input");
+    for (var i = 0; i < inputs.length; ++i) {
+        window.internals.setAutoFilledAndObscured(inputs[i], true);
+    }
+
+    var dynamicInput = document.createElement("input");
+    window.internals.setAutoFilledAndObscured(dynamicInput, true);
+    document.querySelector("#container").appendChild(dynamicInput);
+}
+</script>
+</body>
+</html>
+

Modified: trunk/LayoutTests/platform/win/TestExpectations (285609 => 285610)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-11-11 00:14:36 UTC (rev 285610)
@@ -3895,6 +3895,7 @@
 webkit.org/b/181662 fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html [ Failure ]
 webkit.org/b/200037 fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html [ Missing Failure ]
 webkit.org/b/200037 fast/forms/auto-fill-button/input-strong-password-viewable.html [ Missing Failure ]
+webkit.org/b/232967 fast/forms/auto-fill-button/input-auto-filled-and-obscured.html [ Missing Failure ]
 
 webkit.org/b/181854 svg/filters/feDiffuseLighting-bottomRightPixel.html [ ImageOnlyFailure ]
 

Modified: trunk/Source/WebCore/ChangeLog (285609 => 285610)


--- trunk/Source/WebCore/ChangeLog	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/ChangeLog	2021-11-11 00:14:36 UTC (rev 285610)
@@ -1,3 +1,44 @@
+2021-11-10  Devin Rousso  <[email protected]>
+
+        Add support for marking an `<input>` as being autofilled with obscured content
+        https://bugs.webkit.org/show_bug.cgi?id=232903
+        <rdar://problem/84276999>
+
+        Reviewed by Aditya Keerthi.
+
+        Test: fast/forms/auto-fill-button/input-auto-filled-and-obscured.html
+
+        * html/HTMLInputElement.h:
+        (WebCore::HTMLInputElement::isAutoFilledAndObscured const): Added.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::HTMLInputElement):
+        (WebCore::HTMLInputElement::reset):
+        (WebCore::HTMLInputElement::setAutoFilledAndObscured): Added.
+        Add a new boolean state member that is used by injected bundle code (and tests).
+
+        * css/CSSSelector.h:
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::selectorText const):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne const):
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::isAutofilledAndObscured): Added.
+        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::JSC_DEFINE_JIT_OPERATION):
+        (WebCore::SelectorCompiler::addPseudoClassType):
+        Create a new `-webkit-autofill-and-obscured` pseudo-class.
+
+        * css/html.css:
+        (input:-webkit-autofill-and-obscured): Added.
+        (input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable, input:-webkit-autofill-and-obscured): Renamed from `input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable`.
+        Use `-webkit-autofill-and-obscured` to change the `<input>` text into non-interactable discs.
+
+        * testing/Internals.idl:
+        * testing/Internals.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setAutoFilledAndObscured): Added.
+
 2021-11-10  Wenson Hsieh  <[email protected]>
 
         Refactor some image overlay logic to work with built-in media controls

Modified: trunk/Source/WebCore/css/CSSSelector.cpp (285609 => 285610)


--- trunk/Source/WebCore/css/CSSSelector.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/CSSSelector.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -422,6 +422,9 @@
             case CSSSelector::PseudoClassAutofill:
                 builder.append(":autofill");
                 break;
+            case CSSSelector::PseudoClassAutofillAndObscured:
+                builder.append(":-webkit-autofill-and-obscured");
+                break;
             case CSSSelector::PseudoClassAutofillStrongPassword:
                 builder.append(":-webkit-autofill-strong-password");
                 break;

Modified: trunk/Source/WebCore/css/CSSSelector.h (285609 => 285610)


--- trunk/Source/WebCore/css/CSSSelector.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/CSSSelector.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -110,6 +110,7 @@
             PseudoClassAnyLink,
             PseudoClassAnyLinkDeprecated,
             PseudoClassAutofill,
+            PseudoClassAutofillAndObscured,
             PseudoClassAutofillStrongPassword,
             PseudoClassAutofillStrongPasswordViewable,
             PseudoClassHover,

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (285609 => 285610)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -982,6 +982,8 @@
             break;
         case CSSSelector::PseudoClassAutofill:
             return isAutofilled(element);
+        case CSSSelector::PseudoClassAutofillAndObscured:
+            return isAutofilledAndObscured(element);
         case CSSSelector::PseudoClassAutofillStrongPassword:
             return isAutofilledStrongPassword(element);
         case CSSSelector::PseudoClassAutofillStrongPasswordViewable:

Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (285609 => 285610)


--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -72,6 +72,11 @@
     return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isAutoFilledAndViewable();
 }
 
+ALWAYS_INLINE bool isAutofilledAndObscured(const Element& element)
+{
+    return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isAutoFilledAndObscured();
+}
+
 ALWAYS_INLINE bool matchesDefaultPseudoClass(const Element& element)
 {
     return element.matchesDefaultPseudoClass();

Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (285609 => 285610)


--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in	2021-11-11 00:14:36 UTC (rev 285610)
@@ -4,6 +4,7 @@
 -webkit-any
 -webkit-any-link, PseudoClassAnyLinkDeprecated, PseudoElementUnknown
 -webkit-autofill
+-webkit-autofill-and-obscured
 -webkit-autofill-strong-password
 -webkit-autofill-strong-password-viewable
 -webkit-drag

Modified: trunk/Source/WebCore/css/html.css (285609 => 285610)


--- trunk/Source/WebCore/css/html.css	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/css/html.css	2021-11-11 00:14:36 UTC (rev 285610)
@@ -772,6 +772,13 @@
     text-align: start !important;
 }
 
+input:-webkit-autofill-and-obscured {
+    -webkit-text-security: disc !important;
+    -webkit-user-select: none !important;
+    pointer-events: none !important;
+    cursor: default !important;
+}
+
 input:-webkit-autofill-strong-password {
     -webkit-user-select: none !important;
 }
@@ -782,7 +789,7 @@
     font-family: monospace;
 }
 
-input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable {
+input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable, input:-webkit-autofill-and-obscured {
     background-color: #FAFFBD !important;
     background-image: none !important;
     color: #000000 !important;

Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (285609 => 285610)


--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -77,6 +77,7 @@
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationSynchronizeStyleAttributeInternal, void, (StyledElement* styledElement));
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationEqualIgnoringASCIICaseNonNull, bool, (const StringImpl*, const StringImpl*));
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationIsAutofilled, bool, (const Element&));
+static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationIsAutofilledAndObscured, bool, (const Element&));
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationIsAutofilledStrongPassword, bool, (const Element&));
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationIsAutofilledStrongPasswordViewable, bool, (const Element&));
 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationIsChecked, bool, (const Element&));
@@ -600,6 +601,11 @@
     return isAutofilled(element);
 }
 
+JSC_DEFINE_JIT_OPERATION(operationIsAutofilledAndObscured, bool, (const Element& element))
+{
+    return isAutofilledAndObscured(element);
+}
+
 JSC_DEFINE_JIT_OPERATION(operationIsAutofilledStrongPassword, bool, (const Element& element))
 {
     return isAutofilledStrongPassword(element);
@@ -816,6 +822,9 @@
     case CSSSelector::PseudoClassAutofill:
         fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr<JSC::OperationPtrTag>(operationIsAutofilled));
         return FunctionType::SimpleSelectorChecker;
+    case CSSSelector::PseudoClassAutofillAndObscured:
+        fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr<JSC::OperationPtrTag>(operationIsAutofilledAndObscured));
+        return FunctionType::SimpleSelectorChecker;
     case CSSSelector::PseudoClassAutofillStrongPassword:
         fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr<JSC::OperationPtrTag>(operationIsAutofilledStrongPassword));
         return FunctionType::SimpleSelectorChecker;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (285609 => 285610)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -115,6 +115,7 @@
     , m_autocomplete(Uninitialized)
     , m_isAutoFilled(false)
     , m_isAutoFilledAndViewable(false)
+    , m_isAutoFilledAndObscured(false)
     , m_autoFillButtonType(static_cast<uint8_t>(AutoFillButtonType::None))
     , m_lastAutoFillButtonType(static_cast<uint8_t>(AutoFillButtonType::None))
     , m_isAutoFillAvailable(false)
@@ -959,6 +960,7 @@
 
     setAutoFilled(false);
     setAutoFilledAndViewable(false);
+    setAutoFilledAndObscured(false);
     setShowAutoFillButton(AutoFillButtonType::None);
     setChecked(hasAttributeWithoutSynchronization(checkedAttr));
     m_dirtyCheckednessFlag = false;
@@ -1396,6 +1398,15 @@
     invalidateStyleForSubtree();
 }
 
+void HTMLInputElement::setAutoFilledAndObscured(bool autoFilledAndObscured)
+{
+    if (autoFilledAndObscured == m_isAutoFilledAndObscured)
+        return;
+
+    m_isAutoFilledAndObscured = autoFilledAndObscured;
+    invalidateStyleForSubtree();
+}
+
 void HTMLInputElement::setShowAutoFillButton(AutoFillButtonType autoFillButtonType)
 {
     if (static_cast<uint8_t>(autoFillButtonType) == m_autoFillButtonType)

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (285609 => 285610)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -242,6 +242,9 @@
     bool isAutoFilledAndViewable() const { return m_isAutoFilledAndViewable; }
     WEBCORE_EXPORT void setAutoFilledAndViewable(bool = true);
 
+    bool isAutoFilledAndObscured() const { return m_isAutoFilledAndObscured; }
+    WEBCORE_EXPORT void setAutoFilledAndObscured(bool = true);
+
     AutoFillButtonType lastAutoFillButtonType() const { return static_cast<AutoFillButtonType>(m_lastAutoFillButtonType); }
     AutoFillButtonType autoFillButtonType() const { return static_cast<AutoFillButtonType>(m_autoFillButtonType); }
     WEBCORE_EXPORT void setShowAutoFillButton(AutoFillButtonType);
@@ -474,6 +477,7 @@
     unsigned m_autocomplete : 2; // AutoCompleteSetting
     bool m_isAutoFilled : 1;
     bool m_isAutoFilledAndViewable : 1;
+    bool m_isAutoFilledAndObscured : 1;
     unsigned m_autoFillButtonType : 3; // AutoFillButtonType
     unsigned m_lastAutoFillButtonType : 3; // AutoFillButtonType
     bool m_isAutoFillAvailable : 1;

Modified: trunk/Source/WebCore/testing/Internals.cpp (285609 => 285610)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -2102,6 +2102,11 @@
     element.setAutoFilledAndViewable(enabled);
 }
 
+void Internals::setAutoFilledAndObscured(HTMLInputElement& element, bool enabled)
+{
+    element.setAutoFilledAndObscured(enabled);
+}
+
 static AutoFillButtonType toAutoFillButtonType(Internals::AutoFillButtonType type)
 {
     switch (type) {

Modified: trunk/Source/WebCore/testing/Internals.h (285609 => 285610)


--- trunk/Source/WebCore/testing/Internals.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/testing/Internals.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -320,6 +320,7 @@
     bool elementShouldAutoComplete(HTMLInputElement&);
     void setAutofilled(HTMLInputElement&, bool enabled);
     void setAutoFilledAndViewable(HTMLInputElement&, bool enabled);
+    void setAutoFilledAndObscured(HTMLInputElement&, bool enabled);
     enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, CreditCard };
     void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
     AutoFillButtonType autoFillButtonType(const HTMLInputElement&);

Modified: trunk/Source/WebCore/testing/Internals.idl (285609 => 285610)


--- trunk/Source/WebCore/testing/Internals.idl	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebCore/testing/Internals.idl	2021-11-11 00:14:36 UTC (rev 285610)
@@ -409,6 +409,7 @@
     boolean elementShouldAutoComplete(HTMLInputElement inputElement);
     undefined setAutofilled(HTMLInputElement inputElement, boolean enabled);
     undefined setAutoFilledAndViewable(HTMLInputElement inputElement, boolean enabled);
+    undefined setAutoFilledAndObscured(HTMLInputElement inputElement, boolean enabled);
     undefined setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
     AutoFillButtonType autoFillButtonType(HTMLInputElement inputElement);
     AutoFillButtonType lastAutoFillButtonType(HTMLInputElement inputElement);

Modified: trunk/Source/WebKit/ChangeLog (285609 => 285610)


--- trunk/Source/WebKit/ChangeLog	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/ChangeLog	2021-11-11 00:14:36 UTC (rev 285610)
@@ -1,3 +1,24 @@
+2021-11-10  Devin Rousso  <[email protected]>
+
+        Add support for marking an `<input>` as being autofilled with obscured content
+        https://bugs.webkit.org/show_bug.cgi?id=232903
+        <rdar://problem/84276999>
+
+        Reviewed by Aditya Keerthi.
+
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndObscured const): Added.
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndObscured): Added.
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
+        (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilledAndObscured]): Added.
+        (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilledAndObscured:]): Added.
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
+        (WKBundleNodeHandleSetHTMLInputElementAutoFilledAndObscured): Added.
+        Expose a way to get/set the CSS `-webkit-autofill-and-obscured` pseudo-class on an `<input>`.
+
 2021-11-10  Wenson Hsieh  <[email protected]>
 
         Refactor some image overlay logic to work with built-in media controls

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h (285609 => 285610)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -52,6 +52,7 @@
 @property (nonatomic, readonly) CGRect elementBounds;
 @property (nonatomic) BOOL HTMLInputElementIsAutoFilled;
 @property (nonatomic) BOOL HTMLInputElementIsAutoFilledAndViewable;
+@property (nonatomic) BOOL HTMLInputElementIsAutoFilledAndObscured WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, readonly) BOOL HTMLInputElementIsUserEdited;
 @property (nonatomic, readonly) BOOL HTMLTextAreaElementIsUserEdited;
 @property (nonatomic, readonly) WKWebProcessPlugInNodeHandle *HTMLTableCellElementCellAbove;

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


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2021-11-11 00:14:36 UTC (rev 285610)
@@ -95,6 +95,11 @@
     return _nodeHandle->isHTMLInputElementAutoFilledAndViewable();
 }
 
+- (BOOL)HTMLInputElementIsAutoFilledAndObscured
+{
+    return _nodeHandle->isHTMLInputElementAutoFilledAndObscured();
+}
+
 - (void)setHTMLInputElementIsAutoFilled:(BOOL)isAutoFilled
 {
     _nodeHandle->setHTMLInputElementAutoFilled(isAutoFilled);
@@ -105,6 +110,11 @@
     _nodeHandle->setHTMLInputElementAutoFilledAndViewable(isAutoFilledAndViewable);
 }
 
+- (void)setHTMLInputElementIsAutoFilledAndObscured:(BOOL)isAutoFilledAndObscured
+{
+    _nodeHandle->setHTMLInputElementAutoFilledAndObscured(isAutoFilledAndObscured);
+}
+
 - (BOOL)isHTMLInputElementAutoFillButtonEnabled
 {
     return _nodeHandle->isHTMLInputElementAutoFillButtonEnabled();

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


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -136,6 +136,11 @@
     WebKit::toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilledAndViewable(autoFilledAndViewable);
 }
 
+void WKBundleNodeHandleSetHTMLInputElementAutoFilledAndObscured(WKBundleNodeHandleRef htmlInputElementHandleRef, bool autoFilledAndObscured)
+{
+    WebKit::toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilledAndObscured(autoFilledAndObscured);
+}
+
 bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef)
 {
     ASSERT_NOT_REACHED();

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


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -65,6 +65,7 @@
 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilledAndViewable(WKBundleNodeHandleRef htmlInputElementHandle, bool autoFilledAndViewable);
+WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilledAndObscured(WKBundleNodeHandleRef htmlInputElementHandle, bool autoFilledAndObscured);
 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabledWithButtonType(WKBundleNodeHandleRef htmlInputElementHandle, WKAutoFillButtonType autoFillButtonType);
 WK_EXPORT WKAutoFillButtonType WKBundleNodeHandleGetHTMLInputElementAutoFillButtonType(WKBundleNodeHandleRef htmlInputElementHandle);

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp (285609 => 285610)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2021-11-11 00:14:36 UTC (rev 285610)
@@ -273,6 +273,14 @@
     return downcast<HTMLInputElement>(*m_node).isAutoFilledAndViewable();
 }
 
+bool InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndObscured() const
+{
+    if (!is<HTMLInputElement>(m_node))
+        return false;
+
+    return downcast<HTMLInputElement>(*m_node).isAutoFilledAndObscured();
+}
+
 void InjectedBundleNodeHandle::setHTMLInputElementAutoFilled(bool filled)
 {
     if (!is<HTMLInputElement>(m_node))
@@ -289,6 +297,14 @@
     downcast<HTMLInputElement>(*m_node).setAutoFilledAndViewable(autoFilledAndViewable);
 }
 
+void InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndObscured(bool autoFilledAndObscured)
+{
+    if (!is<HTMLInputElement>(m_node))
+        return;
+
+    downcast<HTMLInputElement>(*m_node).setAutoFilledAndObscured(autoFilledAndObscured);
+}
+
 bool InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled() const
 {
     if (!is<HTMLInputElement>(m_node))

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h (285609 => 285610)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2021-11-11 00:03:06 UTC (rev 285609)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2021-11-11 00:14:36 UTC (rev 285610)
@@ -68,8 +68,10 @@
     void setHTMLInputElementSpellcheckEnabled(bool);
     bool isHTMLInputElementAutoFilled() const;
     bool isHTMLInputElementAutoFilledAndViewable() const;
+    bool isHTMLInputElementAutoFilledAndObscured() const;
     void setHTMLInputElementAutoFilled(bool);
     void setHTMLInputElementAutoFilledAndViewable(bool);
+    void setHTMLInputElementAutoFilledAndObscured(bool);
     bool isHTMLInputElementAutoFillButtonEnabled() const;
     void setHTMLInputElementAutoFillButtonEnabled(WebCore::AutoFillButtonType);
     WebCore::AutoFillButtonType htmlInputElementAutoFillButtonType() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to