Bug 1885691 - Convert LogicalCorner to enum class in WritingMode.h. r=dholbert

While I'm here, I remove the explict indices (0 - 3) for the enumerators since
they don't get used anywhere.

Differential Revision: https://phabricator.services.mozilla.com/D204833
This commit is contained in:
Ting-Yu Lin 2024-03-16 01:26:40 +00:00
parent de61591f48
commit a0d64453fb
3 changed files with 22 additions and 21 deletions

View file

@ -62,11 +62,11 @@ constexpr auto AllLogicalSides() {
eLogicalSideIEnd);
}
enum LogicalCorner {
eLogicalCornerBStartIStart = 0,
eLogicalCornerBStartIEnd = 1,
eLogicalCornerBEndIEnd = 2,
eLogicalCornerBEndIStart = 3
enum class LogicalCorner : uint8_t {
BStartIStart,
BStartIEnd,
BEndIEnd,
BEndIStart,
};
// Physical axis constants.

View file

@ -981,13 +981,13 @@ void nsTableCellMap::SetBCBorderCorner(LogicalCorner aCorner,
int32_t yPos = aRowIndex;
int32_t rgYPos = aRowIndex - aCellMapStart;
if (eLogicalCornerBStartIEnd == aCorner) {
if (LogicalCorner::BStartIEnd == aCorner) {
xPos++;
} else if (eLogicalCornerBEndIEnd == aCorner) {
} else if (LogicalCorner::BEndIEnd == aCorner) {
xPos++;
rgYPos++;
yPos++;
} else if (eLogicalCornerBEndIStart == aCorner) {
} else if (LogicalCorner::BEndIStart == aCorner) {
rgYPos++;
yPos++;
}

View file

@ -5179,7 +5179,7 @@ void nsTableFrame::CalcBCBorders() {
} else {
bStartIStartCorner.Update(eLogicalSideIEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBStartIStart, *iter.mCellMap, 0, 0, colIdx,
LogicalCorner::BStartIStart, *iter.mCellMap, 0, 0, colIdx,
LogicalSide(bStartIStartCorner.ownerSide),
bStartIStartCorner.subWidth, bStartIStartCorner.bevel);
}
@ -5238,7 +5238,7 @@ void nsTableFrame::CalcBCBorders() {
(0 == rowB) ? bStartCorners[0] : bEndCorners[0];
bStartIStartCorner.Update(eLogicalSideBEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBStartIStart, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BStartIStart, *iter.mCellMap, iter.mRowGroupStart,
rowB, 0, LogicalSide(bStartIStartCorner.ownerSide),
bStartIStartCorner.subWidth, bStartIStartCorner.bevel);
bEndCorners[0].Set(eLogicalSideBStart, currentBorder);
@ -5277,14 +5277,15 @@ void nsTableFrame::CalcBCBorders() {
: bEndCorners[info.GetCellEndColIndex() + 1];
bStartIEndCorner.Update(eLogicalSideBEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBStartIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
info.GetCellEndColIndex(), LogicalSide(bStartIEndCorner.ownerSide),
bStartIEndCorner.subWidth, bStartIEndCorner.bevel);
LogicalCorner::BStartIEnd, *iter.mCellMap, iter.mRowGroupStart,
rowB, info.GetCellEndColIndex(),
LogicalSide(bStartIEndCorner.ownerSide), bStartIEndCorner.subWidth,
bStartIEndCorner.bevel);
BCCornerInfo& bEndIEndCorner =
bEndCorners[info.GetCellEndColIndex() + 1];
bEndIEndCorner.Set(eLogicalSideBStart, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
LogicalCorner::BEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
info.GetCellEndColIndex(), LogicalSide(bEndIEndCorner.ownerSide),
bEndIEndCorner.subWidth, bEndIEndCorner.bevel);
// update lastBlockDirBorders and see if a new segment starts
@ -5367,7 +5368,7 @@ void nsTableFrame::CalcBCBorders() {
if (0 != rowB) {
// Ok, actually store the information
tableCellMap->SetBCBorderCorner(
eLogicalCornerBStartIEnd, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BStartIEnd, *iter.mCellMap, iter.mRowGroupStart,
rowB, info.GetCellEndColIndex(),
LogicalSide(bStartIEndCorner->ownerSide),
bStartIEndCorner->subWidth, bStartIEndCorner->bevel);
@ -5375,8 +5376,8 @@ void nsTableFrame::CalcBCBorders() {
// Propagate this segment down the rowspan
for (int32_t rX = rowB + 1; rX < rowB + segLength; rX++) {
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rX,
info.GetCellEndColIndex(),
LogicalCorner::BEndIEnd, *iter.mCellMap, iter.mRowGroupStart,
rX, info.GetCellEndColIndex(),
LogicalSide(bStartIEndCorner->ownerSide),
bStartIEndCorner->subWidth, false);
}
@ -5410,7 +5411,7 @@ void nsTableFrame::CalcBCBorders() {
BCCornerInfo& bEndIStartCorner = bEndCorners[colIdx];
bEndIStartCorner.Update(eLogicalSideIEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BEndIStart, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx,
LogicalSide(bEndIStartCorner.ownerSide), bEndIStartCorner.subWidth,
bEndIStartCorner.bevel);
@ -5420,7 +5421,7 @@ void nsTableFrame::CalcBCBorders() {
// inline-end of the overall table.
if (info.mNumTableCols == colIdx + 1) {
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BEndIEnd, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx,
LogicalSide(bEndIEndCorner.ownerSide), bEndIEndCorner.subWidth,
bEndIEndCorner.bevel, true);
@ -5497,7 +5498,7 @@ void nsTableFrame::CalcBCBorders() {
colIdx >= damageArea.StartCol()) {
if (hitsSpanBelow) {
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BEndIStart, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx,
LogicalSide(bEndIStartCorner.ownerSide),
bEndIStartCorner.subWidth, bEndIStartCorner.bevel);
@ -5507,7 +5508,7 @@ void nsTableFrame::CalcBCBorders() {
BCCornerInfo& corner = bEndCorners[c];
corner.Set(eLogicalSideIEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart,
LogicalCorner::BEndIStart, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), c, LogicalSide(corner.ownerSide),
corner.subWidth, false);
}