Closed Bug 1025691 Opened 6 years ago Closed 6 years ago

Use C Macros for eAutcompleteField* enums

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: Agi, Assigned: Agi)

Details

Attachments

(1 file, 1 obsolete file)

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.
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.
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-
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+
Keywords: checkin-needed
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/9d0abd034712
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.