Closed Bug 1892778 Opened 5 months ago Closed 5 months ago

Modernize the enums in WritingMode, and some cleanup nearby

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(5 files)

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

Also, rewrite GetInlineDir() and GetBlockDir() to remove bit operations for
computing the InlineDir and BlockDir enum variants.

Existing callers are using IsBidiLTR() and IsBidiRTL() to check the inline
flow direction. BidiDir and GetBidiDir() do not seem useful, and were only
used internally before this patch.

These assertions verify that the numeric values are consistent with
StyleWritingMode (aka WritingMode in servo). They won't change during
runtime, so they can be static_assert.

Also, the two index variables can be uint8_t instead of int.

During the conversion from enum to enum class for LogicalEdge in bug 1885695,
we drop the explicit numeric values its variants. After removing the bit
operations in these helpers, it makes the implementation less obscure.

Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/97be1eff3e3f Part 1 - Convert unknown writing mode value to constexpr variable. r=dholbert https://hg.mozilla.org/integration/autoland/rev/0505eaab18b4 Part 2 - Convert InlineDir and BlockDir to enum classes. r=dholbert https://hg.mozilla.org/integration/autoland/rev/f9b3829fcfa4 Part 3 - Remove BidiDir and GetBidiDir(). r=dholbert https://hg.mozilla.org/integration/autoland/rev/e1ed82dd66ab Part 4 - Convert MOZ_ASSERT to static_assert in WritingModes.h. r=dholbert https://hg.mozilla.org/integration/autoland/rev/074d29b6e81d Part 5 - Rewrite helper methods to get rid of bit operations. r=dholbert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: