Closed Bug 1403034 Opened 7 years ago Closed 4 years ago

Change color style define to enum class in nsStyleConsts.h

Categories

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

55 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1563315
Tracking Status
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- ?

People

(Reporter: lvk, Assigned: lvk, Mentored)

References

Details

(Whiteboard: [c++])

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170816210634
Blocks: 1277133
Mentor: dteller
Whiteboard: [c++]
File nsStyleColor.h ( http://searchfox.org/mozilla-central/source/layout/style/nsStyleConsts.h#237-246 ) defines a number of macros NS_COLOR_*. That's very fragile, so we should replace them with an `enum class`, which be just as efficient but will help us catch type errors.

The objective of this bug is to replace the definition of NS_COLOR_* with an `enum class` and to replace each instance of these color constants with their new value. See the other `enum class` definitions of the same file to see what the new `enum class` should look like.
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #1)
> File nsStyleColor.h (
> http://searchfox.org/mozilla-central/source/layout/style/nsStyleConsts.h#237-
> 246 ) defines a number of macros NS_COLOR_*. That's very fragile, so we
> should replace them with an `enum class`, which be just as efficient but
> will help us catch type errors.
> 
> The objective of this bug is to replace the definition of NS_COLOR_* with an
> `enum class` and to replace each instance of these color constants with
> their new value. See the other `enum class` definitions of the same file to
> see what the new `enum class` should look like.

Hi David, I intended for this bug to just concern NS_STYLE_COLOR_INHERIT_FROM_BODY. If it should include the NS_COLOR_* macros too, is it OK to combine the macros into one enum class called 'StyleColor'?
Flags: needinfo?(dteller)
My bad, I had misunderstood your bug description. Also, I hadn't realized that you were the one working on it :)

I believe that yes, they should be combined together, as they are already used as a single enumeration.
Flags: needinfo?(dteller)
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #3)
> My bad, I had misunderstood your bug description. Also, I hadn't realized
> that you were the one working on it :)

Sorry, should've been more explicit in the description :) Could you assign the bug to me?

> 
> I believe that yes, they should be combined together, as they are already
> used as a single enumeration.

Will do, thanks!
Forgot needinfo for comment #4.
Flags: needinfo?(dteller)
Assignee: nobody → lkhodel
Flags: needinfo?(dteller)
Attachment #8912698 - Attachment is obsolete: true
Flags: needinfo?(dteller)
Deflecting review to Manish.
Flags: needinfo?(dteller)
Attachment #8912707 - Flags: review?(manishearth)
Comment on attachment 8912707 [details]
Bug 1403034: Convert NS_STYLE_COLOR.. and NS_COLOR_* macros to enum class.

https://reviewboard.mozilla.org/r/184036/#review190038

looks good, though I'll need to handle the servo side (this can't be landed directly)
Attachment #8912707 - Flags: review?(manishearth) → review+
(In reply to Manish Goregaokar [:manishearth] from comment #9)
> Comment on attachment 8912707 [details]
> Bug 1403034: Convert NS_STYLE_COLOR.. and NS_COLOR_* macros to enum class.
> 
> https://reviewboard.mozilla.org/r/184036/#review190038
> 
> looks good, though I'll need to handle the servo side (this can't be landed
> directly)

Great, thanks!
Status: UNCONFIRMED → ASSIGNED
Component: Untriaged → CSS Parsing and Computation
Ever confirmed: true
Product: Firefox → Core
The build doesn't pass, please fix all other usages of these macros.
Priority: -- → P3
Attachment #8915199 - Flags: review?(manishearth)
Comment on attachment 8915199 [details]
Bug 1403034: Fix constant uses.

https://reviewboard.mozilla.org/r/186438/#review196978
Attachment #8915199 - Flags: review?(manishearth) → review+

I believe this was done in bug 1563315.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: