Bug 1157569 part 9 - Rename methods and fields in nsTableRowFrame from physicals to logicals. r=roc

--HG--
extra : source : ce0fb2e11506e7aafffd88ee628bf8485648de24
This commit is contained in:
Xidorn Quan 2015-05-04 19:09:25 +12:00
Родитель a6a99c50ec
Коммит 79661faf79
6 изменённых файлов: 80 добавлений и 83 удалений

Просмотреть файл

@ -2672,7 +2672,10 @@ nsTableFrame::InitChildReflowState(nsHTMLReflowState& aReflowState)
if (IsBorderCollapse()) {
nsTableRowGroupFrame* rgFrame =
static_cast<nsTableRowGroupFrame*>(aReflowState.frame);
pCollapseBorder = rgFrame->GetBCBorderWidth(collapseBorder);
WritingMode wm = GetWritingMode();
LogicalMargin border = rgFrame->GetBCBorderWidth(wm);
collapseBorder = border.GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
}
aReflowState.Init(presContext, -1, -1, pCollapseBorder, &padding);
@ -5289,14 +5292,16 @@ BCMapCellInfo::SetTableBStartIStartContBCBorder()
currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup,
mStartRow, nullptr, mTableWM,
eLogicalSideBStart, !ADJACENT);
mStartRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
mStartRow->SetContinuousBCBorderWidth(eLogicalSideBStart,
currentBorder.width);
}
if (mCgAtEnd && mColGroup) {
//calculate continuous top colgroup border once per colgroup
currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup,
mStartRow, nullptr, mTableWM,
eLogicalSideBStart, !ADJACENT);
mColGroup->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
mColGroup->SetContinuousBCBorderWidth(eLogicalSideBStart,
currentBorder.width);
}
if (0 == mColIndex) {
currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol, nullptr,
@ -5315,7 +5320,8 @@ BCMapCellInfo::SetRowGroupIStartContBCBorder()
currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol,
mRowGroup, nullptr, nullptr, mTableWM,
eLogicalSideIStart, !ADJACENT);
mRowGroup->SetContinuousBCBorderWidth(mStartSide, currentBorder.width);
mRowGroup->SetContinuousBCBorderWidth(eLogicalSideIStart,
currentBorder.width);
}
}
@ -5328,7 +5334,8 @@ BCMapCellInfo::SetRowGroupIEndContBCBorder()
currentBorder = CompareBorders(mTableFrame, mColGroup, mEndCol, mRowGroup,
nullptr, nullptr, mTableWM, eLogicalSideIEnd,
ADJACENT);
mRowGroup->SetContinuousBCBorderWidth(mEndSide, currentBorder.width);
mRowGroup->SetContinuousBCBorderWidth(eLogicalSideIEnd,
currentBorder.width);
}
}
@ -5410,7 +5417,8 @@ BCMapCellInfo::SetInnerRowGroupBEndContBCBorder(const nsIFrame* aNextRowGroup,
currentBorder = CompareBorders(false, currentBorder, adjacentBorder,
HORIZONTAL);
if (aNextRow) {
aNextRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
aNextRow->SetContinuousBCBorderWidth(eLogicalSideBStart,
currentBorder.width);
}
if (mRgAtEnd && mRowGroup) {
mRowGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width);
@ -5426,7 +5434,7 @@ BCMapCellInfo::SetRowIStartContBCBorder()
currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol,
mRowGroup, mCurrentRowFrame, nullptr,
mTableWM, eLogicalSideIStart, !ADJACENT);
mCurrentRowFrame->SetContinuousBCBorderWidth(mStartSide,
mCurrentRowFrame->SetContinuousBCBorderWidth(eLogicalSideIStart,
currentBorder.width);
}
}
@ -5439,7 +5447,7 @@ BCMapCellInfo::SetRowIEndContBCBorder()
currentBorder = CompareBorders(mTableFrame, mColGroup, mEndCol, mRowGroup,
mCurrentRowFrame, nullptr, mTableWM,
eLogicalSideIEnd, ADJACENT);
mCurrentRowFrame->SetContinuousBCBorderWidth(mEndSide,
mCurrentRowFrame->SetContinuousBCBorderWidth(eLogicalSideIEnd,
currentBorder.width);
}
}
@ -5506,8 +5514,8 @@ BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth)
}
if (mEndRow) {
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
mEndRow->SetBottomBCBorderWidth(
std::max(nscoord(half), mEndRow->GetBottomBCBorderWidth()));
mEndRow->SetBEndBCBorderWidth(
std::max(nscoord(half), mEndRow->GetBEndBCBorderWidth()));
}
}
void
@ -5519,8 +5527,8 @@ BCMapCellInfo::SetBStartBorderWidths(BCPixelSize aWidth)
}
if (mStartRow) {
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
mStartRow->SetTopBCBorderWidth(
std::max(nscoord(half), mStartRow->GetTopBCBorderWidth()));
mStartRow->SetBStartBCBorderWidth(
std::max(nscoord(half), mStartRow->GetBStartBCBorderWidth()));
}
}
void
@ -6412,7 +6420,7 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
if (haveIntersect) {
// conservatively estimate the half border widths outside the row
nscoord borderHalf = mTable->GetPrevInFlow() ? 0 : nsPresContext::
CSSPixelsToAppUnits(rowFrame->GetTopBCBorderWidth() + 1);
CSSPixelsToAppUnits(rowFrame->GetBStartBCBorderWidth() + 1);
if (aDirtyRect.YMost() >= rowY - borderHalf) {
nsTableRowFrame* fifRow =
static_cast<nsTableRowFrame*>(rowFrame->FirstInFlow());
@ -6423,7 +6431,7 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
else {
// conservatively estimate the half border widths outside the row
nscoord borderHalf = mTable->GetNextInFlow() ? 0 : nsPresContext::
CSSPixelsToAppUnits(rowFrame->GetBottomBCBorderWidth() + 1);
CSSPixelsToAppUnits(rowFrame->GetBEndBCBorderWidth() + 1);
if (rowY + rowSize.height + borderHalf >= aDirtyRect.y) {
mStartRg = rgFrame;
mStartRow = rowFrame;

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsTablePainter.h"
#include "nsCSSRendering.h"
#include "nsDisplayList.h"
#include "mozilla/WritingModes.h"
/* ~*~ Table Background Painting ~*~
@ -95,6 +96,7 @@
XXX views are going
*/
using namespace mozilla;
using namespace mozilla::image;
TableBackgroundPainter::TableBackgroundData::TableBackgroundData()
@ -489,7 +491,9 @@ TableBackgroundPainter::PaintRow(nsTableRowFrame* aFrame,
nsMargin border;
nsTableRowFrame* nextRow = aFrame->GetNextRow();
if (nextRow) { //outer top below us is inner bottom for us
border.bottom = nextRow->GetOuterTopContBCBorderWidth();
WritingMode wm = nextRow->GetWritingMode();
border.Side(wm.PhysicalSide(eLogicalSideBEnd)) =
nextRow->GetOuterBStartContBCBorderWidth();
}
else { //acquire rg's bottom border
nsTableRowGroupFrame* rowGroup = static_cast<nsTableRowGroupFrame*>(aFrame->GetParent());

Просмотреть файл

@ -1373,18 +1373,18 @@ nsTableRowFrame::GetUnpaginatedHeight(nsPresContext* aPresContext)
return NS_PTR_TO_INT32(props.Get(RowUnpaginatedHeightProperty()));
}
void nsTableRowFrame::SetContinuousBCBorderWidth(uint8_t aForSide,
void nsTableRowFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
BCPixelSize aPixelValue)
{
switch (aForSide) {
case NS_SIDE_RIGHT:
mRightContBorderWidth = aPixelValue;
case eLogicalSideIEnd:
mIEndContBorderWidth = aPixelValue;
return;
case NS_SIDE_TOP:
mTopContBorderWidth = aPixelValue;
case eLogicalSideBStart:
mBStartContBorderWidth = aPixelValue;
return;
case NS_SIDE_LEFT:
mLeftContBorderWidth = aPixelValue;
case eLogicalSideIStart:
mIStartContBorderWidth = aPixelValue;
return;
default:
NS_ERROR("invalid NS_SIDE arg");

Просмотреть файл

@ -211,28 +211,28 @@ public:
nscoord GetUnpaginatedHeight(nsPresContext* aPresContext);
void SetUnpaginatedHeight(nsPresContext* aPresContext, nscoord aValue);
nscoord GetTopBCBorderWidth();
void SetTopBCBorderWidth(BCPixelSize aWidth);
nscoord GetBottomBCBorderWidth();
void SetBottomBCBorderWidth(BCPixelSize aWidth);
nsMargin* GetBCBorderWidth(nsMargin& aBorder);
nscoord GetBStartBCBorderWidth() const { return mBStartBorderWidth; }
nscoord GetBEndBCBorderWidth() const { return mBEndBorderWidth; }
void SetBStartBCBorderWidth(BCPixelSize aWidth) { mBStartBorderWidth = aWidth; }
void SetBEndBCBorderWidth(BCPixelSize aWidth) { mBEndBorderWidth = aWidth; }
mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
/**
* Gets inner border widths before collapsing with cell borders
* Caller must get bottom border from next row or from table
* GetContinuousBCBorderWidth will not overwrite aBorder.bottom
* Caller must get block-end border from next row or from table
* GetContinuousBCBorderWidth will not overwrite that border
* see nsTablePainter about continuous borders
*/
void GetContinuousBCBorderWidth(nsMargin& aBorder);
/**
* @returns outer top bc border == prev row's bottom inner
* @returns outer block-start bc border == prev row's block-end inner
*/
nscoord GetOuterTopContBCBorderWidth();
nscoord GetOuterBStartContBCBorderWidth();
/**
* Sets full border widths before collapsing with cell borders
* @param aForSide - side to set; only accepts right, left, and top
* @param aForSide - side to set; only accepts iend, istart, and bstart
*/
void SetContinuousBCBorderWidth(uint8_t aForSide,
void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
BCPixelSize aPixelValue);
virtual bool IsFrameOfType(uint32_t aFlags) const override
@ -300,11 +300,11 @@ private:
// border widths in pixels in the collapsing border model of the *inner*
// half of the border only
BCPixelSize mTopBorderWidth;
BCPixelSize mBottomBorderWidth;
BCPixelSize mRightContBorderWidth;
BCPixelSize mTopContBorderWidth;
BCPixelSize mLeftContBorderWidth;
BCPixelSize mBStartBorderWidth;
BCPixelSize mBEndBorderWidth;
BCPixelSize mIEndContBorderWidth;
BCPixelSize mBStartContBorderWidth;
BCPixelSize mIStartContBorderWidth;
/**
* Sets the NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT bit to indicate whether
@ -401,52 +401,33 @@ inline void nsTableRowFrame::SetHasUnpaginatedHeight(bool aValue)
}
}
inline nscoord nsTableRowFrame::GetTopBCBorderWidth()
inline mozilla::LogicalMargin
nsTableRowFrame::GetBCBorderWidth(mozilla::WritingMode aWM)
{
return mTopBorderWidth;
}
inline void nsTableRowFrame::SetTopBCBorderWidth(BCPixelSize aWidth)
{
mTopBorderWidth = aWidth;
}
inline nscoord nsTableRowFrame::GetBottomBCBorderWidth()
{
return mBottomBorderWidth;
}
inline void nsTableRowFrame::SetBottomBCBorderWidth(BCPixelSize aWidth)
{
mBottomBorderWidth = aWidth;
}
inline nsMargin* nsTableRowFrame::GetBCBorderWidth(nsMargin& aBorder)
{
aBorder.left = aBorder.right = 0;
aBorder.top = nsPresContext::CSSPixelsToAppUnits(mTopBorderWidth);
aBorder.bottom = nsPresContext::CSSPixelsToAppUnits(mBottomBorderWidth);
return &aBorder;
return mozilla::LogicalMargin(
aWM, nsPresContext::CSSPixelsToAppUnits(mBStartBorderWidth), 0,
nsPresContext::CSSPixelsToAppUnits(mBEndBorderWidth), 0);
}
inline void
nsTableRowFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
{
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
mLeftContBorderWidth);
aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
mTopContBorderWidth);
aBorder.left = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
mRightContBorderWidth);
mozilla::WritingMode wm = GetWritingMode();
mozilla::LogicalMargin border(wm, aBorder);
border.IEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
mIStartContBorderWidth);
border.BStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
mBStartContBorderWidth);
border.IStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
mIEndContBorderWidth);
aBorder = border.GetPhysicalMargin(wm);
}
inline nscoord nsTableRowFrame::GetOuterTopContBCBorderWidth()
inline nscoord nsTableRowFrame::GetOuterBStartContBCBorderWidth()
{
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
return BC_BORDER_START_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
return BC_BORDER_START_HALF_COORD(aPixelsToTwips, mBStartContBorderWidth);
}
#endif

Просмотреть файл

@ -296,7 +296,10 @@ nsTableRowGroupFrame::InitChildReflowState(nsPresContext& aPresContext,
if (aBorderCollapse) {
nsTableRowFrame *rowFrame = do_QueryFrame(aReflowState.frame);
if (rowFrame) {
pCollapseBorder = rowFrame->GetBCBorderWidth(collapseBorder);
WritingMode wm = GetWritingMode();
LogicalMargin border = rowFrame->GetBCBorderWidth(wm);
collapseBorder = border.GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
}
}
aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder, &padding);
@ -1600,11 +1603,10 @@ nsTableRowGroupFrame::GetFrameName(nsAString& aResult) const
}
#endif
nsMargin*
nsTableRowGroupFrame::GetBCBorderWidth(nsMargin& aBorder)
LogicalMargin
nsTableRowGroupFrame::GetBCBorderWidth(WritingMode aWM)
{
aBorder.left = aBorder.right = aBorder.top = aBorder.bottom = 0;
LogicalMargin border(aWM);
nsTableRowFrame* firstRowFrame = nullptr;
nsTableRowFrame* lastRowFrame = nullptr;
for (nsTableRowFrame* rowFrame = GetFirstRow(); rowFrame; rowFrame = rowFrame->GetNextRow()) {
@ -1614,11 +1616,12 @@ nsTableRowGroupFrame::GetBCBorderWidth(nsMargin& aBorder)
lastRowFrame = rowFrame;
}
if (firstRowFrame) {
aBorder.top = nsPresContext::CSSPixelsToAppUnits(firstRowFrame->GetTopBCBorderWidth());
aBorder.bottom = nsPresContext::CSSPixelsToAppUnits(lastRowFrame->GetBottomBCBorderWidth());
border.BStart(aWM) = nsPresContext::
CSSPixelsToAppUnits(firstRowFrame->GetBStartBCBorderWidth());
border.BEnd(aWM) = nsPresContext::
CSSPixelsToAppUnits(lastRowFrame->GetBEndBCBorderWidth());
}
return &aBorder;
return border;
}
void nsTableRowGroupFrame::SetContinuousBCBorderWidth(uint8_t aForSide,

Просмотреть файл

@ -13,6 +13,7 @@
#include "nsTablePainter.h"
#include "nsTArray.h"
#include "nsTableFrame.h"
#include "mozilla/WritingModes.h"
class nsTableRowFrame;
@ -161,7 +162,7 @@ public:
*/
nscoord GetHeightBasis(const nsHTMLReflowState& aReflowState);
nsMargin* GetBCBorderWidth(nsMargin& aBorder);
mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
/**
* Gets inner border widths before collapsing with cell borders