Closed Bug 1224464 Opened 5 years ago Closed 5 years ago

convert keyword tables in nsCSSProps to use a struct

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

Attachments

(3 files, 2 obsolete files)

The keyword tables (tables of KTableValue) in nsCSSProps currently use arrays where the even elements of the array are the keywords and the odd elements are the values.  This is silly; it should just be a struct.

I have patches to do this.

I might end up making bug 1223653 depend on this, although I'm not entirely sure how yet.
Bug 1224464 patch 1 - Make nsCSSKeyword explicitly int16_t.  r?heycam
Attachment #8687150 - Flags: review?(cam)
Bug 1224464 patch 2 - Make nsCSSProps keyword tables be arrays of structs, to represent what they logically are.  r?heycam
Attachment #8687151 - Flags: review?(cam)
Bug 1224464 patch 3 - Rename KTableValue to KTableEntry now that it is a struct.  r?heycam
Attachment #8687152 - Flags: review?(cam)
Comment on attachment 8687150 [details]
MozReview Request: Bug 1224464 patch 1 - Make nsCSSKeyword explicitly int16_t.  r?heycam

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/25117/diff/1-2/
Comment on attachment 8687151 [details]
MozReview Request: Bug 1224464 patch 2 - Make nsCSSProps keyword tables be arrays of structs, to represent what they logically are.  r?heycam

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/25119/diff/1-2/
Comment on attachment 8687152 [details]
MozReview Request: Bug 1224464 patch 3 - Rename KTableValue to KTableEntry now that it is a struct.  r?heycam

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/25121/diff/1-2/
Bug 1223653 patch 1 - Fix incorrect function being called, caught by enum class type checking in next patch.  r?jfkthame
Attachment #8687677 - Flags: review?(jfkthame)
Bug 1223653 patch 2 - Use an enum class for NS_STYLE_BOX_SIZING_*.  r?heycam

The casts in nsCSSProps.cpp (defining kBoxSizingKTable) and in
nsComputedDOMStyle::DoGetBoxSizing (using
nsCSSProps::ValueToKeywordEnum) are a little bit annoying, though aren't
a net reduction in typesafety.

The casts in nsRuleNode.cpp (SetDiscrete) are a little more annoying,
though the change in this patch should be sufficient for converting all
properties -- but that may also mean reducing typesafety a bit for all
properties.

I'd like to find something better to do about them, but I think I'm ok
landing this before doing that.  Bug 1224918 covers doing better.
Attachment #8687678 - Flags: review?(cam)
Attachment #8687677 - Attachment is obsolete: true
Attachment #8687677 - Flags: review?(jfkthame)
Attachment #8687678 - Attachment is obsolete: true
Attachment #8687678 - Flags: review?(cam)
Comment on attachment 8687150 [details]
MozReview Request: Bug 1224464 patch 1 - Make nsCSSKeyword explicitly int16_t.  r?heycam

https://reviewboard.mozilla.org/r/25117/#review22719
Attachment #8687150 - Flags: review?(cam) → review+
Attachment #8687151 - Flags: review?(cam) → review+
Comment on attachment 8687151 [details]
MozReview Request: Bug 1224464 patch 2 - Make nsCSSProps keyword tables be arrays of structs, to represent what they logically are.  r?heycam

https://reviewboard.mozilla.org/r/25119/#review22721

::: layout/inspector/inDOMUtils.cpp:588
(Diff revision 2)
>        // element is a nsCSSKeyword.

This comment can be removed.
Attachment #8687152 - Flags: review?(cam) → review+
Comment on attachment 8687152 [details]
MozReview Request: Bug 1224464 patch 3 - Rename KTableValue to KTableEntry now that it is a struct.  r?heycam

https://reviewboard.mozilla.org/r/25121/#review22723
Blocks: 1215406
https://hg.mozilla.org/integration/mozilla-inbound/rev/2cb53b74518d271a2874502ad129b7b4f799c5ae
Bug 1224464 patch 1 - Make nsCSSKeyword explicitly int16_t.  r=heycam

https://hg.mozilla.org/integration/mozilla-inbound/rev/fbde9f78976bf61462c3069abdbe87a37303ea59
Bug 1224464 patch 2 - Make nsCSSProps keyword tables be arrays of structs, to represent what they logically are.  r=heycam

https://hg.mozilla.org/integration/mozilla-inbound/rev/b4f4af049f7d08ccf6d74e45b8aee9ac79801ebf
Bug 1224464 patch 3 - Rename KTableValue to KTableEntry now that it is a struct.  r=heycam
You need to log in before you can comment on or make changes to this bug.