Closed Bug 840367 Opened 10 years ago Closed 10 years ago

nsCSSKeywordList.h violates its rules


(Core :: CSS Parsing and Computation, defect, P4)






(Reporter: jruderman, Assigned: dbaron)





(1 file)

24   Entries are in the form: (name, id). 'id' must always be the same as 'name'
25   except that all hyphens ('-') in 'name' are converted to underscores ('_')
26   in 'id'. This lets us do nice things with the macros without having to
27   copy/convert strings at runtime.

These 10 violate the rules, which got in my way when trying to import the "-moz-appearance" list into my fuzzer.  I'm not sure what else is supposed to go wrong.

CSS_KEY(tab-scroll-arrow-back, tabscrollarrow_back)
CSS_KEY(tab-scroll-arrow-forward, tabscrollarrow_forward)
CSS_KEY(menulist-button, menulistbutton)
CSS_KEY(menulist-text, menulisttext)
CSS_KEY(menulist-textfield, menulisttextfield)
CSS_KEY(checkbox-container, checkboxcontainer)
CSS_KEY(radio-container, radiocontainer)
CSS_KEY(checkbox-label, checkboxlabel)
CSS_KEY(radio-label, radiolabel)
CSS_KEY(button-focus, buttonfocus)
I think the only thing that breaks is that people get confused when adding new items or figuring out whether items exist already.
Assignee: nobody → dbaron
And my command to check what was misnamed was:

diff <(cat nsCSSKeywordList.h  | grep CSS_KEY | sed 's,^//,,' | sed 's/CSS_KEY(\([^,]*\), \([^,]*\))/\1/') <(cat nsCSSKeywordList.h  | grep CSS_KEY | sed 's,^//,,' | sed 's/CSS_KEY(\([^,]*\), \([^,]*\))/\2/' | sed 's/_/-/g')  | less -S
OS: Mac OS X → All
Hardware: x86_64 → All
Comment on attachment 712737 [details] [diff] [review]
Fix misnaming of keyword IDs in nsCSSKeywordList.h.

Is it worth putting using that comment 3 command to use in a "check" target in layout/style/  Could check the lowercase requirement there, too.
Attachment #712737 - Flags: review?(cam) → review+
It's not a bad idea, but I tend to think it's probably not worth the effort (and making sure it's all portable across anything that we use for building, etc.).
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.