Use C Macros for eAutcompleteField* enums

RESOLVED FIXED in mozilla33

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: agi, Assigned: agi)

Tracking

Trunk
mozilla33
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
From Bug 1009935 Comment 21. We could use C macros to build eAutocompleteField* instead to have the same field in two places. I'll post a small patch for it in this bug.
(Assignee)

Comment 1

4 years ago
Created attachment 8440448 [details] [diff] [review]
Use Macro for eAutocompleteField* enums

Olli, could you take a look? Feel free to invalidate the bug if you think it's not worth it. 

Thanks!
Attachment #8440448 - Flags: review?(bugs)
I'll look at this tomorrow.
(Assignee)

Comment 3

4 years ago
Thanks! Try: https://tbpl.mozilla.org/?tree=Try&rev=1e298f703866
Comment on attachment 8440448 [details] [diff] [review]
Use Macro for eAutocompleteField* enums

>+ * The first argument to AUTOCOMPLETE_* macros will be concatenated
>+ *   to form the C++ name of the attribute
extra spaces before  'to'. But the comment seem to be a bit wrong anyway.
It is up to the user to do something with the name.
Not sure what would be right... something like
"The first argument of AUTOCOMPLETE_* macros is the identifier for the token."
>+ * The second argument is the string value of the attribute
hmm, "attribute" or should it be token or some such.

>+// Contact category types
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL, "tel")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_COUTRY_CODE, "tel-country-code")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_NATIONAL, "tel-national")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_AREA_CODE, "tel-area-code")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_LOCAL, "tel-local")
>+// AUTOCOMPLETE_CONTACT_FIELD_NAME(IMPP, "impp")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_LOCAL_PREFIX, "tel-local-prefix")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_LOCAL_SUFFIX, "tel-local-suffix")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(TEL_EXTENSION, "tel-extension")
>+AUTOCOMPLETE_CONTACT_FIELD_NAME(EMAIL, "email")
>+// AUTOCOMPLETE_CONTACT_FIELD_NAME(IMPP, "impp")

You have IMPP twice. Remove the first one.

>-  eAutocompleteFieldName_last, // Dummy to check table sizes
>+  #define AUTOCOMPLETE_FIELD_NAME(name_, value_) \
>+          eAutocompleteFieldName_##name_,
I think all the #defines should use just 2 spaces for indentation in the next line.
(coding style probably doesn't say anything about this kind of rarely used thing)


r- just because I'd like to see the final patch before it is pushed to tree.
Attachment #8440448 - Flags: review?(bugs) → review-
(Assignee)

Comment 5

4 years ago
Created attachment 8444021 [details] [diff] [review]
Bug 1025483 - Use Macro for AutocompleteField* enums

Ok, I addressed your comments and put back the { 0 } at the end of EnumTables so we actually pass tests now.

Try: https://tbpl.mozilla.org/?tree=Try&rev=91303e322e5c

Thank you!
Assignee: nobody → agi.novanta
Attachment #8440448 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8444021 - Flags: review?(bugs)
Attachment #8444021 - Flags: review?(bugs) → review+
(Assignee)

Updated

4 years ago
Keywords: checkin-needed

Comment 6

4 years ago
Please use the right bug number in future.

https://hg.mozilla.org/integration/mozilla-inbound/rev/83d14fd3d739
https://hg.mozilla.org/integration/mozilla-inbound/rev/b563ec69fa02
https://hg.mozilla.org/integration/mozilla-inbound/rev/9d0abd034712

Updated

4 years ago
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/9d0abd034712
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.