From 81f60b575a1b4c2c50adbcecb606b808884178ee Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 1 Aug 2024 20:09:22 +0200 Subject: [PATCH] Issue #1925 - Rename Corner to LogicalCorner and move it to nsStyleCoord.h. To avoid confusion with mozilla::css::corner, rename ::Corner to mozilla::LogicalCorner, and move it to nsStyleCoord.h from the illogical nsCellMap.h location. Also, append the LogicalCorner prefix to all the enum values, to match the surrounding coding style. --- layout/style/nsStyleCoord.h | 10 +++++++++- layout/tables/nsCellMap.cpp | 8 ++++---- layout/tables/nsCellMap.h | 10 +--------- layout/tables/nsTableFrame.cpp | 21 +++++++++++---------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/layout/style/nsStyleCoord.h b/layout/style/nsStyleCoord.h index e1b95e9cc8..bd4f15ab51 100644 --- a/layout/style/nsStyleCoord.h +++ b/layout/style/nsStyleCoord.h @@ -15,7 +15,7 @@ namespace mozilla { class WritingMode; -// Logical axis, edge and side constants for use in various places. +// Logical axis, edge, side and corner constants for use in various places. enum LogicalAxis { eLogicalAxisBlock = 0x0, eLogicalAxisInline = 0x1 @@ -31,6 +31,14 @@ enum LogicalSide { eLogicalSideIEnd = (eLogicalAxisInline << 1) | eLogicalEdgeEnd // 0x3 }; +enum LogicalCorner +{ + eLogicalCornerBStartIStart = 0, + eLogicalCornerBStartIEnd = 1, + eLogicalCornerBEndIEnd = 2, + eLogicalCornerBEndIStart = 3 +}; + } // namespace mozilla enum nsStyleUnit : uint8_t { diff --git a/layout/tables/nsCellMap.cpp b/layout/tables/nsCellMap.cpp index 4852a4bdde..06041e0300 100644 --- a/layout/tables/nsCellMap.cpp +++ b/layout/tables/nsCellMap.cpp @@ -1055,7 +1055,7 @@ nsTableCellMap::SetBCBorderEdge(LogicalSide aSide, // (aRowIndex, aColIndex). For eBStartIEnd, store it in the entry to the iEnd-wards where // it would be BStartIStart. For eBEndIEnd, store it in the entry to the bEnd-wards. etc. void -nsTableCellMap::SetBCBorderCorner(Corner aCorner, +nsTableCellMap::SetBCBorderCorner(LogicalCorner aCorner, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aRowIndex, @@ -1076,15 +1076,15 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner, int32_t yPos = aRowIndex; int32_t rgYPos = aRowIndex - aCellMapStart; - if (eBStartIEnd == aCorner) { + if (eLogicalCornerBStartIEnd == aCorner) { xPos++; } - else if (eBEndIEnd == aCorner) { + else if (eLogicalCornerBEndIEnd == aCorner) { xPos++; rgYPos++; yPos++; } - else if (eBEndIStart == aCorner) { + else if (eLogicalCornerBEndIStart == aCorner) { rgYPos++; yPos++; } diff --git a/layout/tables/nsCellMap.h b/layout/tables/nsCellMap.h index 991343aa71..c729fea3ec 100644 --- a/layout/tables/nsCellMap.h +++ b/layout/tables/nsCellMap.h @@ -35,14 +35,6 @@ struct nsColInfo int32_t aNumCellsSpan); }; -enum Corner -{ - eBStartIStart = 0, - eBStartIEnd = 1, - eBEndIEnd = 2, - eBEndIStart = 3 -}; - struct BCInfo { nsTArray mIEndBorders; @@ -213,7 +205,7 @@ public: nscoord aSize, bool aChanged); - void SetBCBorderCorner(::Corner aCorner, + void SetBCBorderCorner(mozilla::LogicalCorner aCorner, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aYPos, diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 24bb28b73a..b18de99e03 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -5733,7 +5733,8 @@ nsTableFrame::CalcBCBorders() } else { tlCorner.Update(eLogicalSideIEnd, currentBorder); - tableCellMap->SetBCBorderCorner(eBStartIStart, *iter.mCellMap, 0, 0, colIdx, + tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIStart, + *iter.mCellMap, 0, 0, colIdx, LogicalSide(tlCorner.ownerSide), tlCorner.subWidth, tlCorner.bevel); @@ -5783,7 +5784,7 @@ nsTableFrame::CalcBCBorders() currentBorder = info.GetIStartEdgeBorder(); BCCornerInfo& tlCorner = (0 == rowB) ? bStartCorners[0] : bEndCorners[0]; tlCorner.Update(eLogicalSideBEnd, currentBorder); - tableCellMap->SetBCBorderCorner(eBStartIStart, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIStart, *iter.mCellMap, iter.mRowGroupStart, rowB, 0, LogicalSide(tlCorner.ownerSide), tlCorner.subWidth, @@ -5822,7 +5823,7 @@ nsTableFrame::CalcBCBorders() bStartCorners[info.GetCellEndColIndex() + 1] : bEndCorners[info.GetCellEndColIndex() + 1]; trCorner.Update(eLogicalSideBEnd, currentBorder); // bStart-iEnd - tableCellMap->SetBCBorderCorner(eBStartIEnd, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB, info.GetCellEndColIndex(), LogicalSide(trCorner.ownerSide), @@ -5830,7 +5831,7 @@ nsTableFrame::CalcBCBorders() trCorner.bevel); BCCornerInfo& brCorner = bEndCorners[info.GetCellEndColIndex() + 1]; brCorner.Set(eLogicalSideBStart, currentBorder); // bEnd-iEnd - tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB, info.GetCellEndColIndex(), LogicalSide(brCorner.ownerSide), @@ -5899,7 +5900,7 @@ nsTableFrame::CalcBCBorders() if (info.GetCellEndColIndex() < damageArea.EndCol() && rowB >= damageArea.StartRow()) { if (0 != rowB) { - tableCellMap->SetBCBorderCorner(eBStartIEnd, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB, info.GetCellEndColIndex(), LogicalSide(trCorner->ownerSide), @@ -5908,7 +5909,7 @@ nsTableFrame::CalcBCBorders() } // store any corners this cell spans together with the aja cell for (int32_t rX = rowB + 1; rX < rowB + segLength; rX++) { - tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rX, info.GetCellEndColIndex(), LogicalSide(trCorner->ownerSide), @@ -5945,7 +5946,7 @@ nsTableFrame::CalcBCBorders() // update/store the bEnd-iStart & bEnd-IEnd corners BCCornerInfo& blCorner = bEndCorners[colIdx]; // bEnd-iStart blCorner.Update(eLogicalSideIEnd, currentBorder); - tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart, info.GetCellEndRowIndex(), colIdx, @@ -5954,7 +5955,7 @@ nsTableFrame::CalcBCBorders() BCCornerInfo& brCorner = bEndCorners[colIdx + 1]; // bEnd-iEnd brCorner.Update(eLogicalSideIStart, currentBorder); if (info.mNumTableCols == colIdx + 1) { // bEnd-IEnd corner of the table - tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap, iter.mRowGroupStart, info.GetCellEndRowIndex(), colIdx, LogicalSide(brCorner.ownerSide), @@ -6026,7 +6027,7 @@ nsTableFrame::CalcBCBorders() if (info.GetCellEndRowIndex() < damageArea.EndRow() && colIdx >= damageArea.StartCol()) { if (hitsSpanBelow) { - tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart, info.GetCellEndRowIndex(), colIdx, LogicalSide(blCorner.ownerSide), @@ -6036,7 +6037,7 @@ nsTableFrame::CalcBCBorders() for (int32_t c = colIdx + 1; c < colIdx + segLength; c++) { BCCornerInfo& corner = bEndCorners[c]; corner.Set(eLogicalSideIEnd, currentBorder); - tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap, + tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap, iter.mRowGroupStart, info.GetCellEndRowIndex(), c, LogicalSide(corner.ownerSide),