Bug 85576 - [BlackBerry] AutofillManager implementation upstream
Summary: [BlackBerry] AutofillManager implementation upstream
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit BlackBerry (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 85575
Blocks: 85577
  Show dependency treegraph
 
Reported: 2012-05-03 21:13 PDT by Jonathan Dong
Modified: 2012-05-08 00:04 PDT (History)
8 users (show)

See Also:


Attachments
Patch (7.82 KB, patch)
2012-05-06 20:03 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff
Patch (7.76 KB, patch)
2012-05-07 17:06 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff
Patch (7.64 KB, patch)
2012-05-07 18:27 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff
Patch (7.64 KB, patch)
2012-05-07 19:12 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff
Patch (7.63 KB, patch)
2012-05-07 22:25 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff
Patch (7.66 KB, patch)
2012-05-07 23:19 PDT, Jonathan Dong
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Dong 2012-05-03 21:13:35 PDT
RIM PR: 136405

The form auto fill feature by my current implementation is pretty much like the behavior of desktop browsers, when user submits a form, the name attribute and the value of text input fields(exclude password) will be stored in the autofill database as a name-value pair. Next time when the user fills any form on any site, the browser will search the db to find out if there's any matched name-value pair to fill the current editing input text field. We will find all the values which has the same name attribute and starts with the character that user has input, and pops up a context dialog to notify user those candidates used by him. If user chooses one from the context dialog, the value will fill the current input text field.

This PR is about the implementation of class AutofillManager, which handles autofill interactions.
Comment 1 Jonathan Dong 2012-05-06 20:03:43 PDT
Created attachment 140460 [details]
Patch
Comment 2 Rob Buis 2012-05-07 08:00:24 PDT
Comment on attachment 140460 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140460&action=review

This can be cleaned up some more.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:26
> +class String;

Indent here, this is WebKit style.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:31
> +class WebPagePrivate;

Ditto.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:37
> +class HTMLInputElement;

The whole block in namespace should be indented.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:50
> +    AutofillManager(BlackBerry::WebKit::WebPagePrivate* page):m_webPagePrivate(page), m_element(0) { }

Watch the ':', it should have space characters around it.
Comment 3 Jonathan Dong 2012-05-07 16:55:27 PDT
Comment on attachment 140460 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140460&action=review

>> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:37
>> +class HTMLInputElement;
> 
> The whole block in namespace should be indented.

Thanks Rob, for those indentation things, I guess many of our porting's codes are not following this guideline, especially in WebKit/blackberry. Do we need to fix them when we are about to make some changes?
Anyway I'll follow your suggestion with my next patch.
Comment 4 Jonathan Dong 2012-05-07 17:03:21 PDT
(In reply to comment #3)
> (From update of attachment 140460 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=140460&action=review
> 
> >> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h:37
> >> +class HTMLInputElement;
> > 
> > The whole block in namespace should be indented.
> 
> Thanks Rob, for those indentation things, I guess many of our porting's codes are not following this guideline, especially in WebKit/blackberry. Do we need to fix them when we are about to make some changes?
> Anyway I'll follow your suggestion with my next patch.

oh, the changes with the indentation in namespace are rejected by check-webkit-style, and I also checked the coding style of webkit.org in http://www.webkit.org/coding/coding-style.html which implies that we should not indent in this situation.
Comment 5 Jonathan Dong 2012-05-07 17:06:53 PDT
Created attachment 140625 [details]
Patch
Comment 6 Rob Buis 2012-05-07 17:44:52 PDT
Comment on attachment 140625 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140625&action=review

Looks good, can be improved some more.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:45
> +    Vector<String> candidates = autofillBackingStore().get(element->getAttribute("name").string(), element->value());

Can you use HTMLNames::nameAttr here? Also is this line needed since you are not using candidates.

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:66
> +            || element->isAutofilled() || !element->shouldAutocomplete())

You are doing these checks here and in didChangeInTextField, can you make a static function for this in this .cpp?

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:68
> +        autofillBackingStore().add(element->getAttribute("name").string(), element->value());

Can you use HTMLNames::nameAttr here?
Comment 7 Jonathan Dong 2012-05-07 18:27:57 PDT
Created attachment 140642 [details]
Patch
Comment 8 Rob Buis 2012-05-07 18:59:56 PDT
Comment on attachment 140642 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140642&action=review

Sorry, needs one more iteration :)

> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:31
> +static bool isNotAutofillable(HTMLInputElement* element)

I think this is better to reverse this logic, ie. make it isAutofillable, and test for ! isNotAutofillable().
Comment 9 Rob Buis 2012-05-07 19:00:31 PDT
(In reply to comment #8)
> (From update of attachment 140642 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=140642&action=review
> 
> Sorry, needs one more iteration :)
> 
> > Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:31
> > +static bool isNotAutofillable(HTMLInputElement* element)
> 
> I think this is better to reverse this logic, ie. make it isAutofillable, and test for ! isNotAutofillable().

Sorry I meant test for !isAutofillable()
Comment 10 Jonathan Dong 2012-05-07 19:04:05 PDT
Comment on attachment 140642 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140642&action=review

>>> Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp:31
>>> +static bool isNotAutofillable(HTMLInputElement* element)
>> 
>> I think this is better to reverse this logic, ie. make it isAutofillable, and test for ! isNotAutofillable().
> 
> Sorry I meant test for !isAutofillable()

thanks, will fix soon. :)
Comment 11 Jonathan Dong 2012-05-07 19:12:16 PDT
Created attachment 140649 [details]
Patch
Comment 12 Rob Buis 2012-05-07 19:41:10 PDT
Comment on attachment 140649 [details]
Patch

I like it!
Comment 13 WebKit Review Bot 2012-05-07 22:15:15 PDT
Comment on attachment 140649 [details]
Patch

Rejecting attachment 140649 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/Source/WebKit/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/12650264
Comment 14 Jonathan Dong 2012-05-07 22:25:30 PDT
Created attachment 140673 [details]
Patch
Comment 15 WebKit Review Bot 2012-05-07 23:00:45 PDT
Comment on attachment 140673 [details]
Patch

Rejecting attachment 140673 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/Source/WebKit/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/12644374
Comment 16 Jonathan Dong 2012-05-07 23:19:54 PDT
Created attachment 140677 [details]
Patch
Comment 17 Charles Wei 2012-05-07 23:21:45 PDT
Comment on attachment 140677 [details]
Patch

Help to commit which was already reviewed by Rob.
Comment 18 WebKit Review Bot 2012-05-08 00:04:15 PDT
Comment on attachment 140677 [details]
Patch

Clearing flags on attachment: 140677

Committed r116400: <http://trac.webkit.org/changeset/116400>
Comment 19 WebKit Review Bot 2012-05-08 00:04:25 PDT
All reviewed patches have been landed.  Closing bug.