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); eLogicalSideIEnd);
} }
enum LogicalCorner { enum class LogicalCorner : uint8_t {
eLogicalCornerBStartIStart = 0, BStartIStart,
eLogicalCornerBStartIEnd = 1, BStartIEnd,
eLogicalCornerBEndIEnd = 2, BEndIEnd,
eLogicalCornerBEndIStart = 3 BEndIStart,
}; };
// Physical axis constants. // Physical axis constants.

View file

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

View file

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