Title: [285982] trunk
- Revision
- 285982
- Author
- commit-qu...@webkit.org
- Date
- 2021-11-17 22:26:50 -0800 (Wed, 17 Nov 2021)
Log Message
When an "autofilled and viewable" field becomes empty, turn "autofilled and viewable" off
https://bugs.webkit.org/show_bug.cgi?id=233239
Patch by Ricky Mondello <rmonde...@apple.com> on 2021-11-17
Reviewed by Darin Adler.
Source/WebCore:
Test: fast/forms/input-autofilled-and-viewable.html
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueFromRenderer): Implement the fix.
* testing/Internals.cpp:
(WebCore::Internals::setValueFromRenderer): Added.
* testing/Internals.h: Declare a member function.
LayoutTests:
* fast/forms/input-autofilled-and-viewable-expected.txt: Added.
* fast/forms/input-autofilled-and-viewable.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (285981 => 285982)
--- trunk/LayoutTests/ChangeLog 2021-11-18 06:05:33 UTC (rev 285981)
+++ trunk/LayoutTests/ChangeLog 2021-11-18 06:26:50 UTC (rev 285982)
@@ -1,3 +1,13 @@
+2021-11-17 Ricky Mondello <rmonde...@apple.com>
+
+ When an "autofilled and viewable" field becomes empty, turn "autofilled and viewable" off
+ https://bugs.webkit.org/show_bug.cgi?id=233239
+
+ Reviewed by Darin Adler.
+
+ * fast/forms/input-autofilled-and-viewable-expected.txt: Added.
+ * fast/forms/input-autofilled-and-viewable.html: Added.
+
2021-11-17 John Wilander <wilan...@apple.com>
PCM: Add capability for click destination to fire triggering event without cross-site requests to the click source
Added: trunk/LayoutTests/fast/forms/input-autofilled-and-viewable-expected.txt (0 => 285982)
--- trunk/LayoutTests/fast/forms/input-autofilled-and-viewable-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/input-autofilled-and-viewable-expected.txt 2021-11-18 06:26:50 UTC (rev 285982)
@@ -0,0 +1,4 @@
+This tests that foreground and background colors properly change for autofilled-and-viewable inputs. It can only be run using DumpRenderTree.
+
+PASS
+
Added: trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html (0 => 285982)
--- trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html (rev 0)
+++ trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html 2021-11-18 06:26:50 UTC (rev 285982)
@@ -0,0 +1,65 @@
+<html>
+<head>
+ <script src=""
+ <script>
+ function test() {
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ }
+
+ var tf = document.getElementById('tf');
+ var computedStyle = document.defaultView.getComputedStyle(tf);
+ var originalForeground = computedStyle.color;
+ var originalBackground = computedStyle.backgroundColor;
+
+ if (window.internals) {
+ window.internals.setAutoFilledAndViewable(tf, true);
+ }
+
+ // Both the foreground and background colors should change.
+ computedStyle = document.defaultView.getComputedStyle(tf);
+ var autofilledForeground = computedStyle.color;
+ var autofilledBackground = computedStyle.backgroundColor;
+ if (autofilledForeground == originalForeground) {
+ testFailed('Foreground color did not change when autofilled.');
+ return;
+ }
+ if (autofilledBackground == originalBackground) {
+ testFailed('Background color did not change when autofilled.');
+ return;
+ }
+
+ tf.focus();
+ document.execCommand("SelectAll");
+ document.execCommand("Delete");
+
+ // Colors should be restored.
+ computedStyle = document.defaultView.getComputedStyle(tf);
+ if (computedStyle.color !== originalForeground) {
+ testFailed('Foreground color did not revert when field was emptied.');
+ return;
+ }
+ if (computedStyle.backgroundColor !== originalBackground) {
+ testFailed('Background color did not revert when field was emptied.');
+ return;
+ }
+
+ testPassed('');
+ }
+ </script>
+
+ <style>
+ #tf {
+ color: #FFFFFF;
+ background-color: #FFFFFF;
+ }
+ </style>
+</head>
+<body _onload_="test()">
+ This tests that foreground and background colors properly change for autofilled-and-viewable inputs. It can only be run using DumpRenderTree.<br>
+ <form name="fm">
+ <input type="text" id="tf" value="Field value" />
+ </form>
+ <div id="console"></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (285981 => 285982)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 06:05:33 UTC (rev 285981)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 06:26:50 UTC (rev 285982)
@@ -1,3 +1,18 @@
+2021-11-17 Ricky Mondello <rmonde...@apple.com>
+
+ When an "autofilled and viewable" field becomes empty, turn "autofilled and viewable" off
+ https://bugs.webkit.org/show_bug.cgi?id=233239
+
+ Reviewed by Darin Adler.
+
+ Test: fast/forms/input-autofilled-and-viewable.html
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setValueFromRenderer): Implement the fix.
+ * testing/Internals.cpp:
+ (WebCore::Internals::setValueFromRenderer): Added.
+ * testing/Internals.h: Declare a member function.
+
2021-11-17 Alex Christensen <achristen...@webkit.org>
Implement most of redirect and modify-headers action types
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (285981 => 285982)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2021-11-18 06:05:33 UTC (rev 285981)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2021-11-18 06:26:50 UTC (rev 285982)
@@ -1159,8 +1159,10 @@
updateValidity();
- // Clear auto fill flag (and yellow background) on user edit.
+ // We clear certain AutoFill flags here because this catches user edits.
setAutoFilled(false);
+ if (m_isAutoFilledAndViewable && value.isEmpty())
+ setAutoFilledAndViewable(false);
}
void HTMLInputElement::willDispatchEvent(Event& event, InputElementClickState& state)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes