Bug 39032 - Don't clear yellow autofill highlight until user edits value
Summary: Don't clear yellow autofill highlight until user edits value
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Minor
Assignee: Jens Alfke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-12 15:59 PDT by Jens Alfke
Modified: 2010-05-14 07:17 PDT (History)
2 users (show)

See Also:


Attachments
patch (1.62 KB, patch)
2010-05-12 16:52 PDT, Jens Alfke
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Alfke 2010-05-12 15:59:09 PDT
The 'autofilled' flag (and yellow background highlight) on a text field gets cleared when the field is focused. This can have weird results — for example, if there's an onload handler on the page that focuses a particular field, then that field won't appear autofilled even though it was. Also, if password fields get autofilled (as Chrome does), then a form's fields turn yellow again as soon as you tab out, since the browser applies the autofill again.
This got reported against Chrome as: http://code.google.com/p/chromium/issues/detail?id=38386
The specific behaviors called out there apply to Chrome, but the autofill highlight is part of WebKit.

I propose that HTMLInputField be changed slightly so that the autofill flag isn't cleared until the field is actually changed by the user, not just tabbed through. This seems more consistent in that the highlight then applies to the _contents_ of the field, showing that it's still a value supplied automatically by the browser and not hand-typed.
Comment 1 Jens Alfke 2010-05-12 16:52:43 PDT
Created attachment 55912 [details]
patch

FYI, I asked about this change on webkit-dev, and John Sullivan was OK with it:
"It seems reasonable to me that the autofilled property is only cleared when the text is modified by the user. Since it is a visible change in the behavior, there's always a chance that it will not sit well with everyone and we might eventually have to allow for both behaviors somehow. But it seems like a small enough behavior change that it's unlikely that anyone will care strongly about it."
Comment 2 John Sullivan 2010-05-12 17:23:39 PDT
I think we could implement the old behavior on top of the new code by having the client notice the focus event and explicitly call setAutofilled(false), so that makes the new code seem even safer than I previously thought.
Comment 3 John Sullivan 2010-05-12 17:25:09 PDT
Comment on attachment 55912 [details]
patch

This seems safe enough.
Comment 4 WebKit Commit Bot 2010-05-14 07:17:01 PDT
Comment on attachment 55912 [details]
patch

Clearing flags on attachment: 55912

Committed r59472: <http://trac.webkit.org/changeset/59472>
Comment 5 WebKit Commit Bot 2010-05-14 07:17:06 PDT
All reviewed patches have been landed.  Closing bug.