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

This commit is contained in:
Xidorn Quan 2015-05-04 19:09:25 +12:00
parent 2697790922
commit a6add7157b
3 changed files with 44 additions and 58 deletions

View File

@ -13,6 +13,8 @@
#include "nsCSSRendering.h"
#include "nsIContent.h"
using namespace mozilla;
#define COL_TYPE_BITS (NS_FRAME_STATE_BIT(28) | \
NS_FRAME_STATE_BIT(29) | \
NS_FRAME_STATE_BIT(30) | \
@ -69,18 +71,18 @@ nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
}
}
void nsTableColFrame::SetContinuousBCBorderWidth(uint8_t aForSide,
void nsTableColFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
BCPixelSize aPixelValue)
{
switch (aForSide) {
case NS_SIDE_TOP:
mTopContBorderWidth = aPixelValue;
case eLogicalSideBStart:
mBStartContBorderWidth = aPixelValue;
return;
case NS_SIDE_RIGHT:
mRightContBorderWidth = aPixelValue;
case eLogicalSideIEnd:
mIEndContBorderWidth = aPixelValue;
return;
case NS_SIDE_BOTTOM:
mBottomContBorderWidth = aPixelValue;
case eLogicalSideBEnd:
mBEndContBorderWidth = aPixelValue;
return;
default:
NS_ERROR("invalid side arg");

View File

@ -88,10 +88,10 @@ public:
/** convenience method, calls into cellmap */
int32_t Count() const;
nscoord GetLeftBorderWidth();
void SetLeftBorderWidth(BCPixelSize aWidth);
nscoord GetRightBorderWidth();
void SetRightBorderWidth(BCPixelSize aWidth);
nscoord GetIStartBorderWidth() const { return mIStartBorderWidth; }
nscoord GetIEndBorderWidth() const { return mIEndBorderWidth; }
void SetIStartBorderWidth(BCPixelSize aWidth) { mIStartBorderWidth = aWidth; }
void SetIEndBorderWidth(BCPixelSize aWidth) { mIEndBorderWidth = aWidth; }
/**
* Gets inner border widths before collapsing with cell borders
@ -104,9 +104,9 @@ public:
nscoord GetContinuousBCBorderWidth(nsMargin& aBorder);
/**
* Set full border widths before collapsing with cell borders
* @param aForSide - side to set; only valid for top, right, and bottom
* @param aForSide - side to set; only valid for bstart, iend, and bend
*/
void SetContinuousBCBorderWidth(uint8_t aForSide,
void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
BCPixelSize aPixelValue);
#ifdef DEBUG
void Dump(int32_t aIndent);
@ -305,11 +305,11 @@ protected:
uint32_t mColIndex;
// border width in pixels of the inner half of the border only
BCPixelSize mLeftBorderWidth;
BCPixelSize mRightBorderWidth;
BCPixelSize mTopContBorderWidth;
BCPixelSize mRightContBorderWidth;
BCPixelSize mBottomContBorderWidth;
BCPixelSize mIStartBorderWidth;
BCPixelSize mIEndBorderWidth;
BCPixelSize mBStartContBorderWidth;
BCPixelSize mIEndContBorderWidth;
BCPixelSize mBEndContBorderWidth;
bool mHasSpecifiedCoord;
};
@ -324,36 +324,20 @@ inline void nsTableColFrame::SetColIndex (int32_t aColIndex)
mColIndex = aColIndex;
}
inline nscoord nsTableColFrame::GetLeftBorderWidth()
{
return mLeftBorderWidth;
}
inline void nsTableColFrame::SetLeftBorderWidth(BCPixelSize aWidth)
{
mLeftBorderWidth = aWidth;
}
inline nscoord nsTableColFrame::GetRightBorderWidth()
{
return mRightBorderWidth;
}
inline void nsTableColFrame::SetRightBorderWidth(BCPixelSize aWidth)
{
mRightBorderWidth = aWidth;
}
inline nscoord
nsTableColFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
{
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
mRightContBorderWidth);
aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
mBottomContBorderWidth);
return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mRightContBorderWidth);
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);
return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mIEndContBorderWidth);
}
#endif

View File

@ -5342,8 +5342,8 @@ BCMapCellInfo::SetColumnBStartIEndContBCBorder()
mCurrentColFrame, mRowGroup, mStartRow,
nullptr, mTableWM, eLogicalSideBStart,
!ADJACENT);
((nsTableColFrame*) mCurrentColFrame)->SetContinuousBCBorderWidth(NS_SIDE_TOP,
currentBorder.width);
((nsTableColFrame*) mCurrentColFrame)->
SetContinuousBCBorderWidth(eLogicalSideBStart, currentBorder.width);
if (mNumTableCols == GetCellEndColIndex() + 1) {
currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
mCurrentColFrame, nullptr, nullptr, nullptr,
@ -5354,7 +5354,7 @@ BCMapCellInfo::SetColumnBStartIEndContBCBorder()
mCurrentColFrame, nullptr,nullptr, nullptr,
mTableWM, eLogicalSideIEnd, !ADJACENT);
}
mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_RIGHT,
mCurrentColFrame->SetContinuousBCBorderWidth(eLogicalSideIEnd,
currentBorder.width);
}
@ -5366,7 +5366,7 @@ BCMapCellInfo::SetColumnBEndContBCBorder()
currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
mCurrentColFrame, mRowGroup, mEndRow,
nullptr, mTableWM, eLogicalSideBEnd, ADJACENT);
mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM,
mCurrentColFrame->SetContinuousBCBorderWidth(eLogicalSideBEnd,
currentBorder.width);
}
@ -5491,8 +5491,8 @@ BCMapCellInfo::SetIEndBorderWidths(BCPixelSize aWidth)
}
if (mEndCol) {
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
mEndCol->SetRightBorderWidth(std::max(nscoord(half),
mEndCol->GetRightBorderWidth()));
mEndCol->SetIEndBorderWidth(
std::max(nscoord(half), mEndCol->GetIEndBorderWidth()));
}
}
@ -5532,8 +5532,8 @@ BCMapCellInfo::SetIStartBorderWidths(BCPixelSize aWidth)
}
if (mStartCol) {
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
mStartCol->SetLeftBorderWidth(std::max(nscoord(half),
mStartCol->GetLeftBorderWidth()));
mStartCol->SetIStartBorderWidth(
std::max(nscoord(half), mStartCol->GetIStartBorderWidth()));
}
}
@ -6474,18 +6474,18 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nsSize size = colFrame->GetSize();
if (haveIntersect) {
// conservatively estimate the left half border width outside the col
nscoord leftBorderHalf =
nsPresContext::CSSPixelsToAppUnits(colFrame->GetLeftBorderWidth() + 1);
if (aDirtyRect.XMost() >= (x - leftBorderHalf)) {
nscoord istartBorderHalf = nsPresContext::
CSSPixelsToAppUnits(colFrame->GetIStartBorderWidth() + 1);
if (aDirtyRect.XMost() >= x - istartBorderHalf) {
endColIndex = colX;
}
else break;
}
else {
// conservatively estimate the right half border width outside the col
nscoord rightBorderHalf =
nsPresContext::CSSPixelsToAppUnits(colFrame->GetRightBorderWidth() + 1);
if ((x + size.width + rightBorderHalf) >= aDirtyRect.x) {
nscoord iendBorderHalf = nsPresContext::
CSSPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
if (x + size.width + iendBorderHalf >= aDirtyRect.x) {
startColIndex = endColIndex = colX;
haveIntersect = true;
}