Bug 1157569 part 5 - Convert GetColorAndStyle, GetPaintStyleInfo, and CompareBorders in nsTableFrame to accept writing mode and logical side. r=roc

This changes behavior of border collapse on RTL tables, but it seems
that there is no test coverage on those cases, and those cases should
have been broken before, due to the mix of m{Start,End}side and
physical sides in the methods. Hence this change should be fine, as
long as we are going to fix it in later patches.
This commit is contained in:
Xidorn Quan 2015-05-04 19:09:25 +12:00
parent ab3dde94c2
commit 581e6ac1a8

View File

@ -4672,21 +4672,22 @@ static uint8_t styleToPriority[13] = { 0, // NS_STYLE_BORDER_STYLE_NONE
// and the lowest: 'inset'. none is even weaker // and the lowest: 'inset'. none is even weaker
#define CELL_CORNER true #define CELL_CORNER true
/** return the border style, border color and optional the width in /** return the border style, border color and optionally the width in
* pixel for a given frame and side * pixel for a given frame and side
* @param aFrame - query the info for this frame * @param aFrame - query the info for this frame
* @param aTableWM - the writing-mode of the frame
* @param aSide - the side of the frame * @param aSide - the side of the frame
* @param aStyle - the border style * @param aStyle - the border style
* @param aColor - the border color * @param aColor - the border color
* @param aTableIsLTR - table direction is LTR * @param aWidth - the border width in px.
* @param aWidth - the border width in px * @param aWidth - the border width in px
*/ */
static void static void
GetColorAndStyle(const nsIFrame* aFrame, GetColorAndStyle(const nsIFrame* aFrame,
mozilla::css::Side aSide, WritingMode aTableWM,
LogicalSide aSide,
uint8_t* aStyle, uint8_t* aStyle,
nscolor* aColor, nscolor* aColor,
bool aTableIsLTR,
BCPixelSize* aWidth = nullptr) BCPixelSize* aWidth = nullptr)
{ {
NS_PRECONDITION(aFrame, "null frame"); NS_PRECONDITION(aFrame, "null frame");
@ -4698,44 +4699,37 @@ GetColorAndStyle(const nsIFrame* aFrame,
} }
const nsStyleBorder* styleData = aFrame->StyleBorder(); const nsStyleBorder* styleData = aFrame->StyleBorder();
if(!aTableIsLTR) { // revert the directions mozilla::Side physicalSide = aTableWM.PhysicalSide(aSide);
if (NS_SIDE_RIGHT == aSide) { *aStyle = styleData->GetBorderStyle(physicalSide);
aSide = NS_SIDE_LEFT;
}
else if (NS_SIDE_LEFT == aSide) {
aSide = NS_SIDE_RIGHT;
}
}
*aStyle = styleData->GetBorderStyle(aSide);
if ((NS_STYLE_BORDER_STYLE_NONE == *aStyle) || if ((NS_STYLE_BORDER_STYLE_NONE == *aStyle) ||
(NS_STYLE_BORDER_STYLE_HIDDEN == *aStyle)) { (NS_STYLE_BORDER_STYLE_HIDDEN == *aStyle)) {
return; return;
} }
*aColor = aFrame->StyleContext()->GetVisitedDependentColor( *aColor = aFrame->StyleContext()->GetVisitedDependentColor(
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[aSide]); nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[physicalSide]);
if (aWidth) { if (aWidth) {
nscoord width = styleData->GetComputedBorderWidth(aSide); nscoord width = styleData->GetComputedBorderWidth(physicalSide);
*aWidth = nsPresContext::AppUnitsToIntCSSPixels(width); *aWidth = nsPresContext::AppUnitsToIntCSSPixels(width);
} }
} }
/** coerce the paint style as required by CSS2.1 /** coerce the paint style as required by CSS2.1
* @param aFrame - query the info for this frame * @param aFrame - query the info for this frame
* @param aTableWM - the writing mode of the frame
* @param aSide - the side of the frame * @param aSide - the side of the frame
* @param aStyle - the border style * @param aStyle - the border style
* @param aColor - the border color * @param aColor - the border color
* @param aTableIsLTR - table direction is LTR
*/ */
static void static void
GetPaintStyleInfo(const nsIFrame* aFrame, GetPaintStyleInfo(const nsIFrame* aFrame,
mozilla::css::Side aSide, WritingMode aTableWM,
LogicalSide aSide,
uint8_t* aStyle, uint8_t* aStyle,
nscolor* aColor, nscolor* aColor)
bool aTableIsLTR)
{ {
GetColorAndStyle(aFrame, aSide, aStyle, aColor, aTableIsLTR); GetColorAndStyle(aFrame, aTableWM, aSide, aStyle, aColor);
if (NS_STYLE_BORDER_STYLE_INSET == *aStyle) { if (NS_STYLE_BORDER_STYLE_INSET == *aStyle) {
*aStyle = NS_STYLE_BORDER_STYLE_RIDGE; *aStyle = NS_STYLE_BORDER_STYLE_RIDGE;
} else if (NS_STYLE_BORDER_STYLE_OUTSET == *aStyle) { } else if (NS_STYLE_BORDER_STYLE_OUTSET == *aStyle) {
@ -4848,14 +4842,13 @@ CompareBorders(bool aIsCorner, // Pass true for corner calculatio
* scenarios with a adjacent owner. * scenarios with a adjacent owner.
* @param xxxFrame - the frame for style information, might be zero if * @param xxxFrame - the frame for style information, might be zero if
* it should not be considered * it should not be considered
* @param aTableWM - the writing mode of the frame
* @param aSide - side of the frames that should be considered * @param aSide - side of the frames that should be considered
* @param aAja - the border comparison takes place from the point of * @param aAja - the border comparison takes place from the point of
* a frame that is adjacent to the cellmap entry, for * a frame that is adjacent to the cellmap entry, for
* when a cell owns its lower border it will be the * when a cell owns its lower border it will be the
* adjacent owner as in the cellmap only top and left * adjacent owner as in the cellmap only top and left
* borders are stored. * borders are stored.
* @param aTwipsToPixels - conversion factor as borders need to be drawn pixel
* aligned.
*/ */
static BCCellBorder static BCCellBorder
CompareBorders(const nsIFrame* aTableFrame, CompareBorders(const nsIFrame* aTableFrame,
@ -4864,16 +4857,17 @@ CompareBorders(const nsIFrame* aTableFrame,
const nsIFrame* aRowGroupFrame, const nsIFrame* aRowGroupFrame,
const nsIFrame* aRowFrame, const nsIFrame* aRowFrame,
const nsIFrame* aCellFrame, const nsIFrame* aCellFrame,
bool aTableIsLTR, WritingMode aTableWM,
mozilla::css::Side aSide, LogicalSide aSide,
bool aAja) bool aAja)
{ {
BCCellBorder border, tempBorder; BCCellBorder border, tempBorder;
bool horizontal = (NS_SIDE_TOP == aSide) || (NS_SIDE_BOTTOM == aSide); bool inlineAxis = IsBlock(aSide);
// start with the table as dominant if present // start with the table as dominant if present
if (aTableFrame) { if (aTableFrame) {
GetColorAndStyle(aTableFrame, aSide, &border.style, &border.color, aTableIsLTR, &border.width); GetColorAndStyle(aTableFrame, aTableWM, aSide,
&border.style, &border.color, &border.width);
border.owner = eTableOwner; border.owner = eTableOwner;
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) { if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
return border; return border;
@ -4881,8 +4875,9 @@ CompareBorders(const nsIFrame* aTableFrame,
} }
// see if the colgroup is dominant // see if the colgroup is dominant
if (aColGroupFrame) { if (aColGroupFrame) {
GetColorAndStyle(aColGroupFrame, aSide, &tempBorder.style, &tempBorder.color, aTableIsLTR, &tempBorder.width); GetColorAndStyle(aColGroupFrame, aTableWM, aSide,
tempBorder.owner = (aAja && !horizontal) ? eAjaColGroupOwner : eColGroupOwner; &tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && !inlineAxis ? eAjaColGroupOwner : eColGroupOwner;
// pass here and below false for aSecondIsHorizontal as it is only used for corner calculations. // pass here and below false for aSecondIsHorizontal as it is only used for corner calculations.
border = CompareBorders(!CELL_CORNER, border, tempBorder, false); border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) { if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
@ -4891,8 +4886,9 @@ CompareBorders(const nsIFrame* aTableFrame,
} }
// see if the col is dominant // see if the col is dominant
if (aColFrame) { if (aColFrame) {
GetColorAndStyle(aColFrame, aSide, &tempBorder.style, &tempBorder.color, aTableIsLTR, &tempBorder.width); GetColorAndStyle(aColFrame, aTableWM, aSide,
tempBorder.owner = (aAja && !horizontal) ? eAjaColOwner : eColOwner; &tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && !inlineAxis ? eAjaColOwner : eColOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false); border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) { if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
return border; return border;
@ -4900,8 +4896,9 @@ CompareBorders(const nsIFrame* aTableFrame,
} }
// see if the rowgroup is dominant // see if the rowgroup is dominant
if (aRowGroupFrame) { if (aRowGroupFrame) {
GetColorAndStyle(aRowGroupFrame, aSide, &tempBorder.style, &tempBorder.color, aTableIsLTR, &tempBorder.width); GetColorAndStyle(aRowGroupFrame, aTableWM, aSide,
tempBorder.owner = (aAja && horizontal) ? eAjaRowGroupOwner : eRowGroupOwner; &tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && inlineAxis ? eAjaRowGroupOwner : eRowGroupOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false); border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) { if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
return border; return border;
@ -4909,8 +4906,9 @@ CompareBorders(const nsIFrame* aTableFrame,
} }
// see if the row is dominant // see if the row is dominant
if (aRowFrame) { if (aRowFrame) {
GetColorAndStyle(aRowFrame, aSide, &tempBorder.style, &tempBorder.color, aTableIsLTR, &tempBorder.width); GetColorAndStyle(aRowFrame, aTableWM, aSide,
tempBorder.owner = (aAja && horizontal) ? eAjaRowOwner : eRowOwner; &tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && inlineAxis ? eAjaRowOwner : eRowOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false); border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) { if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
return border; return border;
@ -4918,8 +4916,9 @@ CompareBorders(const nsIFrame* aTableFrame,
} }
// see if the cell is dominant // see if the cell is dominant
if (aCellFrame) { if (aCellFrame) {
GetColorAndStyle(aCellFrame, aSide, &tempBorder.style, &tempBorder.color, aTableIsLTR, &tempBorder.width); GetColorAndStyle(aCellFrame, aTableWM, aSide,
tempBorder.owner = (aAja) ? eAjaCellOwner : eCellOwner; &tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja ? eAjaCellOwner : eCellOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false); border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
} }
return border; return border;
@ -5288,21 +5287,21 @@ BCMapCellInfo::SetTableTopLeftContBCBorder()
//because it must include the table in the collapse //because it must include the table in the collapse
if (mTopRow) { if (mTopRow) {
currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup, currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup,
mTopRow, nullptr, mTableWM.IsBidiLTR(), mTopRow, nullptr, mTableWM,
NS_SIDE_TOP, !ADJACENT); eLogicalSideBStart, !ADJACENT);
mTopRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width); mTopRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
} }
if (mCgAtRight && mColGroup) { if (mCgAtRight && mColGroup) {
//calculate continuous top colgroup border once per colgroup //calculate continuous top colgroup border once per colgroup
currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup,
mTopRow, nullptr, mTableWM.IsBidiLTR(), mTopRow, nullptr, mTableWM,
NS_SIDE_TOP, !ADJACENT); eLogicalSideBStart, !ADJACENT);
mColGroup->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width); mColGroup->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
} }
if (0 == mColIndex) { if (0 == mColIndex) {
currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, nullptr, currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, nullptr,
nullptr, nullptr, mTableWM.IsBidiLTR(), NS_SIDE_LEFT, nullptr, nullptr, mTableWM,
!ADJACENT); eLogicalSideIStart, !ADJACENT);
mTableFrame->SetContinuousLeftBCBorderWidth(currentBorder.width); mTableFrame->SetContinuousLeftBCBorderWidth(currentBorder.width);
} }
} }
@ -5314,8 +5313,8 @@ BCMapCellInfo::SetRowGroupLeftContBCBorder()
//get row group continuous borders //get row group continuous borders
if (mRgAtBottom && mRowGroup) { //once per row group, so check for bottom if (mRgAtBottom && mRowGroup) { //once per row group, so check for bottom
currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup,
nullptr, nullptr, mTableWM.IsBidiLTR(), NS_SIDE_LEFT, nullptr, nullptr, mTableWM,
!ADJACENT); eLogicalSideIStart, !ADJACENT);
mRowGroup->SetContinuousBCBorderWidth(mStartSide, currentBorder.width); mRowGroup->SetContinuousBCBorderWidth(mStartSide, currentBorder.width);
} }
} }
@ -5327,7 +5326,7 @@ BCMapCellInfo::SetRowGroupRightContBCBorder()
//get row group continuous borders //get row group continuous borders
if (mRgAtBottom && mRowGroup) { //once per mRowGroup, so check for bottom if (mRgAtBottom && mRowGroup) { //once per mRowGroup, so check for bottom
currentBorder = CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup,
nullptr, nullptr, mTableWM.IsBidiLTR(), NS_SIDE_RIGHT, nullptr, nullptr, mTableWM, eLogicalSideIEnd,
ADJACENT); ADJACENT);
mRowGroup->SetContinuousBCBorderWidth(mEndSide, currentBorder.width); mRowGroup->SetContinuousBCBorderWidth(mEndSide, currentBorder.width);
} }
@ -5341,18 +5340,18 @@ BCMapCellInfo::SetColumnTopRightContBCBorder()
//we only need to do this once, so we'll do it only on the first row //we only need to do this once, so we'll do it only on the first row
currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame, currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
mCurrentColFrame, mRowGroup, mTopRow, nullptr, mCurrentColFrame, mRowGroup, mTopRow, nullptr,
mTableWM.IsBidiLTR(), NS_SIDE_TOP, !ADJACENT); mTableWM, eLogicalSideBStart, !ADJACENT);
((nsTableColFrame*) mCurrentColFrame)->SetContinuousBCBorderWidth(NS_SIDE_TOP, ((nsTableColFrame*) mCurrentColFrame)->SetContinuousBCBorderWidth(NS_SIDE_TOP,
currentBorder.width); currentBorder.width);
if (mNumTableCols == GetCellEndColIndex() + 1) { if (mNumTableCols == GetCellEndColIndex() + 1) {
currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame, currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
mCurrentColFrame, nullptr, nullptr, nullptr, mCurrentColFrame, nullptr, nullptr, nullptr,
mTableWM.IsBidiLTR(), NS_SIDE_RIGHT, !ADJACENT); mTableWM, eLogicalSideIEnd, !ADJACENT);
} }
else { else {
currentBorder = CompareBorders(nullptr, mCurrentColGroupFrame, currentBorder = CompareBorders(nullptr, mCurrentColGroupFrame,
mCurrentColFrame, nullptr,nullptr, nullptr, mCurrentColFrame, nullptr,nullptr, nullptr,
mTableWM.IsBidiLTR(), NS_SIDE_RIGHT, !ADJACENT); mTableWM, eLogicalSideIEnd, !ADJACENT);
} }
mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_RIGHT, mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_RIGHT,
currentBorder.width); currentBorder.width);
@ -5365,7 +5364,7 @@ BCMapCellInfo::SetColumnBottomContBCBorder()
//get col continuous border //get col continuous border
currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame, currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
mCurrentColFrame, mRowGroup, mBottomRow, mCurrentColFrame, mRowGroup, mBottomRow,
nullptr, mTableWM.IsBidiLTR(), NS_SIDE_BOTTOM, ADJACENT); nullptr, mTableWM, eLogicalSideBEnd, ADJACENT);
mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM,
currentBorder.width); currentBorder.width);
} }
@ -5376,8 +5375,8 @@ BCMapCellInfo::SetColGroupBottomContBCBorder()
BCCellBorder currentBorder; BCCellBorder currentBorder;
if (mColGroup) { if (mColGroup) {
currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup,
mBottomRow, nullptr, mTableWM.IsBidiLTR(), mBottomRow, nullptr, mTableWM,
NS_SIDE_BOTTOM, ADJACENT); eLogicalSideBEnd, ADJACENT);
mColGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width); mColGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width);
} }
} }
@ -5388,8 +5387,8 @@ BCMapCellInfo::SetRowGroupBottomContBCBorder()
BCCellBorder currentBorder; BCCellBorder currentBorder;
if (mRowGroup) { if (mRowGroup) {
currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup, currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup,
mBottomRow, nullptr, mTableWM.IsBidiLTR(), mBottomRow, nullptr, mTableWM,
NS_SIDE_BOTTOM, ADJACENT); eLogicalSideBEnd, ADJACENT);
mRowGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width); mRowGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width);
} }
} }
@ -5402,10 +5401,10 @@ BCMapCellInfo::SetInnerRowGroupBottomContBCBorder(const nsIFrame* aNextRowGroup,
const nsIFrame* rowgroup = (mRgAtBottom) ? mRowGroup : nullptr; const nsIFrame* rowgroup = (mRgAtBottom) ? mRowGroup : nullptr;
currentBorder = CompareBorders(nullptr, nullptr, nullptr, rowgroup, mBottomRow, currentBorder = CompareBorders(nullptr, nullptr, nullptr, rowgroup, mBottomRow,
nullptr, mTableWM.IsBidiLTR(), NS_SIDE_BOTTOM, ADJACENT); nullptr, mTableWM, eLogicalSideBEnd, ADJACENT);
adjacentBorder = CompareBorders(nullptr, nullptr, nullptr, aNextRowGroup, adjacentBorder = CompareBorders(nullptr, nullptr, nullptr, aNextRowGroup,
aNextRow, nullptr, mTableWM.IsBidiLTR(), NS_SIDE_TOP, aNextRow, nullptr, mTableWM, eLogicalSideBStart,
!ADJACENT); !ADJACENT);
currentBorder = CompareBorders(false, currentBorder, adjacentBorder, currentBorder = CompareBorders(false, currentBorder, adjacentBorder,
HORIZONTAL); HORIZONTAL);
@ -5424,8 +5423,8 @@ BCMapCellInfo::SetRowLeftContBCBorder()
if (mCurrentRowFrame) { if (mCurrentRowFrame) {
BCCellBorder currentBorder; BCCellBorder currentBorder;
currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup,
mCurrentRowFrame, nullptr, mTableWM.IsBidiLTR(), mCurrentRowFrame, nullptr, mTableWM,
NS_SIDE_LEFT, !ADJACENT); eLogicalSideIStart, !ADJACENT);
mCurrentRowFrame->SetContinuousBCBorderWidth(mStartSide, mCurrentRowFrame->SetContinuousBCBorderWidth(mStartSide,
currentBorder.width); currentBorder.width);
} }
@ -5437,8 +5436,8 @@ BCMapCellInfo::SetRowRightContBCBorder()
if (mCurrentRowFrame) { if (mCurrentRowFrame) {
BCCellBorder currentBorder; BCCellBorder currentBorder;
currentBorder = CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup, currentBorder = CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup,
mCurrentRowFrame, nullptr, mTableWM.IsBidiLTR(), mCurrentRowFrame, nullptr, mTableWM,
NS_SIDE_RIGHT, ADJACENT); eLogicalSideIEnd, ADJACENT);
mCurrentRowFrame->SetContinuousBCBorderWidth(mEndSide, mCurrentRowFrame->SetContinuousBCBorderWidth(mEndSide,
currentBorder.width); currentBorder.width);
} }
@ -5569,7 +5568,7 @@ BCCellBorder
BCMapCellInfo::GetTopEdgeBorder() BCMapCellInfo::GetTopEdgeBorder()
{ {
return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame, return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame,
mRowGroup, mTopRow, mCell, mTableWM.IsBidiLTR(), NS_SIDE_TOP, mRowGroup, mTopRow, mCell, mTableWM, eLogicalSideBStart,
!ADJACENT); !ADJACENT);
} }
@ -5577,21 +5576,21 @@ BCCellBorder
BCMapCellInfo::GetBottomEdgeBorder() BCMapCellInfo::GetBottomEdgeBorder()
{ {
return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame, return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame,
mRowGroup, mBottomRow, mCell, mTableWM.IsBidiLTR(), mRowGroup, mBottomRow, mCell, mTableWM,
NS_SIDE_BOTTOM, ADJACENT); eLogicalSideBEnd, ADJACENT);
} }
BCCellBorder BCCellBorder
BCMapCellInfo::GetLeftEdgeBorder() BCMapCellInfo::GetLeftEdgeBorder()
{ {
return CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup, return CompareBorders(mTableFrame, mColGroup, mLeftCol, mRowGroup,
mCurrentRowFrame, mCell, mTableWM.IsBidiLTR(), NS_SIDE_LEFT, mCurrentRowFrame, mCell, mTableWM, eLogicalSideIStart,
!ADJACENT); !ADJACENT);
} }
BCCellBorder BCCellBorder
BCMapCellInfo::GetRightEdgeBorder() BCMapCellInfo::GetRightEdgeBorder()
{ {
return CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup, return CompareBorders(mTableFrame, mColGroup, mRightCol, mRowGroup,
mCurrentRowFrame, mCell, mTableWM.IsBidiLTR(), NS_SIDE_RIGHT, mCurrentRowFrame, mCell, mTableWM, eLogicalSideIEnd,
ADJACENT); ADJACENT);
} }
BCCellBorder BCCellBorder
@ -5599,7 +5598,7 @@ BCMapCellInfo::GetRightInternalBorder()
{ {
const nsIFrame* cg = (mCgAtRight) ? mColGroup : nullptr; const nsIFrame* cg = (mCgAtRight) ? mColGroup : nullptr;
return CompareBorders(nullptr, cg, mRightCol, nullptr, nullptr, mCell, return CompareBorders(nullptr, cg, mRightCol, nullptr, nullptr, mCell,
mTableWM.IsBidiLTR(), NS_SIDE_RIGHT, ADJACENT); mTableWM, eLogicalSideIEnd, ADJACENT);
} }
BCCellBorder BCCellBorder
@ -5607,7 +5606,7 @@ BCMapCellInfo::GetLeftInternalBorder()
{ {
const nsIFrame* cg = (mCgAtLeft) ? mColGroup : nullptr; const nsIFrame* cg = (mCgAtLeft) ? mColGroup : nullptr;
return CompareBorders(nullptr, cg, mLeftCol, nullptr, nullptr, mCell, return CompareBorders(nullptr, cg, mLeftCol, nullptr, nullptr, mCell,
mTableWM.IsBidiLTR(), NS_SIDE_LEFT, !ADJACENT); mTableWM, eLogicalSideIStart, !ADJACENT);
} }
BCCellBorder BCCellBorder
@ -5615,7 +5614,7 @@ BCMapCellInfo::GetBottomInternalBorder()
{ {
const nsIFrame* rg = (mRgAtBottom) ? mRowGroup : nullptr; const nsIFrame* rg = (mRgAtBottom) ? mRowGroup : nullptr;
return CompareBorders(nullptr, nullptr, nullptr, rg, mBottomRow, mCell, return CompareBorders(nullptr, nullptr, nullptr, rg, mBottomRow, mCell,
mTableWM.IsBidiLTR(), NS_SIDE_BOTTOM, ADJACENT); mTableWM, eLogicalSideBEnd, ADJACENT);
} }
BCCellBorder BCCellBorder
@ -5623,7 +5622,7 @@ BCMapCellInfo::GetTopInternalBorder()
{ {
const nsIFrame* rg = (mRgAtTop) ? mRowGroup : nullptr; const nsIFrame* rg = (mRgAtTop) ? mRowGroup : nullptr;
return CompareBorders(nullptr, nullptr, nullptr, rg, mTopRow, mCell, return CompareBorders(nullptr, nullptr, nullptr, rg, mTopRow, mCell,
mTableWM.IsBidiLTR(), NS_SIDE_TOP, !ADJACENT); mTableWM, eLogicalSideBStart, !ADJACENT);
} }
/* Here is the order for storing border edges in the cell map as a cell is processed. There are /* Here is the order for storing border edges in the cell map as a cell is processed. There are
@ -6930,8 +6929,8 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
BCPixelSize aHorSegHeight) BCPixelSize aHorSegHeight)
{ {
// get the border style, color and paint the segment // get the border style, color and paint the segment
mozilla::css::Side side = (aIter.IsDamageAreaRightMost()) ? NS_SIDE_RIGHT : LogicalSide side =
NS_SIDE_LEFT; aIter.IsDamageAreaRightMost() ? eLogicalSideIEnd : eLogicalSideIStart;
int32_t relColIndex = aIter.GetRelativeColIndex(); int32_t relColIndex = aIter.GetRelativeColIndex();
nsTableColFrame* col = mCol; if (!col) ABORT0(); nsTableColFrame* col = mCol; if (!col) ABORT0();
nsTableCellFrame* cell = mFirstCell; // ??? nsTableCellFrame* cell = mFirstCell; // ???
@ -6948,7 +6947,7 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
owner = aIter.mTable; owner = aIter.mTable;
break; break;
case eAjaColGroupOwner: case eAjaColGroupOwner:
side = NS_SIDE_RIGHT; side = eLogicalSideIEnd;
if (!aIter.IsTableRightMost() && (relColIndex > 0)) { if (!aIter.IsTableRightMost() && (relColIndex > 0)) {
col = aIter.mVerInfo[relColIndex - 1].mCol; col = aIter.mVerInfo[relColIndex - 1].mCol;
} // and fall through } // and fall through
@ -6958,7 +6957,7 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
} }
break; break;
case eAjaColOwner: case eAjaColOwner:
side = NS_SIDE_RIGHT; side = eLogicalSideIEnd;
if (!aIter.IsTableRightMost() && (relColIndex > 0)) { if (!aIter.IsTableRightMost() && (relColIndex > 0)) {
col = aIter.mVerInfo[relColIndex - 1].mCol; col = aIter.mVerInfo[relColIndex - 1].mCol;
} // and fall through } // and fall through
@ -6981,14 +6980,14 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
owner = mFirstRow; owner = mFirstRow;
break; break;
case eAjaCellOwner: case eAjaCellOwner:
side = NS_SIDE_RIGHT; side = eLogicalSideIEnd;
cell = mAjaCell; // and fall through cell = mAjaCell; // and fall through
case eCellOwner: case eCellOwner:
owner = cell; owner = cell;
break; break;
} }
if (owner) { if (owner) {
::GetPaintStyleInfo(owner, side, &style, &color, aIter.mTableWM.IsBidiLTR()); ::GetPaintStyleInfo(owner, aIter.mTableWM, side, &style, &color);
} }
BCPixelSize smallHalf, largeHalf; BCPixelSize smallHalf, largeHalf;
DivideBCBorderSize(mWidth, smallHalf, largeHalf); DivideBCBorderSize(mWidth, smallHalf, largeHalf);
@ -7118,8 +7117,8 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
nsRenderingContext& aRenderingContext) nsRenderingContext& aRenderingContext)
{ {
// get the border style, color and paint the segment // get the border style, color and paint the segment
mozilla::css::Side side = (aIter.IsDamageAreaBottomMost()) ? NS_SIDE_BOTTOM : LogicalSide side =
NS_SIDE_TOP; aIter.IsDamageAreaBottomMost() ? eLogicalSideBEnd : eLogicalSideBStart;
nsIFrame* rg = aIter.mRg; if (!rg) ABORT0(); nsIFrame* rg = aIter.mRg; if (!rg) ABORT0();
nsIFrame* row = aIter.mRow; if (!row) ABORT0(); nsIFrame* row = aIter.mRow; if (!row) ABORT0();
nsIFrame* cell = mFirstCell; nsIFrame* cell = mFirstCell;
@ -7157,21 +7156,21 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
owner = aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex - 1); owner = aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex - 1);
break; break;
case eAjaRowGroupOwner: case eAjaRowGroupOwner:
side = NS_SIDE_BOTTOM; side = eLogicalSideBEnd;
rg = (aIter.IsTableBottomMost()) ? aIter.mRg : aIter.mPrevRg; rg = (aIter.IsTableBottomMost()) ? aIter.mRg : aIter.mPrevRg;
// and fall through // and fall through
case eRowGroupOwner: case eRowGroupOwner:
owner = rg; owner = rg;
break; break;
case eAjaRowOwner: case eAjaRowOwner:
side = NS_SIDE_BOTTOM; side = eLogicalSideBEnd;
row = (aIter.IsTableBottomMost()) ? aIter.mRow : aIter.mPrevRow; row = (aIter.IsTableBottomMost()) ? aIter.mRow : aIter.mPrevRow;
// and fall through // and fall through
case eRowOwner: case eRowOwner:
owner = row; owner = row;
break; break;
case eAjaCellOwner: case eAjaCellOwner:
side = NS_SIDE_BOTTOM; side = eLogicalSideBEnd;
// if this is null due to the damage area origin-y > 0, then the border // if this is null due to the damage area origin-y > 0, then the border
// won't show up anyway // won't show up anyway
cell = mAjaCell; cell = mAjaCell;
@ -7181,7 +7180,7 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
break; break;
} }
if (owner) { if (owner) {
::GetPaintStyleInfo(owner, side, &style, &color, aIter.mTableWM.IsBidiLTR()); ::GetPaintStyleInfo(owner, aIter.mTableWM, side, &style, &color);
} }
BCPixelSize smallHalf, largeHalf; BCPixelSize smallHalf, largeHalf;
DivideBCBorderSize(mWidth, smallHalf, largeHalf); DivideBCBorderSize(mWidth, smallHalf, largeHalf);