зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1825384 - Use app units in border-collapsed table data, not dev pixels. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D187140
This commit is contained in:
Родитель
d8f4e6b197
Коммит
c2e27a0f1a
|
@ -146,26 +146,16 @@ enum BCBorderOwner {
|
|||
eAjaCellOwner = 10 // cell to the top or to the left
|
||||
};
|
||||
|
||||
// BCPixelSize is in device pixels.
|
||||
typedef uint16_t BCPixelSize;
|
||||
|
||||
// These are the max sizes that are stored. If they are exceeded, then the max
|
||||
// is stored and the actual value is computed when needed.
|
||||
#define MAX_BORDER_WIDTH nscoord((1u << (sizeof(BCPixelSize) * 8)) - 1)
|
||||
#define MAX_BORDER_WIDTH nscoord((1u << (sizeof(uint16_t) * 8)) - 1)
|
||||
|
||||
// The half of border on inline/block-axis start side
|
||||
static inline BCPixelSize BC_BORDER_START_HALF(BCPixelSize px) {
|
||||
return px - px / 2;
|
||||
static inline nscoord BC_BORDER_START_HALF(nscoord aCoord) {
|
||||
return aCoord - aCoord / 2;
|
||||
}
|
||||
// The half of border on inline/block-axis end side
|
||||
static inline BCPixelSize BC_BORDER_END_HALF(BCPixelSize px) { return px / 2; }
|
||||
|
||||
static inline nscoord BC_BORDER_START_HALF_COORD(int32_t d2a, BCPixelSize px) {
|
||||
return BC_BORDER_START_HALF(px) * d2a;
|
||||
}
|
||||
static inline nscoord BC_BORDER_END_HALF_COORD(int32_t d2a, BCPixelSize px) {
|
||||
return BC_BORDER_END_HALF(px) * d2a;
|
||||
}
|
||||
static inline nscoord BC_BORDER_END_HALF(nscoord aCoord) { return aCoord / 2; }
|
||||
|
||||
// BCData stores the bstart and istart border info and the corner connecting the
|
||||
// two.
|
||||
|
@ -183,10 +173,9 @@ class BCData {
|
|||
|
||||
void SetBStartEdge(BCBorderOwner aOwner, nscoord aSize, bool aStart);
|
||||
|
||||
BCPixelSize GetCorner(mozilla::LogicalSide& aCornerOwner, bool& aBevel) const;
|
||||
nscoord GetCorner(mozilla::LogicalSide& aOwnerSide, bool& aBevel) const;
|
||||
|
||||
void SetCorner(BCPixelSize aSubSize, mozilla::LogicalSide aOwner,
|
||||
bool aBevel);
|
||||
void SetCorner(nscoord aSubSize, mozilla::LogicalSide aOwner, bool aBevel);
|
||||
|
||||
inline bool IsIStartStart() const { return (bool)mIStartStart; }
|
||||
|
||||
|
@ -197,23 +186,23 @@ class BCData {
|
|||
inline void SetBStartStart(bool aValue) { mBStartStart = aValue; }
|
||||
|
||||
protected:
|
||||
BCPixelSize mIStartSize; // size in pixels of iStart border
|
||||
BCPixelSize mBStartSize; // size in pixels of bStart border
|
||||
BCPixelSize mCornerSubSize; // size of the largest border not in the
|
||||
// dominant plane (for example, if corner is
|
||||
// owned by the segment to its bStart or bEnd,
|
||||
// then the size is the max of the border
|
||||
// sizes of the segments to its iStart or iEnd.
|
||||
unsigned mIStartOwner : 4; // owner of iStart border
|
||||
unsigned mBStartOwner : 4; // owner of bStart border
|
||||
unsigned mIStartStart : 1; // set if this is the start of a block-dir border
|
||||
// segment
|
||||
unsigned mBStartStart : 1; // set if this is the start of an inline-dir
|
||||
// border segment
|
||||
unsigned mCornerSide : 2; // LogicalSide of the owner of the bStart-iStart
|
||||
// corner relative to the corner
|
||||
unsigned mCornerBevel : 1; // is the corner beveled (only two segments,
|
||||
// perpendicular, not dashed or dotted).
|
||||
nscoord mIStartSize; // size of iStart border
|
||||
nscoord mBStartSize; // size of bStart border
|
||||
nscoord mCornerSubSize; // size of the largest border not in the
|
||||
// dominant plane (for example, if corner is
|
||||
// owned by the segment to its bStart or bEnd,
|
||||
// then the size is the max of the border
|
||||
// sizes of the segments to its iStart or iEnd.
|
||||
unsigned mIStartOwner : 4; // owner of iStart border
|
||||
unsigned mBStartOwner : 4; // owner of bStart border
|
||||
unsigned mIStartStart : 1; // set if this is the start of a block-dir border
|
||||
// segment
|
||||
unsigned mBStartStart : 1; // set if this is the start of an inline-dir
|
||||
// border segment
|
||||
unsigned mCornerSide : 2; // LogicalSide of the owner of the bStart-iStart
|
||||
// corner relative to the corner
|
||||
unsigned mCornerBevel : 1; // is the corner beveled (only two segments,
|
||||
// perpendicular, not dashed or dotted).
|
||||
};
|
||||
|
||||
// BCCellData entries replace CellData entries in the cell map if the border
|
||||
|
@ -383,15 +372,15 @@ inline void BCData::SetBStartEdge(BCBorderOwner aOwner, nscoord aSize,
|
|||
SetBStartStart(aStart);
|
||||
}
|
||||
|
||||
inline BCPixelSize BCData::GetCorner(mozilla::LogicalSide& aOwnerSide,
|
||||
bool& aBevel) const {
|
||||
inline nscoord BCData::GetCorner(mozilla::LogicalSide& aOwnerSide,
|
||||
bool& aBevel) const {
|
||||
aOwnerSide = mozilla::LogicalSide(mCornerSide);
|
||||
aBevel = (bool)mCornerBevel;
|
||||
return mCornerSubSize;
|
||||
}
|
||||
|
||||
inline void BCData::SetCorner(BCPixelSize aSubSize,
|
||||
mozilla::LogicalSide aOwnerSide, bool aBevel) {
|
||||
inline void BCData::SetCorner(nscoord aSubSize, mozilla::LogicalSide aOwnerSide,
|
||||
bool aBevel) {
|
||||
mCornerSubSize = aSubSize;
|
||||
mCornerSide = static_cast<uint8_t>(aOwnerSide);
|
||||
mCornerBevel = aBevel;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "nsTableCellFrame.h"
|
||||
|
||||
#include "celldata.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
|
@ -962,14 +963,12 @@ nsresult nsBCTableCellFrame::GetFrameName(nsAString& aResult) const {
|
|||
#endif
|
||||
|
||||
LogicalMargin nsBCTableCellFrame::GetBorderWidth(WritingMode aWM) const {
|
||||
int32_t d2a = PresContext()->AppUnitsPerDevPixel();
|
||||
return LogicalMargin(aWM, BC_BORDER_END_HALF_COORD(d2a, mBStartBorder),
|
||||
BC_BORDER_START_HALF_COORD(d2a, mIEndBorder),
|
||||
BC_BORDER_START_HALF_COORD(d2a, mBEndBorder),
|
||||
BC_BORDER_END_HALF_COORD(d2a, mIStartBorder));
|
||||
return LogicalMargin(
|
||||
aWM, BC_BORDER_END_HALF(mBStartBorder), BC_BORDER_START_HALF(mIEndBorder),
|
||||
BC_BORDER_START_HALF(mBEndBorder), BC_BORDER_END_HALF(mIStartBorder));
|
||||
}
|
||||
|
||||
BCPixelSize nsBCTableCellFrame::GetBorderWidth(LogicalSide aSide) const {
|
||||
nscoord nsBCTableCellFrame::GetBorderWidth(LogicalSide aSide) const {
|
||||
switch (aSide) {
|
||||
case LogicalSide::BStart:
|
||||
return BC_BORDER_END_HALF(mBStartBorder);
|
||||
|
@ -982,7 +981,7 @@ BCPixelSize nsBCTableCellFrame::GetBorderWidth(LogicalSide aSide) const {
|
|||
}
|
||||
}
|
||||
|
||||
void nsBCTableCellFrame::SetBorderWidth(LogicalSide aSide, BCPixelSize aValue) {
|
||||
void nsBCTableCellFrame::SetBorderWidth(LogicalSide aSide, nscoord aValue) {
|
||||
switch (aSide) {
|
||||
case LogicalSide::BStart:
|
||||
mBStartBorder = aValue;
|
||||
|
@ -1001,11 +1000,9 @@ void nsBCTableCellFrame::SetBorderWidth(LogicalSide aSide, BCPixelSize aValue) {
|
|||
/* virtual */
|
||||
nsMargin nsBCTableCellFrame::GetBorderOverflow() {
|
||||
WritingMode wm = GetWritingMode();
|
||||
int32_t d2a = PresContext()->AppUnitsPerDevPixel();
|
||||
LogicalMargin halfBorder(wm, BC_BORDER_START_HALF_COORD(d2a, mBStartBorder),
|
||||
BC_BORDER_END_HALF_COORD(d2a, mIEndBorder),
|
||||
BC_BORDER_END_HALF_COORD(d2a, mBEndBorder),
|
||||
BC_BORDER_START_HALF_COORD(d2a, mIStartBorder));
|
||||
LogicalMargin halfBorder(
|
||||
wm, BC_BORDER_START_HALF(mBStartBorder), BC_BORDER_END_HALF(mIEndBorder),
|
||||
BC_BORDER_END_HALF(mBEndBorder), BC_BORDER_START_HALF(mIStartBorder));
|
||||
return halfBorder.GetPhysicalMargin(wm);
|
||||
}
|
||||
|
||||
|
|
|
@ -273,11 +273,11 @@ class nsBCTableCellFrame final : public nsTableCellFrame {
|
|||
mozilla::LogicalMargin GetBorderWidth(
|
||||
mozilla::WritingMode aWM) const override;
|
||||
|
||||
// Get the *inner half of the border only*, in pixels.
|
||||
BCPixelSize GetBorderWidth(mozilla::LogicalSide aSide) const;
|
||||
// Get the *inner half of the border only*
|
||||
nscoord GetBorderWidth(mozilla::LogicalSide aSide) const;
|
||||
|
||||
// Set the full (both halves) width of the border
|
||||
void SetBorderWidth(mozilla::LogicalSide aSide, BCPixelSize aPixelValue);
|
||||
void SetBorderWidth(mozilla::LogicalSide aSide, nscoord aValue);
|
||||
|
||||
nsMargin GetBorderOverflow() override;
|
||||
|
||||
|
@ -288,10 +288,10 @@ class nsBCTableCellFrame final : public nsTableCellFrame {
|
|||
private:
|
||||
// These are the entire width of the border (the cell edge contains only
|
||||
// the inner half).
|
||||
BCPixelSize mBStartBorder;
|
||||
BCPixelSize mIEndBorder;
|
||||
BCPixelSize mBEndBorder;
|
||||
BCPixelSize mIStartBorder;
|
||||
nscoord mBStartBorder;
|
||||
nscoord mIEndBorder;
|
||||
nscoord mBEndBorder;
|
||||
nscoord mIStartBorder;
|
||||
};
|
||||
|
||||
// Implemented here because that's a sane-ish way to make the includes work out.
|
||||
|
|
|
@ -86,10 +86,10 @@ class nsTableColFrame final : public nsSplittableFrame {
|
|||
/** convenience method, calls into cellmap */
|
||||
int32_t Count() const;
|
||||
|
||||
BCPixelSize GetIStartBorderWidth() const { return mIStartBorderWidth; }
|
||||
BCPixelSize GetIEndBorderWidth() const { return mIEndBorderWidth; }
|
||||
void SetIStartBorderWidth(BCPixelSize aWidth) { mIStartBorderWidth = aWidth; }
|
||||
void SetIEndBorderWidth(BCPixelSize aWidth) { mIEndBorderWidth = aWidth; }
|
||||
nscoord GetIStartBorderWidth() const { return mIStartBorderWidth; }
|
||||
nscoord GetIEndBorderWidth() const { return mIEndBorderWidth; }
|
||||
void SetIStartBorderWidth(nscoord aWidth) { mIStartBorderWidth = aWidth; }
|
||||
void SetIEndBorderWidth(nscoord aWidth) { mIEndBorderWidth = aWidth; }
|
||||
|
||||
#ifdef DEBUG
|
||||
void Dump(int32_t aIndent);
|
||||
|
@ -272,9 +272,9 @@ class nsTableColFrame final : public nsSplittableFrame {
|
|||
// colgroup
|
||||
uint32_t mColIndex;
|
||||
|
||||
// border width in pixels of the inner half of the border only
|
||||
BCPixelSize mIStartBorderWidth;
|
||||
BCPixelSize mIEndBorderWidth;
|
||||
// border widths of the inner half of the border only
|
||||
nscoord mIStartBorderWidth;
|
||||
nscoord mIEndBorderWidth;
|
||||
|
||||
bool mHasSpecifiedCoord;
|
||||
};
|
||||
|
|
|
@ -133,12 +133,12 @@ struct TableReflowInput final {
|
|||
|
||||
struct TableBCData final {
|
||||
TableArea mDamageArea;
|
||||
BCPixelSize mBStartBorderWidth = 0;
|
||||
BCPixelSize mIEndBorderWidth = 0;
|
||||
BCPixelSize mBEndBorderWidth = 0;
|
||||
BCPixelSize mIStartBorderWidth = 0;
|
||||
BCPixelSize mIStartCellBorderWidth = 0;
|
||||
BCPixelSize mIEndCellBorderWidth = 0;
|
||||
nscoord mBStartBorderWidth = 0;
|
||||
nscoord mIEndBorderWidth = 0;
|
||||
nscoord mBEndBorderWidth = 0;
|
||||
nscoord mIStartBorderWidth = 0;
|
||||
nscoord mIStartCellBorderWidth = 0;
|
||||
nscoord mIEndCellBorderWidth = 0;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -2414,8 +2414,8 @@ TableBCData* nsTableFrame::GetOrCreateTableBCData() {
|
|||
return value;
|
||||
}
|
||||
|
||||
static void DivideBCBorderSize(BCPixelSize aPixelSize, BCPixelSize& aSmallHalf,
|
||||
BCPixelSize& aLargeHalf) {
|
||||
static void DivideBCBorderSize(nscoord aPixelSize, nscoord& aSmallHalf,
|
||||
nscoord& aLargeHalf) {
|
||||
aSmallHalf = aPixelSize / 2;
|
||||
aLargeHalf = aPixelSize - aSmallHalf;
|
||||
}
|
||||
|
@ -2424,14 +2424,13 @@ LogicalMargin nsTableFrame::GetOuterBCBorder(const WritingMode aWM) const {
|
|||
if (NeedToCalcBCBorders()) {
|
||||
const_cast<nsTableFrame*>(this)->CalcBCBorders();
|
||||
}
|
||||
int32_t d2a = PresContext()->AppUnitsPerDevPixel();
|
||||
TableBCData* propData = GetTableBCData();
|
||||
if (propData) {
|
||||
return LogicalMargin(
|
||||
aWM, BC_BORDER_START_HALF_COORD(d2a, propData->mBStartBorderWidth),
|
||||
BC_BORDER_END_HALF_COORD(d2a, propData->mIEndBorderWidth),
|
||||
BC_BORDER_END_HALF_COORD(d2a, propData->mBEndBorderWidth),
|
||||
BC_BORDER_START_HALF_COORD(d2a, propData->mIStartBorderWidth));
|
||||
return LogicalMargin(aWM,
|
||||
BC_BORDER_START_HALF(propData->mBStartBorderWidth),
|
||||
BC_BORDER_END_HALF(propData->mIEndBorderWidth),
|
||||
BC_BORDER_END_HALF(propData->mBEndBorderWidth),
|
||||
BC_BORDER_START_HALF(propData->mIStartBorderWidth));
|
||||
}
|
||||
return LogicalMargin(aWM);
|
||||
}
|
||||
|
@ -2442,14 +2441,13 @@ LogicalMargin nsTableFrame::GetIncludedOuterBCBorder(
|
|||
const_cast<nsTableFrame*>(this)->CalcBCBorders();
|
||||
}
|
||||
|
||||
int32_t d2a = PresContext()->AppUnitsPerDevPixel();
|
||||
TableBCData* propData = GetTableBCData();
|
||||
if (propData) {
|
||||
return LogicalMargin(
|
||||
aWM, BC_BORDER_START_HALF_COORD(d2a, propData->mBStartBorderWidth),
|
||||
BC_BORDER_END_HALF_COORD(d2a, propData->mIEndCellBorderWidth),
|
||||
BC_BORDER_END_HALF_COORD(d2a, propData->mBEndBorderWidth),
|
||||
BC_BORDER_START_HALF_COORD(d2a, propData->mIStartCellBorderWidth));
|
||||
aWM, BC_BORDER_START_HALF(propData->mBStartBorderWidth),
|
||||
BC_BORDER_END_HALF(propData->mIEndCellBorderWidth),
|
||||
BC_BORDER_END_HALF(propData->mBEndBorderWidth),
|
||||
BC_BORDER_START_HALF(propData->mIStartCellBorderWidth));
|
||||
}
|
||||
return LogicalMargin(aWM);
|
||||
}
|
||||
|
@ -3775,7 +3773,7 @@ struct BCCellBorder {
|
|||
BCCellBorder() { Reset(0, 1); }
|
||||
void Reset(uint32_t aRowIndex, uint32_t aRowSpan);
|
||||
nscolor color; // border segment color
|
||||
BCPixelSize width; // border segment width in pixel coordinates !!
|
||||
nscoord width; // border segment width
|
||||
StyleBorderStyle style; // border segment style, possible values are defined
|
||||
// in nsStyleConsts.h as StyleBorderStyle::*
|
||||
BCBorderOwner owner; // border segment owner, possible values are defined
|
||||
|
@ -3825,10 +3823,10 @@ struct BCMapCellInfo final {
|
|||
void ResetBStartBorderWidths();
|
||||
void ResetBEndBorderWidths();
|
||||
|
||||
void SetIStartBorderWidths(BCPixelSize aWidth);
|
||||
void SetIEndBorderWidths(BCPixelSize aWidth);
|
||||
void SetBStartBorderWidths(BCPixelSize aWidth);
|
||||
void SetBEndBorderWidths(BCPixelSize aWidth);
|
||||
void SetIStartBorderWidths(nscoord aWidth);
|
||||
void SetIEndBorderWidths(nscoord aWidth);
|
||||
void SetBStartBorderWidths(nscoord aWidth);
|
||||
void SetBEndBorderWidths(nscoord aWidth);
|
||||
|
||||
// functions to compute the borders; they depend on the
|
||||
// knowledge about the current position in the table. The edge functions
|
||||
|
@ -3950,10 +3948,10 @@ struct BCMapTableInfo final {
|
|||
|
||||
void ResetTableBEndBorderWidth() { mTableBCData->mBEndBorderWidth = 0; }
|
||||
|
||||
void SetTableIStartBorderWidth(int32_t aRowB, BCPixelSize aWidth);
|
||||
void SetTableIEndBorderWidth(int32_t aRowB, BCPixelSize aWidth);
|
||||
void SetTableBStartBorderWidth(BCPixelSize aWidth);
|
||||
void SetTableBEndBorderWidth(BCPixelSize aWidth);
|
||||
void SetTableIStartBorderWidth(int32_t aRowB, nscoord aWidth);
|
||||
void SetTableIEndBorderWidth(int32_t aRowB, nscoord aWidth);
|
||||
void SetTableBStartBorderWidth(nscoord aWidth);
|
||||
void SetTableBEndBorderWidth(nscoord aWidth);
|
||||
|
||||
TableBCData* mTableBCData;
|
||||
};
|
||||
|
@ -4337,18 +4335,18 @@ void BCMapCellIterator::PeekIAt(const BCMapCellInfo& aRefInfo,
|
|||
|
||||
#define CELL_CORNER true
|
||||
|
||||
/** return the border style, border color and optionally the width in
|
||||
* pixel for a given frame and side
|
||||
/** return the border style, border color and optionally the width for a given
|
||||
* frame and side
|
||||
* @param aFrame - query the info for this frame
|
||||
* @param aTableWM - the writing-mode of the frame
|
||||
* @param aSide - the side of the frame
|
||||
* @param aStyle - the border style
|
||||
* @param aColor - the border color
|
||||
* @param aWidth - the border width in px
|
||||
* @param aWidth - the border width
|
||||
*/
|
||||
static void GetColorAndStyle(const nsIFrame* aFrame, WritingMode aTableWM,
|
||||
LogicalSide aSide, StyleBorderStyle* aStyle,
|
||||
nscolor* aColor, BCPixelSize* aWidth = nullptr) {
|
||||
nscolor* aColor, nscoord* aWidth = nullptr) {
|
||||
MOZ_ASSERT(aFrame, "null frame");
|
||||
MOZ_ASSERT(aStyle && aColor, "null argument");
|
||||
|
||||
|
@ -4370,8 +4368,7 @@ static void GetColorAndStyle(const nsIFrame* aFrame, WritingMode aTableWM,
|
|||
nsStyleBorder::BorderColorFieldFor(physicalSide));
|
||||
|
||||
if (aWidth) {
|
||||
nscoord width = styleData->GetComputedBorderWidth(physicalSide);
|
||||
*aWidth = aFrame->PresContext()->AppUnitsToDevPixels(width);
|
||||
*aWidth = styleData->GetComputedBorderWidth(physicalSide);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4582,10 +4579,10 @@ struct BCCornerInfo {
|
|||
|
||||
void Update(mozilla::LogicalSide aSide, BCCellBorder border);
|
||||
|
||||
nscolor ownerColor; // color of borderOwner
|
||||
uint16_t ownerWidth; // pixel width of borderOwner
|
||||
uint16_t subWidth; // pixel width of the largest border intersecting the
|
||||
// border perpendicular to ownerSide
|
||||
nscolor ownerColor; // color of borderOwner
|
||||
uint16_t ownerWidth; // width of borderOwner
|
||||
uint16_t subWidth; // width of the largest border intersecting the
|
||||
// border perpendicular to ownerSide
|
||||
StyleBorderStyle subStyle; // border style of subElem
|
||||
StyleBorderStyle ownerStyle; // border style of ownerElem
|
||||
uint16_t ownerSide : 2; // LogicalSide (e.g LogicalSide::BStart, etc) of the
|
||||
|
@ -4895,8 +4892,7 @@ void nsTableFrame::ExpandBCDamageArea(TableArea& aArea) const {
|
|||
#define ADJACENT true
|
||||
#define INLINE_DIR true
|
||||
|
||||
void BCMapTableInfo::SetTableIStartBorderWidth(int32_t aRowB,
|
||||
BCPixelSize aWidth) {
|
||||
void BCMapTableInfo::SetTableIStartBorderWidth(int32_t aRowB, nscoord aWidth) {
|
||||
// update the iStart first cell border
|
||||
if (aRowB == 0) {
|
||||
mTableBCData->mIStartCellBorderWidth = aWidth;
|
||||
|
@ -4905,8 +4901,7 @@ void BCMapTableInfo::SetTableIStartBorderWidth(int32_t aRowB,
|
|||
std::max(mTableBCData->mIStartBorderWidth, aWidth);
|
||||
}
|
||||
|
||||
void BCMapTableInfo::SetTableIEndBorderWidth(int32_t aRowB,
|
||||
BCPixelSize aWidth) {
|
||||
void BCMapTableInfo::SetTableIEndBorderWidth(int32_t aRowB, nscoord aWidth) {
|
||||
// update the iEnd first cell border
|
||||
if (aRowB == 0) {
|
||||
mTableBCData->mIEndCellBorderWidth = aWidth;
|
||||
|
@ -4915,12 +4910,12 @@ void BCMapTableInfo::SetTableIEndBorderWidth(int32_t aRowB,
|
|||
std::max(mTableBCData->mIEndBorderWidth, aWidth);
|
||||
}
|
||||
|
||||
void BCMapTableInfo::SetTableBStartBorderWidth(BCPixelSize aWidth) {
|
||||
void BCMapTableInfo::SetTableBStartBorderWidth(nscoord aWidth) {
|
||||
mTableBCData->mBStartBorderWidth =
|
||||
std::max(mTableBCData->mBStartBorderWidth, aWidth);
|
||||
}
|
||||
|
||||
void BCMapTableInfo::SetTableBEndBorderWidth(BCPixelSize aWidth) {
|
||||
void BCMapTableInfo::SetTableBEndBorderWidth(nscoord aWidth) {
|
||||
mTableBCData->mBEndBorderWidth =
|
||||
std::max(mTableBCData->mBEndBorderWidth, aWidth);
|
||||
}
|
||||
|
@ -4961,20 +4956,20 @@ void BCMapCellInfo::ResetBEndBorderWidths() {
|
|||
}
|
||||
}
|
||||
|
||||
void BCMapCellInfo::SetIStartBorderWidths(BCPixelSize aWidth) {
|
||||
void BCMapCellInfo::SetIStartBorderWidths(nscoord aWidth) {
|
||||
if (mCell) {
|
||||
mCell->SetBorderWidth(
|
||||
LogicalSide::IStart,
|
||||
std::max(aWidth, mCell->GetBorderWidth(LogicalSide::IStart)));
|
||||
}
|
||||
if (mStartCol) {
|
||||
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
|
||||
nscoord half = BC_BORDER_END_HALF(aWidth);
|
||||
mStartCol->SetIStartBorderWidth(
|
||||
std::max(half, mStartCol->GetIStartBorderWidth()));
|
||||
}
|
||||
}
|
||||
|
||||
void BCMapCellInfo::SetIEndBorderWidths(BCPixelSize aWidth) {
|
||||
void BCMapCellInfo::SetIEndBorderWidths(nscoord aWidth) {
|
||||
// update the borders of the cells and cols affected
|
||||
if (mCell) {
|
||||
mCell->SetBorderWidth(
|
||||
|
@ -4982,25 +4977,25 @@ void BCMapCellInfo::SetIEndBorderWidths(BCPixelSize aWidth) {
|
|||
std::max(aWidth, mCell->GetBorderWidth(LogicalSide::IEnd)));
|
||||
}
|
||||
if (mEndCol) {
|
||||
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
|
||||
nscoord half = BC_BORDER_START_HALF(aWidth);
|
||||
mEndCol->SetIEndBorderWidth(std::max(half, mEndCol->GetIEndBorderWidth()));
|
||||
}
|
||||
}
|
||||
|
||||
void BCMapCellInfo::SetBStartBorderWidths(BCPixelSize aWidth) {
|
||||
void BCMapCellInfo::SetBStartBorderWidths(nscoord aWidth) {
|
||||
if (mCell) {
|
||||
mCell->SetBorderWidth(
|
||||
LogicalSide::BStart,
|
||||
std::max(aWidth, mCell->GetBorderWidth(LogicalSide::BStart)));
|
||||
}
|
||||
if (mStartRow) {
|
||||
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
|
||||
nscoord half = BC_BORDER_END_HALF(aWidth);
|
||||
mStartRow->SetBStartBCBorderWidth(
|
||||
std::max(half, mStartRow->GetBStartBCBorderWidth()));
|
||||
}
|
||||
}
|
||||
|
||||
void BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth) {
|
||||
void BCMapCellInfo::SetBEndBorderWidths(nscoord aWidth) {
|
||||
// update the borders of the affected cells and rows
|
||||
if (mCell) {
|
||||
mCell->SetBorderWidth(
|
||||
|
@ -5008,7 +5003,7 @@ void BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth) {
|
|||
std::max(aWidth, mCell->GetBorderWidth(LogicalSide::BEnd)));
|
||||
}
|
||||
if (mEndRow) {
|
||||
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
|
||||
nscoord half = BC_BORDER_START_HALF(aWidth);
|
||||
mEndRow->SetBEndBCBorderWidth(
|
||||
std::max(half, mEndRow->GetBEndBCBorderWidth()));
|
||||
}
|
||||
|
@ -5706,7 +5701,6 @@ struct BCBorderParameters {
|
|||
StyleBorderStyle mBorderStyle;
|
||||
nscolor mBorderColor;
|
||||
nsRect mBorderRect;
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
mozilla::Side mStartBevelSide;
|
||||
nscoord mStartBevelOffset;
|
||||
mozilla::Side mEndBevelSide;
|
||||
|
@ -5731,18 +5725,18 @@ struct BCBlockDirSeg {
|
|||
BCBlockDirSeg();
|
||||
|
||||
void Start(BCPaintBorderIterator& aIter, BCBorderOwner aBorderOwner,
|
||||
BCPixelSize aBlockSegISize, BCPixelSize aInlineSegBSize,
|
||||
nscoord aBlockSegISize, nscoord aInlineSegBSize,
|
||||
Maybe<nscoord> aEmptyRowEndSize);
|
||||
|
||||
void Initialize(BCPaintBorderIterator& aIter);
|
||||
void GetBEndCorner(BCPaintBorderIterator& aIter, BCPixelSize aInlineSegBSize);
|
||||
void GetBEndCorner(BCPaintBorderIterator& aIter, nscoord aInlineSegBSize);
|
||||
|
||||
Maybe<BCBorderParameters> BuildBorderParameters(BCPaintBorderIterator& aIter,
|
||||
BCPixelSize aInlineSegBSize);
|
||||
nscoord aInlineSegBSize);
|
||||
void Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget,
|
||||
BCPixelSize aInlineSegBSize);
|
||||
nscoord aInlineSegBSize);
|
||||
void CreateWebRenderCommands(BCPaintBorderIterator& aIter,
|
||||
BCPixelSize aInlineSegBSize,
|
||||
nscoord aInlineSegBSize,
|
||||
wr::DisplayListBuilder& aBuilder,
|
||||
const layers::StackingContextHelper& aSc,
|
||||
const nsPoint& aPt);
|
||||
|
@ -5753,10 +5747,10 @@ struct BCBlockDirSeg {
|
|||
nsTableColFrame* mCol;
|
||||
int32_t mColWidth;
|
||||
};
|
||||
nscoord mOffsetI; // i-offset with respect to the table edge
|
||||
nscoord mOffsetB; // b-offset with respect to the table edge
|
||||
nscoord mLength; // block-dir length including corners
|
||||
BCPixelSize mWidth; // thickness in pixels
|
||||
nscoord mOffsetI; // i-offset with respect to the table edge
|
||||
nscoord mOffsetB; // b-offset with respect to the table edge
|
||||
nscoord mLength; // block-dir length including corners
|
||||
nscoord mWidth; // thickness
|
||||
|
||||
nsTableCellFrame* mAjaCell; // previous sibling to the first cell
|
||||
// where the segment starts, it can be
|
||||
|
@ -5768,25 +5762,25 @@ struct BCBlockDirSeg {
|
|||
nsTableCellFrame* mLastCell; // cell at the current end of the
|
||||
// segment
|
||||
|
||||
uint8_t mOwner; // owner of the border, defines the
|
||||
// style
|
||||
LogicalSide mBStartBevelSide; // direction to bevel at the bStart
|
||||
nscoord mBStartBevelOffset; // how much to bevel at the bStart
|
||||
BCPixelSize mBEndInlineSegBSize; // bSize of the crossing
|
||||
// inline-dir border
|
||||
nscoord mBEndOffset; // how much longer is the segment due
|
||||
// to the inline-dir border, by this
|
||||
// amount the next segment needs to be
|
||||
// shifted.
|
||||
bool mIsBEndBevel; // should we bevel at the bEnd
|
||||
uint8_t mOwner; // owner of the border, defines the
|
||||
// style
|
||||
LogicalSide mBStartBevelSide; // direction to bevel at the bStart
|
||||
nscoord mBStartBevelOffset; // how much to bevel at the bStart
|
||||
nscoord mBEndInlineSegBSize; // bSize of the crossing
|
||||
// inline-dir border
|
||||
nscoord mBEndOffset; // how much longer is the segment due
|
||||
// to the inline-dir border, by this
|
||||
// amount the next segment needs to be
|
||||
// shifted.
|
||||
bool mIsBEndBevel; // should we bevel at the bEnd
|
||||
};
|
||||
|
||||
struct BCInlineDirSeg {
|
||||
BCInlineDirSeg();
|
||||
|
||||
void Start(BCPaintBorderIterator& aIter, BCBorderOwner aBorderOwner,
|
||||
BCPixelSize aBEndBlockSegISize, BCPixelSize aInlineSegBSize);
|
||||
void GetIEndCorner(BCPaintBorderIterator& aIter, BCPixelSize aIStartSegISize);
|
||||
nscoord aBEndBlockSegISize, nscoord aInlineSegBSize);
|
||||
void GetIEndCorner(BCPaintBorderIterator& aIter, nscoord aIStartSegISize);
|
||||
void AdvanceOffsetI();
|
||||
void IncludeCurrentBorder(BCPaintBorderIterator& aIter);
|
||||
Maybe<BCBorderParameters> BuildBorderParameters(BCPaintBorderIterator& aIter);
|
||||
|
@ -5799,7 +5793,7 @@ struct BCInlineDirSeg {
|
|||
nscoord mOffsetI; // i-offset with respect to the table edge
|
||||
nscoord mOffsetB; // b-offset with respect to the table edge
|
||||
nscoord mLength; // inline-dir length including corners
|
||||
BCPixelSize mWidth; // border thickness in pixels
|
||||
nscoord mWidth; // border thickness
|
||||
nscoord mIStartBevelOffset; // how much to bevel at the iStart
|
||||
LogicalSide mIStartBevelSide; // direction to bevel at the iStart
|
||||
bool mIsIEndBevel; // should we bevel at the iEnd end
|
||||
|
@ -5986,10 +5980,10 @@ class BCPaintBorderIterator {
|
|||
// It has one more elements than columns are
|
||||
// in the table.
|
||||
UniquePtr<BCBlockDirSeg[]> mBlockDirInfo;
|
||||
BCInlineDirSeg mInlineSeg; // the inline-dir segment while we
|
||||
// move over the colums
|
||||
BCPixelSize mPrevInlineSegBSize; // the bSize of the previous
|
||||
// inline-dir border
|
||||
BCInlineDirSeg mInlineSeg; // the inline-dir segment while we
|
||||
// move over the colums
|
||||
nscoord mPrevInlineSegBSize; // the bSize of the previous
|
||||
// inline-dir border
|
||||
|
||||
private:
|
||||
bool SetNewRow(nsTableRowFrame* aRow = nullptr);
|
||||
|
@ -6050,19 +6044,18 @@ bool BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect) {
|
|||
bool haveIntersect = false;
|
||||
// find startRowIndex, endRowIndex
|
||||
nscoord rowB = mInitialOffsetB;
|
||||
nsPresContext* presContext = mTable->PresContext();
|
||||
for (uint32_t rgIdx = 0; rgIdx < mRowGroups.Length() && !done; rgIdx++) {
|
||||
nsTableRowGroupFrame* rgFrame = mRowGroups[rgIdx];
|
||||
for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow(); rowFrame;
|
||||
rowFrame = rowFrame->GetNextRow()) {
|
||||
// get the row rect relative to the table rather than the row group
|
||||
nscoord rowBSize = rowFrame->BSize(mTableWM);
|
||||
const nscoord onePx = mTable->PresContext()->DevPixelsToAppUnits(1);
|
||||
if (haveIntersect) {
|
||||
// conservatively estimate the half border widths outside the row
|
||||
nscoord borderHalf = mTable->GetPrevInFlow()
|
||||
? 0
|
||||
: presContext->DevPixelsToAppUnits(
|
||||
rowFrame->GetBStartBCBorderWidth() + 1);
|
||||
: rowFrame->GetBStartBCBorderWidth() + onePx;
|
||||
|
||||
if (dirtyRect.BEnd(mTableWM) >= rowB - borderHalf) {
|
||||
nsTableRowFrame* fifRow =
|
||||
|
@ -6074,8 +6067,7 @@ bool BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect) {
|
|||
// conservatively estimate the half border widths outside the row
|
||||
nscoord borderHalf = mTable->GetNextInFlow()
|
||||
? 0
|
||||
: presContext->DevPixelsToAppUnits(
|
||||
rowFrame->GetBEndBCBorderWidth() + 1);
|
||||
: rowFrame->GetBEndBCBorderWidth() + onePx;
|
||||
if (rowB + rowBSize + borderHalf >= dirtyRect.BStart(mTableWM)) {
|
||||
mStartRg = rgFrame;
|
||||
mStartRow = rowFrame;
|
||||
|
@ -6112,20 +6104,19 @@ bool BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect) {
|
|||
for (colIdx = 0; colIdx != mNumTableCols; colIdx++) {
|
||||
nsTableColFrame* colFrame = mTableFirstInFlow->GetColFrame(colIdx);
|
||||
if (!colFrame) ABORT1(false);
|
||||
const nscoord onePx = mTable->PresContext()->DevPixelsToAppUnits(1);
|
||||
// get the col rect relative to the table rather than the col group
|
||||
nscoord colISize = colFrame->ISize(mTableWM);
|
||||
if (haveIntersect) {
|
||||
// conservatively estimate the iStart half border width outside the col
|
||||
nscoord iStartBorderHalf = presContext->DevPixelsToAppUnits(
|
||||
colFrame->GetIStartBorderWidth() + 1);
|
||||
nscoord iStartBorderHalf = colFrame->GetIStartBorderWidth() + onePx;
|
||||
if (dirtyRect.IEnd(mTableWM) >= x - iStartBorderHalf) {
|
||||
endColIndex = colIdx;
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
// conservatively estimate the iEnd half border width outside the col
|
||||
nscoord iEndBorderHalf =
|
||||
presContext->DevPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
|
||||
nscoord iEndBorderHalf = colFrame->GetIEndBorderWidth() + onePx;
|
||||
if (x + colISize + iEndBorderHalf >= dirtyRect.IStart(mTableWM)) {
|
||||
startColIndex = endColIndex = colIdx;
|
||||
haveIntersect = true;
|
||||
|
@ -6349,14 +6340,12 @@ void BCPaintBorderIterator::Next() {
|
|||
* @param aIsBevel - is this corner beveled
|
||||
* @return - offset in twips
|
||||
*/
|
||||
static nscoord CalcVerCornerOffset(nsPresContext* aPresContext,
|
||||
LogicalSide aCornerOwnerSide,
|
||||
BCPixelSize aCornerSubWidth,
|
||||
BCPixelSize aHorWidth, bool aIsStartOfSeg,
|
||||
bool aIsBevel) {
|
||||
static nscoord CalcVerCornerOffset(LogicalSide aCornerOwnerSide,
|
||||
nscoord aCornerSubWidth, nscoord aHorWidth,
|
||||
bool aIsStartOfSeg, bool aIsBevel) {
|
||||
nscoord offset = 0;
|
||||
// XXX These should be replaced with appropriate side-specific macros (which?)
|
||||
BCPixelSize smallHalf, largeHalf;
|
||||
nscoord smallHalf, largeHalf;
|
||||
if (IsBlock(aCornerOwnerSide)) {
|
||||
DivideBCBorderSize(aCornerSubWidth, smallHalf, largeHalf);
|
||||
if (aIsBevel) {
|
||||
|
@ -6373,7 +6362,7 @@ static nscoord CalcVerCornerOffset(nsPresContext* aPresContext,
|
|||
offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
|
||||
}
|
||||
}
|
||||
return aPresContext->DevPixelsToAppUnits(offset);
|
||||
return offset;
|
||||
}
|
||||
|
||||
/** Compute the horizontal offset of a horizontal border segment
|
||||
|
@ -6384,14 +6373,12 @@ static nscoord CalcVerCornerOffset(nsPresContext* aPresContext,
|
|||
* @param aIsBevel - is this corner beveled
|
||||
* @return - offset in twips
|
||||
*/
|
||||
static nscoord CalcHorCornerOffset(nsPresContext* aPresContext,
|
||||
LogicalSide aCornerOwnerSide,
|
||||
BCPixelSize aCornerSubWidth,
|
||||
BCPixelSize aVerWidth, bool aIsStartOfSeg,
|
||||
bool aIsBevel) {
|
||||
static nscoord CalcHorCornerOffset(LogicalSide aCornerOwnerSide,
|
||||
nscoord aCornerSubWidth, nscoord aVerWidth,
|
||||
bool aIsStartOfSeg, bool aIsBevel) {
|
||||
nscoord offset = 0;
|
||||
// XXX These should be replaced with appropriate side-specific macros (which?)
|
||||
BCPixelSize smallHalf, largeHalf;
|
||||
nscoord smallHalf, largeHalf;
|
||||
if (IsInline(aCornerOwnerSide)) {
|
||||
DivideBCBorderSize(aCornerSubWidth, smallHalf, largeHalf);
|
||||
if (aIsBevel) {
|
||||
|
@ -6408,7 +6395,7 @@ static nscoord CalcHorCornerOffset(nsPresContext* aPresContext,
|
|||
offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
|
||||
}
|
||||
}
|
||||
return aPresContext->DevPixelsToAppUnits(offset);
|
||||
return offset;
|
||||
}
|
||||
|
||||
BCBlockDirSeg::BCBlockDirSeg()
|
||||
|
@ -6428,14 +6415,13 @@ BCBlockDirSeg::BCBlockDirSeg()
|
|||
* Start a new block-direction segment
|
||||
* @param aIter - iterator containing the structural information
|
||||
* @param aBorderOwner - determines the border style
|
||||
* @param aBlockSegISize - the width of segment in pixel
|
||||
* @param aBlockSegISize - the width of segment
|
||||
* @param aInlineSegBSize - the width of the inline-dir segment joining the
|
||||
* corner at the start
|
||||
*/
|
||||
void BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
|
||||
BCBorderOwner aBorderOwner,
|
||||
BCPixelSize aBlockSegISize,
|
||||
BCPixelSize aInlineSegBSize,
|
||||
BCBorderOwner aBorderOwner, nscoord aBlockSegISize,
|
||||
nscoord aInlineSegBSize,
|
||||
Maybe<nscoord> aEmptyRowEndBSize) {
|
||||
LogicalSide ownerSide = LogicalSide::BStart;
|
||||
bool bevel = false;
|
||||
|
@ -6444,14 +6430,12 @@ void BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
|
|||
(aIter.mBCData) ? aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
|
||||
|
||||
bool bStartBevel = (aBlockSegISize > 0) ? bevel : false;
|
||||
BCPixelSize maxInlineSegBSize =
|
||||
nscoord maxInlineSegBSize =
|
||||
std::max(aIter.mPrevInlineSegBSize, aInlineSegBSize);
|
||||
nsPresContext* presContext = aIter.mTable->PresContext();
|
||||
nscoord offset = CalcVerCornerOffset(presContext, ownerSide, cornerSubWidth,
|
||||
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
|
||||
maxInlineSegBSize, true, bStartBevel);
|
||||
|
||||
mBStartBevelOffset =
|
||||
bStartBevel ? presContext->DevPixelsToAppUnits(maxInlineSegBSize) : 0;
|
||||
mBStartBevelOffset = bStartBevel ? maxInlineSegBSize : 0;
|
||||
// XXX this assumes that only corners where 2 segments join can be beveled
|
||||
mBStartBevelSide =
|
||||
(aInlineSegBSize > 0) ? LogicalSide::IEnd : LogicalSide::IStart;
|
||||
|
@ -6504,7 +6488,7 @@ void BCBlockDirSeg::Initialize(BCPaintBorderIterator& aIter) {
|
|||
* corner at the start
|
||||
*/
|
||||
void BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
|
||||
BCPixelSize aInlineSegBSize) {
|
||||
nscoord aInlineSegBSize) {
|
||||
LogicalSide ownerSide = LogicalSide::BStart;
|
||||
nscoord cornerSubWidth = 0;
|
||||
bool bevel = false;
|
||||
|
@ -6513,14 +6497,13 @@ void BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
|
|||
}
|
||||
mIsBEndBevel = (mWidth > 0) ? bevel : false;
|
||||
mBEndInlineSegBSize = std::max(aIter.mPrevInlineSegBSize, aInlineSegBSize);
|
||||
mBEndOffset = CalcVerCornerOffset(aIter.mTable->PresContext(), ownerSide,
|
||||
cornerSubWidth, mBEndInlineSegBSize, false,
|
||||
mIsBEndBevel);
|
||||
mBEndOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
|
||||
mBEndInlineSegBSize, false, mIsBEndBevel);
|
||||
mLength += mBEndOffset;
|
||||
}
|
||||
|
||||
Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
|
||||
BCPaintBorderIterator& aIter, BCPixelSize aInlineSegBSize) {
|
||||
BCPaintBorderIterator& aIter, nscoord aInlineSegBSize) {
|
||||
BCBorderParameters result;
|
||||
|
||||
// get the border style, color and paint the segment
|
||||
|
@ -6535,11 +6518,6 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
|
|||
result.mBorderColor = 0xFFFFFFFF;
|
||||
result.mBackfaceIsVisible = true;
|
||||
|
||||
// All the tables frames have the same presContext, so we just use any one
|
||||
// that exists here:
|
||||
nsPresContext* presContext = aIter.mTable->PresContext();
|
||||
result.mAppUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||
|
||||
switch (mOwner) {
|
||||
case eTableOwner:
|
||||
owner = aIter.mTable;
|
||||
|
@ -6593,14 +6571,11 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
|
|||
&result.mBorderColor);
|
||||
result.mBackfaceIsVisible = !owner->BackfaceIsHidden();
|
||||
}
|
||||
BCPixelSize smallHalf, largeHalf;
|
||||
nscoord smallHalf, largeHalf;
|
||||
DivideBCBorderSize(mWidth, smallHalf, largeHalf);
|
||||
LogicalRect segRect(
|
||||
aIter.mTableWM, mOffsetI - presContext->DevPixelsToAppUnits(largeHalf),
|
||||
mOffsetB, presContext->DevPixelsToAppUnits(mWidth), mLength);
|
||||
nscoord bEndBevelOffset =
|
||||
(mIsBEndBevel) ? presContext->DevPixelsToAppUnits(mBEndInlineSegBSize)
|
||||
: 0;
|
||||
LogicalRect segRect(aIter.mTableWM, mOffsetI - largeHalf, mOffsetB, mWidth,
|
||||
mLength);
|
||||
nscoord bEndBevelOffset = mIsBEndBevel ? mBEndInlineSegBSize : 0;
|
||||
LogicalSide bEndBevelSide =
|
||||
(aInlineSegBSize > 0) ? LogicalSide::IEnd : LogicalSide::IStart;
|
||||
|
||||
|
@ -6643,7 +6618,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
|
|||
* corner at the start
|
||||
*/
|
||||
void BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget,
|
||||
BCPixelSize aInlineSegBSize) {
|
||||
nscoord aInlineSegBSize) {
|
||||
Maybe<BCBorderParameters> param =
|
||||
BuildBorderParameters(aIter, aInlineSegBSize);
|
||||
if (param.isNothing()) {
|
||||
|
@ -6652,8 +6627,9 @@ void BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget,
|
|||
|
||||
nsCSSRendering::DrawTableBorderSegment(
|
||||
aDrawTarget, param->mBorderStyle, param->mBorderColor, param->mBorderRect,
|
||||
param->mAppUnitsPerDevPixel, param->mStartBevelSide,
|
||||
param->mStartBevelOffset, param->mEndBevelSide, param->mEndBevelOffset);
|
||||
aIter.mTable->PresContext()->AppUnitsPerDevPixel(),
|
||||
param->mStartBevelSide, param->mStartBevelOffset, param->mEndBevelSide,
|
||||
param->mEndBevelOffset);
|
||||
}
|
||||
|
||||
// Pushes a border bevel triangle and substracts the relevant rectangle from
|
||||
|
@ -6750,30 +6726,31 @@ static void AdjustAndPushBevel(wr::DisplayListBuilder& aBuilder,
|
|||
|
||||
static void CreateWRCommandsForBeveledBorder(
|
||||
const BCBorderParameters& aBorderParams, wr::DisplayListBuilder& aBuilder,
|
||||
const layers::StackingContextHelper& aSc, const nsPoint& aOffset) {
|
||||
const layers::StackingContextHelper& aSc, const nsPoint& aOffset,
|
||||
nscoord aAppUnitsPerDevPixel) {
|
||||
MOZ_ASSERT(aBorderParams.NeedToBevel());
|
||||
|
||||
AutoTArray<nsCSSRendering::SolidBeveledBorderSegment, 3> segments;
|
||||
nsCSSRendering::GetTableBorderSolidSegments(
|
||||
segments, aBorderParams.mBorderStyle, aBorderParams.mBorderColor,
|
||||
aBorderParams.mBorderRect, aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBorderRect, aAppUnitsPerDevPixel,
|
||||
aBorderParams.mStartBevelSide, aBorderParams.mStartBevelOffset,
|
||||
aBorderParams.mEndBevelSide, aBorderParams.mEndBevelOffset);
|
||||
|
||||
for (const auto& segment : segments) {
|
||||
auto rect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(
|
||||
segment.mRect + aOffset, aBorderParams.mAppUnitsPerDevPixel));
|
||||
auto rect = LayoutDeviceRect::FromUnknownRect(
|
||||
NSRectToRect(segment.mRect + aOffset, aAppUnitsPerDevPixel));
|
||||
auto r = wr::ToLayoutRect(rect);
|
||||
auto color = wr::ToColorF(ToDeviceColor(segment.mColor));
|
||||
|
||||
// Adjust for the start bevel if needed.
|
||||
AdjustAndPushBevel(aBuilder, r, segment.mColor, segment.mStartBevel,
|
||||
aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBackfaceIsVisible, true);
|
||||
aAppUnitsPerDevPixel, aBorderParams.mBackfaceIsVisible,
|
||||
true);
|
||||
|
||||
AdjustAndPushBevel(aBuilder, r, segment.mColor, segment.mEndBevel,
|
||||
aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBackfaceIsVisible, false);
|
||||
aAppUnitsPerDevPixel, aBorderParams.mBackfaceIsVisible,
|
||||
false);
|
||||
|
||||
aBuilder.PushRect(r, r, aBorderParams.mBackfaceIsVisible, false, false,
|
||||
color);
|
||||
|
@ -6782,14 +6759,16 @@ static void CreateWRCommandsForBeveledBorder(
|
|||
|
||||
static void CreateWRCommandsForBorderSegment(
|
||||
const BCBorderParameters& aBorderParams, wr::DisplayListBuilder& aBuilder,
|
||||
const layers::StackingContextHelper& aSc, const nsPoint& aOffset) {
|
||||
const layers::StackingContextHelper& aSc, const nsPoint& aOffset,
|
||||
nscoord aAppUnitsPerDevPixel) {
|
||||
if (aBorderParams.NeedToBevel()) {
|
||||
CreateWRCommandsForBeveledBorder(aBorderParams, aBuilder, aSc, aOffset);
|
||||
CreateWRCommandsForBeveledBorder(aBorderParams, aBuilder, aSc, aOffset,
|
||||
aAppUnitsPerDevPixel);
|
||||
return;
|
||||
}
|
||||
|
||||
auto borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(
|
||||
aBorderParams.mBorderRect + aOffset, aBorderParams.mAppUnitsPerDevPixel));
|
||||
auto borderRect = LayoutDeviceRect::FromUnknownRect(
|
||||
NSRectToRect(aBorderParams.mBorderRect + aOffset, aAppUnitsPerDevPixel));
|
||||
|
||||
wr::LayoutRect r = wr::ToLayoutRect(borderRect);
|
||||
wr::BorderSide wrSide[4];
|
||||
|
@ -6820,7 +6799,7 @@ static void CreateWRCommandsForBorderSegment(
|
|||
}
|
||||
|
||||
void BCBlockDirSeg::CreateWebRenderCommands(
|
||||
BCPaintBorderIterator& aIter, BCPixelSize aInlineSegBSize,
|
||||
BCPaintBorderIterator& aIter, nscoord aInlineSegBSize,
|
||||
wr::DisplayListBuilder& aBuilder, const layers::StackingContextHelper& aSc,
|
||||
const nsPoint& aOffset) {
|
||||
Maybe<BCBorderParameters> param =
|
||||
|
@ -6829,7 +6808,9 @@ void BCBlockDirSeg::CreateWebRenderCommands(
|
|||
return;
|
||||
}
|
||||
|
||||
CreateWRCommandsForBorderSegment(*param, aBuilder, aSc, aOffset);
|
||||
CreateWRCommandsForBorderSegment(
|
||||
*param, aBuilder, aSc, aOffset,
|
||||
aIter.mTable->PresContext()->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6864,8 +6845,8 @@ BCInlineDirSeg::BCInlineDirSeg()
|
|||
+ */
|
||||
void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
|
||||
BCBorderOwner aBorderOwner,
|
||||
BCPixelSize aBEndBlockSegISize,
|
||||
BCPixelSize aInlineSegBSize) {
|
||||
nscoord aBEndBlockSegISize,
|
||||
nscoord aInlineSegBSize) {
|
||||
LogicalSide cornerOwnerSide = LogicalSide::BStart;
|
||||
bool bevel = false;
|
||||
|
||||
|
@ -6877,9 +6858,8 @@ void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
|
|||
int32_t relColIndex = aIter.GetRelativeColIndex();
|
||||
nscoord maxBlockSegISize =
|
||||
std::max(aIter.mBlockDirInfo[relColIndex].mWidth, aBEndBlockSegISize);
|
||||
nscoord offset =
|
||||
CalcHorCornerOffset(aIter.mTable->PresContext(), cornerOwnerSide,
|
||||
cornerSubWidth, maxBlockSegISize, true, iStartBevel);
|
||||
nscoord offset = CalcHorCornerOffset(cornerOwnerSide, cornerSubWidth,
|
||||
maxBlockSegISize, true, iStartBevel);
|
||||
mIStartBevelOffset =
|
||||
(iStartBevel && (aInlineSegBSize > 0)) ? maxBlockSegISize : 0;
|
||||
// XXX this assumes that only corners where 2 segments join can be beveled
|
||||
|
@ -6901,7 +6881,7 @@ void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
|
|||
* corner at the start
|
||||
*/
|
||||
void BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
|
||||
BCPixelSize aIStartSegISize) {
|
||||
nscoord aIStartSegISize) {
|
||||
LogicalSide ownerSide = LogicalSide::BStart;
|
||||
nscoord cornerSubWidth = 0;
|
||||
bool bevel = false;
|
||||
|
@ -6913,12 +6893,10 @@ void BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
|
|||
int32_t relColIndex = aIter.GetRelativeColIndex();
|
||||
nscoord verWidth =
|
||||
std::max(aIter.mBlockDirInfo[relColIndex].mWidth, aIStartSegISize);
|
||||
nsPresContext* presContext = aIter.mTable->PresContext();
|
||||
mEndOffset = CalcHorCornerOffset(presContext, ownerSide, cornerSubWidth,
|
||||
verWidth, false, mIsIEndBevel);
|
||||
mEndOffset = CalcHorCornerOffset(ownerSide, cornerSubWidth, verWidth, false,
|
||||
mIsIEndBevel);
|
||||
mLength += mEndOffset;
|
||||
mIEndBevelOffset =
|
||||
(mIsIEndBevel) ? presContext->DevPixelsToAppUnits(verWidth) : 0;
|
||||
mIEndBevelOffset = mIsIEndBevel ? verWidth : 0;
|
||||
mIEndBevelSide =
|
||||
(aIStartSegISize > 0) ? LogicalSide::BEnd : LogicalSide::BStart;
|
||||
}
|
||||
|
@ -6938,12 +6916,6 @@ Maybe<BCBorderParameters> BCInlineDirSeg::BuildBorderParameters(
|
|||
nsIFrame* col;
|
||||
nsIFrame* owner = nullptr;
|
||||
result.mBackfaceIsVisible = true;
|
||||
|
||||
// All the tables frames have the same presContext, so we just use any one
|
||||
// that exists here:
|
||||
nsPresContext* presContext = aIter.mTable->PresContext();
|
||||
result.mAppUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||
|
||||
result.mBorderStyle = StyleBorderStyle::Solid;
|
||||
result.mBorderColor = 0xFFFFFFFF;
|
||||
|
||||
|
@ -6998,19 +6970,17 @@ Maybe<BCBorderParameters> BCInlineDirSeg::BuildBorderParameters(
|
|||
&result.mBorderColor);
|
||||
result.mBackfaceIsVisible = !owner->BackfaceIsHidden();
|
||||
}
|
||||
BCPixelSize smallHalf, largeHalf;
|
||||
nscoord smallHalf, largeHalf;
|
||||
DivideBCBorderSize(mWidth, smallHalf, largeHalf);
|
||||
LogicalRect segRect(aIter.mTableWM, mOffsetI,
|
||||
mOffsetB - presContext->DevPixelsToAppUnits(largeHalf),
|
||||
mLength, presContext->DevPixelsToAppUnits(mWidth));
|
||||
LogicalRect segRect(aIter.mTableWM, mOffsetI, mOffsetB - largeHalf, mLength,
|
||||
mWidth);
|
||||
|
||||
// Convert logical to physical sides/coordinates for DrawTableBorderSegment.
|
||||
result.mBorderRect =
|
||||
segRect.GetPhysicalRect(aIter.mTableWM, aIter.mTable->GetSize());
|
||||
result.mStartBevelSide = aIter.mTableWM.PhysicalSide(mIStartBevelSide);
|
||||
result.mEndBevelSide = aIter.mTableWM.PhysicalSide(mIEndBevelSide);
|
||||
result.mStartBevelOffset =
|
||||
presContext->DevPixelsToAppUnits(mIStartBevelOffset);
|
||||
result.mStartBevelOffset = mIStartBevelOffset;
|
||||
result.mEndBevelOffset = mIEndBevelOffset;
|
||||
// With inline-RTL directionality, the 'start' and 'end' of the inline-dir
|
||||
// border segment need to be swapped because DrawTableBorderSegment will
|
||||
|
@ -7046,8 +7016,9 @@ void BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
|
|||
|
||||
nsCSSRendering::DrawTableBorderSegment(
|
||||
aDrawTarget, param->mBorderStyle, param->mBorderColor, param->mBorderRect,
|
||||
param->mAppUnitsPerDevPixel, param->mStartBevelSide,
|
||||
param->mStartBevelOffset, param->mEndBevelSide, param->mEndBevelOffset);
|
||||
aIter.mTable->PresContext()->AppUnitsPerDevPixel(),
|
||||
param->mStartBevelSide, param->mStartBevelOffset, param->mEndBevelSide,
|
||||
param->mEndBevelOffset);
|
||||
}
|
||||
|
||||
void BCInlineDirSeg::CreateWebRenderCommands(
|
||||
|
@ -7058,7 +7029,9 @@ void BCInlineDirSeg::CreateWebRenderCommands(
|
|||
return;
|
||||
}
|
||||
|
||||
CreateWRCommandsForBorderSegment(*param, aBuilder, aSc, aPt);
|
||||
CreateWRCommandsForBorderSegment(
|
||||
*param, aBuilder, aSc, aPt,
|
||||
aIter.mTable->PresContext()->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -225,12 +225,10 @@ class nsTableRowFrame : public nsContainerFrame {
|
|||
nscoord GetUnpaginatedBSize() const;
|
||||
void SetUnpaginatedBSize(nscoord aValue);
|
||||
|
||||
BCPixelSize GetBStartBCBorderWidth() const { return mBStartBorderWidth; }
|
||||
BCPixelSize GetBEndBCBorderWidth() const { return mBEndBorderWidth; }
|
||||
void SetBStartBCBorderWidth(BCPixelSize aWidth) {
|
||||
mBStartBorderWidth = aWidth;
|
||||
}
|
||||
void SetBEndBCBorderWidth(BCPixelSize aWidth) { mBEndBorderWidth = aWidth; }
|
||||
nscoord GetBStartBCBorderWidth() const { return mBStartBorderWidth; }
|
||||
nscoord GetBEndBCBorderWidth() const { return mBEndBorderWidth; }
|
||||
void SetBStartBCBorderWidth(nscoord aWidth) { mBStartBorderWidth = aWidth; }
|
||||
void SetBEndBCBorderWidth(nscoord aWidth) { mBEndBorderWidth = aWidth; }
|
||||
mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
|
||||
|
||||
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
|
||||
|
@ -295,10 +293,13 @@ class nsTableRowFrame : public nsContainerFrame {
|
|||
nscoord mMaxCellAscent = 0; // does include cells with rowspan > 1
|
||||
nscoord mMaxCellDescent = 0; // does *not* include cells with rowspan > 1
|
||||
|
||||
// border widths in pixels in the collapsing border model of the *inner*
|
||||
// border widths in the collapsing border model of the *inner*
|
||||
// half of the border only
|
||||
BCPixelSize mBStartBorderWidth = 0;
|
||||
BCPixelSize mBEndBorderWidth = 0;
|
||||
nscoord mBStartBorderWidth = 0;
|
||||
nscoord mBEndBorderWidth = 0;
|
||||
nscoord mIEndContBorderWidth = 0;
|
||||
nscoord mBStartContBorderWidth = 0;
|
||||
nscoord mIStartContBorderWidth = 0;
|
||||
|
||||
/**
|
||||
* Sets the NS_ROW_HAS_CELL_WITH_STYLE_BSIZE bit to indicate whether
|
||||
|
@ -387,10 +388,8 @@ inline float nsTableRowFrame::GetPctBSize() const {
|
|||
|
||||
inline mozilla::LogicalMargin nsTableRowFrame::GetBCBorderWidth(
|
||||
mozilla::WritingMode aWM) {
|
||||
nsPresContext* presContext = PresContext();
|
||||
return mozilla::LogicalMargin(
|
||||
aWM, presContext->DevPixelsToAppUnits(mBStartBorderWidth), 0,
|
||||
presContext->DevPixelsToAppUnits(mBEndBorderWidth), 0);
|
||||
return mozilla::LogicalMargin(aWM, mBStartBorderWidth, 0, mBEndBorderWidth,
|
||||
0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1626,10 +1626,8 @@ LogicalMargin nsTableRowGroupFrame::GetBCBorderWidth(WritingMode aWM) {
|
|||
rowFrame = rowFrame->GetNextRow()) {
|
||||
lastRowFrame = rowFrame;
|
||||
}
|
||||
border.BStart(aWM) = PresContext()->DevPixelsToAppUnits(
|
||||
firstRowFrame->GetBStartBCBorderWidth());
|
||||
border.BEnd(aWM) =
|
||||
PresContext()->DevPixelsToAppUnits(lastRowFrame->GetBEndBCBorderWidth());
|
||||
border.BStart(aWM) = firstRowFrame->GetBStartBCBorderWidth();
|
||||
border.BEnd(aWM) = lastRowFrame->GetBEndBCBorderWidth();
|
||||
return border;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,3 +5,5 @@
|
|||
["test_bug541668_table_event_delivery.html"]
|
||||
|
||||
["test_bug1832110.html"]
|
||||
|
||||
["test_bug1825384.html"]
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Test for Bug 1825384</title>
|
||||
<style>
|
||||
div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 10px solid black;
|
||||
line-height: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script class="testbody" type="text/javascript">
|
||||
function raf() {
|
||||
return new Promise(resolve => {
|
||||
requestAnimationFrame(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
const zoomsToTest = [
|
||||
110,
|
||||
120,
|
||||
130,
|
||||
140,
|
||||
150,
|
||||
160,
|
||||
170,
|
||||
180,
|
||||
190,
|
||||
200,
|
||||
];
|
||||
|
||||
const originalZoom = SpecialPowers.getFullZoom(window);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
add_task(async () => {
|
||||
const s1 = await snapshotRect(window, emptyrows.getBoundingClientRect());
|
||||
for (let i = 0; i < zoomsToTest.length; ++i) {
|
||||
let relativeZoom = originalZoom * zoomsToTest[i] / 100;
|
||||
SpecialPowers.setFullZoom(window, relativeZoom);
|
||||
await raf();
|
||||
}
|
||||
SpecialPowers.setFullZoom(window, originalZoom);
|
||||
await raf();
|
||||
const s2 = await snapshotRect(window, emptyrows.getBoundingClientRect());
|
||||
assertSnapshots(s1, s2, true, null, "before", "after");
|
||||
});
|
||||
add_task(async () => { SpecialPowers.setFullZoom(window, originalZoom); });
|
||||
</script>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1825384">Mozilla Bug 1825384</a><br>
|
||||
<div id="emptyrows">
|
||||
<table>
|
||||
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
|
||||
<tr></tr>
|
||||
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
|
||||
<tr></tr>
|
||||
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
|
||||
<tr></tr>
|
||||
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
|
||||
</table>
|
||||
</div>
|
|
@ -45,7 +45,7 @@ function raf() {
|
|||
}
|
||||
|
||||
async function show_table(table, other) {
|
||||
// TODO(dshin): Once bug 1825384 resolves, this should not be needed.
|
||||
// Don't tempt subpixel snapping - try to position each table exactly the same.
|
||||
table.classList.remove("hide");
|
||||
other.classList.add("hide");
|
||||
getComputedStyle(table).getPropertyValue("display");
|
||||
|
|
Загрузка…
Ссылка в новой задаче