mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1176523
- Convert Get/SetContinuousBCBorderWidth in nsTableColFrame and nsTableColGroupFrame to logical coordinates. r=dholbert
This commit is contained in:
parent
3fe9408260
commit
d6ddc659a1
@ -95,13 +95,14 @@ public:
|
||||
|
||||
/**
|
||||
* Gets inner border widths before collapsing with cell borders
|
||||
* Caller must get left border from previous column or from table
|
||||
* GetContinuousBCBorderWidth will not overwrite aBorder.left
|
||||
* Caller must get istart border from previous column or from table
|
||||
* GetContinuousBCBorderWidth will not overwrite aBorder.IStart
|
||||
* see nsTablePainter about continuous borders
|
||||
*
|
||||
* @return outer right border width (left inner for next column)
|
||||
* @return outer iend border width (istart inner for next column)
|
||||
*/
|
||||
nscoord GetContinuousBCBorderWidth(nsMargin& aBorder);
|
||||
nscoord GetContinuousBCBorderWidth(mozilla::WritingMode aWM,
|
||||
mozilla::LogicalMargin& aBorder);
|
||||
/**
|
||||
* Set full border widths before collapsing with cell borders
|
||||
* @param aForSide - side to set; only valid for bstart, iend, and bend
|
||||
@ -325,18 +326,16 @@ inline void nsTableColFrame::SetColIndex (int32_t aColIndex)
|
||||
}
|
||||
|
||||
inline nscoord
|
||||
nsTableColFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
|
||||
nsTableColFrame::GetContinuousBCBorderWidth(mozilla::WritingMode aWM,
|
||||
mozilla::LogicalMargin& aBorder)
|
||||
{
|
||||
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
|
||||
mozilla::WritingMode wm = GetWritingMode();
|
||||
mozilla::LogicalMargin border(wm, aBorder);
|
||||
border.BStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
|
||||
mBStartContBorderWidth);
|
||||
border.IEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mIEndContBorderWidth);
|
||||
border.BEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mBEndContBorderWidth);
|
||||
aBorder = border.GetPhysicalMargin(wm);
|
||||
aBorder.BStart(aWM) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
|
||||
mBStartContBorderWidth);
|
||||
aBorder.IEnd(aWM) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mIEndContBorderWidth);
|
||||
aBorder.BEnd(aWM) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mBEndContBorderWidth);
|
||||
return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mIEndContBorderWidth);
|
||||
}
|
||||
|
||||
|
@ -416,31 +416,32 @@ int32_t nsTableColGroupFrame::GetSpan()
|
||||
return StyleTable()->mSpan;
|
||||
}
|
||||
|
||||
void nsTableColGroupFrame::SetContinuousBCBorderWidth(uint8_t aForSide,
|
||||
void nsTableColGroupFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
|
||||
BCPixelSize aPixelValue)
|
||||
{
|
||||
switch (aForSide) {
|
||||
case NS_SIDE_TOP:
|
||||
mTopContBorderWidth = aPixelValue;
|
||||
case eLogicalSideBStart:
|
||||
mBStartContBorderWidth = aPixelValue;
|
||||
return;
|
||||
case NS_SIDE_BOTTOM:
|
||||
mBottomContBorderWidth = aPixelValue;
|
||||
case eLogicalSideBEnd:
|
||||
mBEndContBorderWidth = aPixelValue;
|
||||
return;
|
||||
default:
|
||||
NS_ERROR("invalid side arg");
|
||||
}
|
||||
}
|
||||
|
||||
void nsTableColGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
|
||||
void nsTableColGroupFrame::GetContinuousBCBorderWidth(WritingMode aWM,
|
||||
LogicalMargin& aBorder)
|
||||
{
|
||||
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
|
||||
nsTableColFrame* col = GetTableFrame()->
|
||||
GetColFrame(mStartColIndex + mColCount - 1);
|
||||
col->GetContinuousBCBorderWidth(aBorder);
|
||||
aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
|
||||
mTopContBorderWidth);
|
||||
aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mBottomContBorderWidth);
|
||||
col->GetContinuousBCBorderWidth(aWM, aBorder);
|
||||
aBorder.BStart(aWM) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
|
||||
mBStartContBorderWidth);
|
||||
aBorder.BEnd(aWM) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
|
||||
mBEndContBorderWidth);
|
||||
}
|
||||
|
||||
/* ----- global methods ----- */
|
||||
|
@ -186,16 +186,17 @@ public:
|
||||
|
||||
/**
|
||||
* Gets inner border widths before collapsing with cell borders
|
||||
* Caller must get left border from previous column
|
||||
* GetContinuousBCBorderWidth will not overwrite aBorder.left
|
||||
* Caller must get istart border from previous column
|
||||
* GetContinuousBCBorderWidth will not overwrite aBorder.IStart
|
||||
* see nsTablePainter about continuous borders
|
||||
*/
|
||||
void GetContinuousBCBorderWidth(nsMargin& aBorder);
|
||||
void GetContinuousBCBorderWidth(mozilla::WritingMode aWM,
|
||||
mozilla::LogicalMargin& aBorder);
|
||||
/**
|
||||
* Set full border widths before collapsing with cell borders
|
||||
* @param aForSide - side to set; only accepts top and bottom
|
||||
* @param aForSide - side to set; only accepts bstart and bend
|
||||
*/
|
||||
void SetContinuousBCBorderWidth(uint8_t aForSide,
|
||||
void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
|
||||
BCPixelSize aPixelValue);
|
||||
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||
@ -221,8 +222,8 @@ protected:
|
||||
int32_t mStartColIndex;
|
||||
|
||||
// border width in pixels
|
||||
BCPixelSize mTopContBorderWidth;
|
||||
BCPixelSize mBottomContBorderWidth;
|
||||
BCPixelSize mBStartContBorderWidth;
|
||||
BCPixelSize mBEndContBorderWidth;
|
||||
};
|
||||
|
||||
inline nsTableColGroupFrame::nsTableColGroupFrame(nsStyleContext *aContext)
|
||||
|
@ -5383,7 +5383,7 @@ BCMapCellInfo::SetColGroupBEndContBCBorder()
|
||||
currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup,
|
||||
mEndRow, nullptr, mTableWM,
|
||||
eLogicalSideBEnd, ADJACENT);
|
||||
mColGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width);
|
||||
mColGroup->SetContinuousBCBorderWidth(eLogicalSideBEnd, currentBorder.width);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,26 +213,26 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
|
||||
if (aFirstRowGroup && aLastRowGroup && mNumCols > 0) {
|
||||
//only handle non-degenerate tables; we need a more robust BC model
|
||||
//to make degenerate tables' borders reasonable to deal with
|
||||
nsMargin border, tempBorder;
|
||||
LogicalMargin border(wm);
|
||||
LogicalMargin tempBorder(wm);
|
||||
nsTableColFrame* colFrame = aTableFrame->GetColFrame(mNumCols - 1);
|
||||
if (colFrame) {
|
||||
colFrame->GetContinuousBCBorderWidth(tempBorder);
|
||||
colFrame->GetContinuousBCBorderWidth(wm, tempBorder);
|
||||
}
|
||||
border.right = tempBorder.right;
|
||||
border.IEnd(wm) = tempBorder.IEnd(wm);
|
||||
|
||||
LogicalMargin logBorder(wm);
|
||||
aLastRowGroup->GetContinuousBCBorderWidth(wm, logBorder);
|
||||
border.bottom = logBorder.Bottom(wm);
|
||||
aLastRowGroup->GetContinuousBCBorderWidth(wm, tempBorder);
|
||||
border.BEnd(wm) = tempBorder.BEnd(wm);
|
||||
|
||||
nsTableRowFrame* rowFrame = aFirstRowGroup->GetFirstRow();
|
||||
if (rowFrame) {
|
||||
rowFrame->GetContinuousBCBorderWidth(wm, logBorder);
|
||||
border.top = logBorder.Top(wm);
|
||||
rowFrame->GetContinuousBCBorderWidth(wm, tempBorder);
|
||||
border.BStart(wm) = tempBorder.BStart(wm);
|
||||
}
|
||||
|
||||
border.left = aTableFrame->GetContinuousLeftBCBorderWidth();
|
||||
border.IStart(wm) = aTableFrame->GetContinuousLeftBCBorderWidth();
|
||||
|
||||
tableData.SetBCBorder(border);
|
||||
tableData.SetBCBorder(border.GetPhysicalMargin(wm));
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,6 +279,7 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
||||
|
||||
nsTableFrame::RowGroupArray rowGroups;
|
||||
aTableFrame->OrderRowGroups(rowGroups);
|
||||
WritingMode wm = aTableFrame->GetWritingMode();
|
||||
|
||||
DrawResult result = DrawResult::SUCCESS;
|
||||
|
||||
@ -317,7 +318,7 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
||||
// mColGroups is destroyed as part of TablePainter destruction.
|
||||
mColGroups.SetCapacity(colGroupFrames.Length());
|
||||
|
||||
nsMargin border;
|
||||
LogicalMargin border(wm);
|
||||
/* BC left borders aren't stored on cols, but the previous column's
|
||||
right border is the next one's left border.*/
|
||||
//Start with table's left border.
|
||||
@ -327,9 +328,9 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
||||
/*Create data struct for column group*/
|
||||
TableBackgroundData& cgData = *mColGroups.AppendElement(TableBackgroundData(cgFrame));
|
||||
if (mIsBorderCollapse && cgData.ShouldSetBCBorder()) {
|
||||
border.left = lastLeftBorder;
|
||||
cgFrame->GetContinuousBCBorderWidth(border);
|
||||
cgData.SetBCBorder(border);
|
||||
border.IStart(wm) = lastLeftBorder;
|
||||
cgFrame->GetContinuousBCBorderWidth(wm, border);
|
||||
cgData.SetBCBorder(border.GetPhysicalMargin(wm));
|
||||
}
|
||||
|
||||
/*Loop over columns in this colgroup*/
|
||||
@ -341,10 +342,10 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
||||
//Bring column mRect into table's coord system
|
||||
colData.mCol.mRect.MoveBy(cgData.mRect.x, cgData.mRect.y);
|
||||
if (mIsBorderCollapse) {
|
||||
border.left = lastLeftBorder;
|
||||
lastLeftBorder = col->GetContinuousBCBorderWidth(border);
|
||||
border.IStart(wm) = lastLeftBorder;
|
||||
lastLeftBorder = col->GetContinuousBCBorderWidth(wm, border);
|
||||
if (colData.mCol.ShouldSetBCBorder()) {
|
||||
colData.mCol.SetBCBorder(border);
|
||||
colData.mCol.SetBCBorder(border.GetPhysicalMargin(wm));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user