summaryrefslogtreecommitdiffstats
path: root/layout/tables
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /layout/tables
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/tables')
-rw-r--r--layout/tables/BasicTableLayoutStrategy.cpp14
-rw-r--r--layout/tables/FixedTableLayoutStrategy.cpp5
-rw-r--r--layout/tables/celldata.h4
-rw-r--r--layout/tables/nsCellMap.cpp34
-rw-r--r--layout/tables/nsTableCellFrame.cpp52
-rw-r--r--layout/tables/nsTableCellFrame.h90
-rw-r--r--layout/tables/nsTableColFrame.cpp1
-rw-r--r--layout/tables/nsTableColGroupFrame.cpp1
-rw-r--r--layout/tables/nsTableFrame.cpp162
-rw-r--r--layout/tables/nsTableRowFrame.cpp22
-rw-r--r--layout/tables/nsTableRowFrame.h14
-rw-r--r--layout/tables/nsTableRowGroupFrame.cpp3
-rw-r--r--layout/tables/nsTableWrapperFrame.cpp9
13 files changed, 183 insertions, 228 deletions
diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp
index 5cb890c234..b6fe51db59 100644
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -37,7 +37,6 @@ BasicTableLayoutStrategy::~BasicTableLayoutStrategy() = default;
/* virtual */
nscoord BasicTableLayoutStrategy::GetMinISize(gfxContext* aRenderingContext) {
- DISPLAY_MIN_INLINE_SIZE(mTableFrame, mMinISize);
if (mMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
ComputeIntrinsicISizes(aRenderingContext);
}
@@ -47,7 +46,6 @@ nscoord BasicTableLayoutStrategy::GetMinISize(gfxContext* aRenderingContext) {
/* virtual */
nscoord BasicTableLayoutStrategy::GetPrefISize(gfxContext* aRenderingContext,
bool aComputingSize) {
- DISPLAY_PREF_INLINE_SIZE(mTableFrame, mPrefISize);
NS_ASSERTION((mPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) ==
(mPrefISizePctExpand == NS_INTRINSIC_ISIZE_UNKNOWN),
"dirtyness out of sync");
@@ -97,18 +95,10 @@ static CellISizeInfo GetISizeInfo(gfxContext* aRenderingContext,
// XXX Should we ignore percentage padding?
nsIFrame::IntrinsicSizeOffsetData offsets = aFrame->IntrinsicISizeOffsets();
-
- // In quirks mode, table cell isize should be content-box,
- // but bsize should be border box.
- // Because of this historic anomaly, we do not use quirk.css.
- // (We can't specify one value of box-sizing for isize and another
- // for bsize).
- // For this reason, we also do not use box-sizing for just one of
- // them, as this may be confusing.
- if (isQuirks || stylePos->mBoxSizing == StyleBoxSizing::Content) {
+ if (stylePos->mBoxSizing == StyleBoxSizing::Content) {
boxSizingToBorderEdge = offsets.padding + offsets.border;
} else {
- // StyleBoxSizing::Border and standards-mode
+ // StyleBoxSizing::Border
minCoord += offsets.padding + offsets.border;
prefCoord += offsets.padding + offsets.border;
}
diff --git a/layout/tables/FixedTableLayoutStrategy.cpp b/layout/tables/FixedTableLayoutStrategy.cpp
index 8d74e3ba12..5eda3b001e 100644
--- a/layout/tables/FixedTableLayoutStrategy.cpp
+++ b/layout/tables/FixedTableLayoutStrategy.cpp
@@ -32,7 +32,6 @@ FixedTableLayoutStrategy::~FixedTableLayoutStrategy() = default;
/* virtual */
nscoord FixedTableLayoutStrategy::GetMinISize(gfxContext* aRenderingContext) {
- DISPLAY_MIN_INLINE_SIZE(mTableFrame, mMinISize);
if (mMinISize != NS_INTRINSIC_ISIZE_UNKNOWN) {
return mMinISize;
}
@@ -119,9 +118,7 @@ nscoord FixedTableLayoutStrategy::GetPrefISize(gfxContext* aRenderingContext,
// algorithm to find the narrowest inline size that would hold all of
// those intrinsic inline sizes), but it wouldn't be compatible with
// other browsers.
- nscoord result = nscoord_MAX;
- DISPLAY_PREF_INLINE_SIZE(mTableFrame, result);
- return result;
+ return nscoord_MAX;
}
/* virtual */
diff --git a/layout/tables/celldata.h b/layout/tables/celldata.h
index 681f0e9f28..22cdb4217d 100644
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -347,7 +347,7 @@ inline BCData::BCData() {
SetBStartStart(true);
SetIStartStart(true);
mIStartSize = mCornerSubSize = mBStartSize = 0;
- mCornerSide = mozilla::eLogicalSideBStart;
+ mCornerSide = static_cast<uint8_t>(mozilla::LogicalSide::BStart);
mCornerBevel = false;
}
@@ -393,7 +393,7 @@ inline BCPixelSize BCData::GetCorner(mozilla::LogicalSide& aOwnerSide,
inline void BCData::SetCorner(BCPixelSize aSubSize,
mozilla::LogicalSide aOwnerSide, bool aBevel) {
mCornerSubSize = aSubSize;
- mCornerSide = aOwnerSide;
+ mCornerSide = static_cast<uint8_t>(aOwnerSide);
mCornerBevel = aBevel;
}
diff --git a/layout/tables/nsCellMap.cpp b/layout/tables/nsCellMap.cpp
index 7c29baa5b0..60496d3ae0 100644
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -678,7 +678,8 @@ void nsTableCellMap::Dump(char* aString) const {
printf("l=%d%X%d ", int32_t(size), owner, segStart);
} else {
size = cd.GetCorner(side, bevel);
- printf("c=%d%X%d ", int32_t(size), side, bevel);
+ printf("c=%d%hhX%d ", int32_t(size), static_cast<uint8_t>(side),
+ bevel);
}
}
BCData& cd = mBCInfo->mBEndIEndCorner;
@@ -690,7 +691,7 @@ void nsTableCellMap::Dump(char* aString) const {
printf("l=%d%X%d ", int32_t(size), owner, segStart);
} else {
size = cd.GetCorner(side, bevel);
- printf("c=%d%X%d ", int32_t(size), side, bevel);
+ printf("c=%d%hhX%d ", int32_t(size), static_cast<uint8_t>(side), bevel);
}
}
printf("\n");
@@ -818,7 +819,7 @@ bool nsTableCellMap::RowHasSpanningCells(int32_t aRowIndex,
return false;
}
-// FIXME: The only value callers pass for aSide is eLogicalSideBEnd.
+// FIXME: The only value callers pass for aSide is LogicalSide::BEnd.
// Consider removing support for the other three values.
void nsTableCellMap::ResetBStartStart(LogicalSide aSide, nsCellMap& aCellMap,
uint32_t aRowGroupStart,
@@ -829,16 +830,16 @@ void nsTableCellMap::ResetBStartStart(LogicalSide aSide, nsCellMap& aCellMap,
BCData* bcData = nullptr;
switch (aSide) {
- case eLogicalSideBEnd:
+ case LogicalSide::BEnd:
aRowIndex++;
[[fallthrough]];
- case eLogicalSideBStart:
+ case LogicalSide::BStart:
cellData = (BCCellData*)aCellMap.GetDataAt(aRowIndex - aRowGroupStart,
aColIndex);
if (cellData) {
bcData = &cellData->mData;
} else {
- NS_ASSERTION(aSide == eLogicalSideBEnd, "program error");
+ NS_ASSERTION(aSide == LogicalSide::BEnd, "program error");
// try the next row group
nsCellMap* cellMap = aCellMap.GetNextSibling();
if (cellMap) {
@@ -851,16 +852,16 @@ void nsTableCellMap::ResetBStartStart(LogicalSide aSide, nsCellMap& aCellMap,
}
}
break;
- case eLogicalSideIEnd:
+ case LogicalSide::IEnd:
aColIndex++;
[[fallthrough]];
- case eLogicalSideIStart:
+ case LogicalSide::IStart:
cellData = (BCCellData*)aCellMap.GetDataAt(aRowIndex - aRowGroupStart,
aColIndex);
if (cellData) {
bcData = &cellData->mData;
} else {
- NS_ASSERTION(aSide == eLogicalSideIEnd, "program error");
+ NS_ASSERTION(aSide == LogicalSide::IEnd, "program error");
bcData = GetIEndMostBorder(aRowIndex);
}
break;
@@ -890,11 +891,11 @@ void nsTableCellMap::SetBCBorderEdge(LogicalSide aSide, nsCellMap& aCellMap,
bool changed;
switch (aSide) {
- case eLogicalSideBEnd:
+ case LogicalSide::BEnd:
rgYPos++;
yPos++;
[[fallthrough]];
- case eLogicalSideBStart:
+ case LogicalSide::BStart:
lastIndex = xPos + aLength - 1;
for (xIndex = xPos; xIndex <= lastIndex; xIndex++) {
changed = aChanged && (xIndex == xPos);
@@ -908,7 +909,7 @@ void nsTableCellMap::SetBCBorderEdge(LogicalSide aSide, nsCellMap& aCellMap,
false, 0, damageArea);
if (!cellData) ABORT0();
} else {
- NS_ASSERTION(aSide == eLogicalSideBEnd, "program error");
+ NS_ASSERTION(aSide == LogicalSide::BEnd, "program error");
// try the next non empty row group
nsCellMap* cellMap = aCellMap.GetNextSibling();
while (cellMap && (0 == cellMap->GetRowCount())) {
@@ -935,10 +936,10 @@ void nsTableCellMap::SetBCBorderEdge(LogicalSide aSide, nsCellMap& aCellMap,
NS_ERROR("Cellmap: BStart edge not found");
}
break;
- case eLogicalSideIEnd:
+ case LogicalSide::IEnd:
xPos++;
[[fallthrough]];
- case eLogicalSideIStart:
+ case LogicalSide::IStart:
// since bStart, bEnd borders were set, there should already be a cellData
// entry
lastIndex = rgYPos + aLength - 1;
@@ -948,7 +949,7 @@ void nsTableCellMap::SetBCBorderEdge(LogicalSide aSide, nsCellMap& aCellMap,
if (cellData) {
cellData->mData.SetIStartEdge(aOwner, aSize, changed);
} else {
- NS_ASSERTION(aSide == eLogicalSideIEnd, "program error");
+ NS_ASSERTION(aSide == LogicalSide::IEnd, "program error");
BCData* bcData = GetIEndMostBorder(yIndex + aCellMapStart);
if (bcData) {
bcData->SetIStartEdge(aOwner, aSize, changed);
@@ -2225,7 +2226,8 @@ void nsCellMap::Dump(bool aIsBorderCollapse) const {
printf("l=%d%d%d ", int32_t(size), owner, segStart);
} else {
size = cd->mData.GetCorner(side, bevel);
- printf("c=%d%d%d ", int32_t(size), side, bevel);
+ printf("c=%d%hhu%d ", int32_t(size), static_cast<uint8_t>(side),
+ bevel);
}
}
}
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index 6eb1c3146a..fdfa5e305e 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -48,9 +48,6 @@ nsTableCellFrame::nsTableCellFrame(ComputedStyle* aStyle,
nsTableFrame* aTableFrame, ClassID aID)
: nsContainerFrame(aStyle, aTableFrame->PresContext(), aID),
mDesiredSize(aTableFrame->GetWritingMode()) {
- mColIndex = 0;
- mPriorAvailISize = 0;
-
SetContentEmpty(false);
}
@@ -392,9 +389,14 @@ LogicalSides nsTableCellFrame::GetLogicalSkipSides() const {
/* virtual */
nsMargin nsTableCellFrame::GetBorderOverflow() { return nsMargin(0, 0, 0, 0); }
-// Align the cell's child frame within the cell
+void nsTableCellFrame::BlockDirAlignChild(
+ WritingMode aWM, nscoord aMaxAscent,
+ ForceAlignTopForTableCell aForceAlignTop) {
+ MOZ_ASSERT(aForceAlignTop != ForceAlignTopForTableCell::Yes ||
+ PresContext()->IsPaginated(),
+ "We shouldn't force table-cells to do 'vertical-align:top' if "
+ "we're not in printing!");
-void nsTableCellFrame::BlockDirAlignChild(WritingMode aWM, nscoord aMaxAscent) {
/* It's the 'border-collapse' on the table that matters */
const LogicalMargin border = GetLogicalUsedBorder(GetWritingMode())
.ApplySkipSides(GetLogicalSkipSides())
@@ -413,8 +415,11 @@ void nsTableCellFrame::BlockDirAlignChild(WritingMode aWM, nscoord aMaxAscent) {
nscoord childBSize = kidRect.BSize(aWM);
// Vertically align the child
+ const auto verticalAlign = aForceAlignTop == ForceAlignTopForTableCell::Yes
+ ? StyleVerticalAlignKeyword::Top
+ : GetVerticalAlign();
nscoord kidBStart = 0;
- switch (GetVerticalAlign()) {
+ switch (verticalAlign) {
case StyleVerticalAlignKeyword::Baseline:
if (!GetContentEmpty()) {
// Align the baselines of the child frame with the baselines of
@@ -590,26 +595,18 @@ nsIScrollableFrame* nsTableCellFrame::GetScrollTargetFrame() const {
/* virtual */
nscoord nsTableCellFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result = 0;
- DISPLAY_MIN_INLINE_SIZE(this, result);
-
nsIFrame* inner = mFrames.FirstChild();
- result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
- IntrinsicISizeType::MinISize,
- nsLayoutUtils::IGNORE_PADDING);
- return result;
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
+ IntrinsicISizeType::MinISize,
+ nsLayoutUtils::IGNORE_PADDING);
}
/* virtual */
nscoord nsTableCellFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result = 0;
- DISPLAY_PREF_INLINE_SIZE(this, result);
-
nsIFrame* inner = mFrames.FirstChild();
- result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
- IntrinsicISizeType::PrefISize,
- nsLayoutUtils::IGNORE_PADDING);
- return result;
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
+ IntrinsicISizeType::PrefISize,
+ nsLayoutUtils::IGNORE_PADDING);
}
/* virtual */ nsIFrame::IntrinsicSizeOffsetData
@@ -675,7 +672,6 @@ void nsTableCellFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
if (aReflowInput.mFlags.mSpecialBSizeReflow) {
@@ -708,14 +704,12 @@ void nsTableCellFrame::Reflow(nsPresContext* aPresContext,
if (aReflowInput.mFlags.mSpecialBSizeReflow) {
const_cast<ReflowInput&>(aReflowInput)
.SetComputedBSize(BSize(wm) - bp.BStartEnd(wm));
- DISPLAY_REFLOW_CHANGE();
} else {
const nscoord computedUnpaginatedBSize =
CalcUnpaginatedBSize(*this, *tableFrame, bp.BStartEnd(wm));
if (computedUnpaginatedBSize > 0) {
const_cast<ReflowInput&>(aReflowInput)
.SetComputedBSize(computedUnpaginatedBSize);
- DISPLAY_REFLOW_CHANGE();
}
}
}
@@ -977,11 +971,11 @@ LogicalMargin nsBCTableCellFrame::GetBorderWidth(WritingMode aWM) const {
BCPixelSize nsBCTableCellFrame::GetBorderWidth(LogicalSide aSide) const {
switch (aSide) {
- case eLogicalSideBStart:
+ case LogicalSide::BStart:
return BC_BORDER_END_HALF(mBStartBorder);
- case eLogicalSideIEnd:
+ case LogicalSide::IEnd:
return BC_BORDER_START_HALF(mIEndBorder);
- case eLogicalSideBEnd:
+ case LogicalSide::BEnd:
return BC_BORDER_START_HALF(mBEndBorder);
default:
return BC_BORDER_END_HALF(mIStartBorder);
@@ -990,13 +984,13 @@ BCPixelSize nsBCTableCellFrame::GetBorderWidth(LogicalSide aSide) const {
void nsBCTableCellFrame::SetBorderWidth(LogicalSide aSide, BCPixelSize aValue) {
switch (aSide) {
- case eLogicalSideBStart:
+ case LogicalSide::BStart:
mBStartBorder = aValue;
break;
- case eLogicalSideIEnd:
+ case LogicalSide::IEnd:
mIEndBorder = aValue;
break;
- case eLogicalSideBEnd:
+ case LogicalSide::BEnd:
mBEndBorder = aValue;
break;
default:
diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h
index f9b6f3ccac..ae1a881819 100644
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -34,9 +34,6 @@ class PresShell;
class nsTableCellFrame : public nsContainerFrame,
public nsITableCellLayout,
public nsIPercentBSizeObserver {
- typedef mozilla::gfx::DrawTarget DrawTarget;
- typedef mozilla::image::ImgDrawResult ImgDrawResult;
-
friend nsTableCellFrame* NS_NewTableCellFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle,
nsTableFrame* aTableFrame);
@@ -44,11 +41,6 @@ class nsTableCellFrame : public nsContainerFrame,
nsTableCellFrame(ComputedStyle* aStyle, nsTableFrame* aTableFrame)
: nsTableCellFrame(aStyle, aTableFrame, kClassID) {}
- protected:
- typedef mozilla::WritingMode WritingMode;
- typedef mozilla::LogicalSide LogicalSide;
- typedef mozilla::LogicalMargin LogicalMargin;
-
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsTableCellFrame)
@@ -122,7 +114,9 @@ class nsTableCellFrame : public nsContainerFrame,
nsresult GetFrameName(nsAString& aResult) const override;
#endif
- void BlockDirAlignChild(mozilla::WritingMode aWM, nscoord aMaxAscent);
+ // Align the cell's child frame within the cell.
+ void BlockDirAlignChild(mozilla::WritingMode aWM, nscoord aMaxAscent,
+ mozilla::ForceAlignTopForTableCell aForceAlignTop);
/*
* Get the value of vertical-align adjusted for CSS 2's rules for a
@@ -193,20 +187,24 @@ class nsTableCellFrame : public nsContainerFrame,
void SetColIndex(int32_t aColIndex);
- /** return the available isize given to this frame during its last reflow */
- inline nscoord GetPriorAvailISize();
-
- /** set the available isize given to this frame during its last reflow */
- inline void SetPriorAvailISize(nscoord aPriorAvailISize);
-
- /** return the desired size returned by this frame during its last reflow */
- inline mozilla::LogicalSize GetDesiredSize();
+ // Get or set the available isize given to this frame during its last reflow.
+ nscoord GetPriorAvailISize() const { return mPriorAvailISize; }
+ void SetPriorAvailISize(nscoord aPriorAvailISize) {
+ mPriorAvailISize = aPriorAvailISize;
+ }
- /** set the desired size returned by this frame during its last reflow */
- inline void SetDesiredSize(const ReflowOutput& aDesiredSize);
+ // Get or set the desired size returned by this frame during its last reflow.
+ mozilla::LogicalSize GetDesiredSize() const { return mDesiredSize; }
+ void SetDesiredSize(const ReflowOutput& aDesiredSize) {
+ mDesiredSize = aDesiredSize.Size(GetWritingMode());
+ }
- bool GetContentEmpty() const;
- void SetContentEmpty(bool aContentEmpty);
+ bool GetContentEmpty() const {
+ return HasAnyStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
+ }
+ void SetContentEmpty(bool aContentEmpty) {
+ AddOrRemoveStateBits(NS_TABLE_CELL_CONTENT_EMPTY, aContentEmpty);
+ }
nsTableCellFrame* GetNextCell() const {
nsIFrame* sibling = GetNextSibling();
@@ -216,7 +214,7 @@ class nsTableCellFrame : public nsContainerFrame,
return static_cast<nsTableCellFrame*>(sibling);
}
- virtual LogicalMargin GetBorderWidth(WritingMode aWM) const;
+ virtual mozilla::LogicalMargin GetBorderWidth(mozilla::WritingMode aWM) const;
void DecorateForSelection(DrawTarget* aDrawTarget, nsPoint aPt);
@@ -251,44 +249,17 @@ class nsTableCellFrame : public nsContainerFrame,
friend class nsTableRowFrame;
- uint32_t mColIndex; // the starting column for this cell
-
- nscoord mPriorAvailISize; // the avail isize during the last reflow
- mozilla::LogicalSize mDesiredSize; // the last desired inline and block size
-};
-
-inline nscoord nsTableCellFrame::GetPriorAvailISize() {
- return mPriorAvailISize;
-}
-
-inline void nsTableCellFrame::SetPriorAvailISize(nscoord aPriorAvailISize) {
- mPriorAvailISize = aPriorAvailISize;
-}
-
-inline mozilla::LogicalSize nsTableCellFrame::GetDesiredSize() {
- return mDesiredSize;
-}
-
-inline void nsTableCellFrame::SetDesiredSize(const ReflowOutput& aDesiredSize) {
- mDesiredSize = aDesiredSize.Size(GetWritingMode());
-}
+ // The starting column for this cell
+ uint32_t mColIndex = 0;
-inline bool nsTableCellFrame::GetContentEmpty() const {
- return HasAnyStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
-}
+ // The avail isize during the last reflow
+ nscoord mPriorAvailISize = 0;
-inline void nsTableCellFrame::SetContentEmpty(bool aContentEmpty) {
- if (aContentEmpty) {
- AddStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
- } else {
- RemoveStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
- }
-}
+ // The last desired inline and block size
+ mozilla::LogicalSize mDesiredSize;
+};
-// nsBCTableCellFrame
class nsBCTableCellFrame final : public nsTableCellFrame {
- typedef mozilla::image::ImgDrawResult ImgDrawResult;
-
public:
NS_DECL_FRAMEARENA_HELPERS(nsBCTableCellFrame)
@@ -299,13 +270,14 @@ class nsBCTableCellFrame final : public nsTableCellFrame {
nsMargin GetUsedBorder() const override;
// Get the *inner half of the border only*, in twips.
- LogicalMargin GetBorderWidth(WritingMode aWM) const override;
+ mozilla::LogicalMargin GetBorderWidth(
+ mozilla::WritingMode aWM) const override;
// Get the *inner half of the border only*, in pixels.
- BCPixelSize GetBorderWidth(LogicalSide aSide) const;
+ BCPixelSize GetBorderWidth(mozilla::LogicalSide aSide) const;
// Set the full (both halves) width of the border
- void SetBorderWidth(LogicalSide aSide, BCPixelSize aPixelValue);
+ void SetBorderWidth(mozilla::LogicalSide aSide, BCPixelSize aPixelValue);
nsMargin GetBorderOverflow() override;
diff --git a/layout/tables/nsTableColFrame.cpp b/layout/tables/nsTableColFrame.cpp
index 16eab74cab..8031d4c47c 100644
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -82,7 +82,6 @@ void nsTableColFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableColFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
aDesiredSize.ClearSize();
const nsStyleVisibility* colVis = StyleVisibility();
diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp
index 54fe53a5c4..bf0200e27c 100644
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -329,7 +329,6 @@ void nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_ASSERTION(nullptr != mContent, "bad state -- null content for frame");
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index e7fd7340bf..84bdbc48af 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1615,7 +1615,6 @@ void nsTableFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
"The nsTableWrapperFrame should be the out-of-flow if needed");
@@ -4537,7 +4536,7 @@ struct BCCornerInfo {
ownerColor = 0;
ownerWidth = subWidth = ownerElem = subSide = subElem = hasDashDot =
numSegs = bevel = 0;
- ownerSide = eLogicalSideBStart;
+ ownerSide = static_cast<uint16_t>(LogicalSide::BStart);
ownerStyle = BORDER_STYLE_UNSET;
subStyle = StyleBorderStyle::Solid;
}
@@ -4552,7 +4551,7 @@ struct BCCornerInfo {
// border perpendicular to ownerSide
StyleBorderStyle subStyle; // border style of subElem
StyleBorderStyle ownerStyle; // border style of ownerElem
- uint16_t ownerSide : 2; // LogicalSide (e.g eLogicalSideBStart, etc) of the
+ uint16_t ownerSide : 2; // LogicalSide (e.g LogicalSide::BStart, etc) of the
// border owning the corner relative to the corner
uint16_t
ownerElem : 4; // elem type (e.g. eTable, eGroup, etc) owning the corner
@@ -4575,7 +4574,7 @@ void BCCornerInfo::Set(mozilla::LogicalSide aSide, BCCellBorder aBorder) {
ownerStyle = aBorder.style;
ownerWidth = aBorder.width;
ownerColor = aBorder.color;
- ownerSide = aSide;
+ ownerSide = static_cast<uint16_t>(aSide);
hasDashDot = 0;
numSegs = 0;
if (aBorder.width > 0) {
@@ -4586,7 +4585,8 @@ void BCCornerInfo::Set(mozilla::LogicalSide aSide, BCCellBorder aBorder) {
bevel = 0;
subWidth = 0;
// the following will get set later
- subSide = IsInline(aSide) ? eLogicalSideBStart : eLogicalSideIStart;
+ subSide = static_cast<uint16_t>(IsInline(aSide) ? LogicalSide::BStart
+ : LogicalSide::IStart);
subElem = eTableOwner;
subStyle = StyleBorderStyle::Solid;
}
@@ -4631,16 +4631,16 @@ void BCCornerInfo::Update(mozilla::LogicalSide aSide, BCCellBorder aBorder) {
subStyle = tempBorder.style;
subWidth = tempBorder.width;
if (!firstWins) {
- subSide = aSide;
+ subSide = static_cast<uint16_t>(aSide);
}
}
} else { // input args are dominant
- ownerSide = aSide;
+ ownerSide = static_cast<uint16_t>(aSide);
if (::Perpendicular(oldSide, LogicalSide(ownerSide))) {
subElem = oldBorder.owner;
subStyle = oldBorder.style;
subWidth = oldBorder.width;
- subSide = oldSide;
+ subSide = static_cast<uint16_t>(oldSide);
}
}
if (aBorder.width > 0) {
@@ -4886,8 +4886,8 @@ void BCMapCellInfo::SetIEndBorderWidths(BCPixelSize aWidth) {
// update the borders of the cells and cols affected
if (mCell) {
mCell->SetBorderWidth(
- eLogicalSideIEnd,
- std::max(aWidth, mCell->GetBorderWidth(eLogicalSideIEnd)));
+ LogicalSide::IEnd,
+ std::max(aWidth, mCell->GetBorderWidth(LogicalSide::IEnd)));
}
if (mEndCol) {
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
@@ -4899,8 +4899,8 @@ void BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth) {
// update the borders of the affected cells and rows
if (mCell) {
mCell->SetBorderWidth(
- eLogicalSideBEnd,
- std::max(aWidth, mCell->GetBorderWidth(eLogicalSideBEnd)));
+ LogicalSide::BEnd,
+ std::max(aWidth, mCell->GetBorderWidth(LogicalSide::BEnd)));
}
if (mEndRow) {
BCPixelSize half = BC_BORDER_START_HALF(aWidth);
@@ -4912,8 +4912,8 @@ void BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth) {
void BCMapCellInfo::SetBStartBorderWidths(BCPixelSize aWidth) {
if (mCell) {
mCell->SetBorderWidth(
- eLogicalSideBStart,
- std::max(aWidth, mCell->GetBorderWidth(eLogicalSideBStart)));
+ LogicalSide::BStart,
+ std::max(aWidth, mCell->GetBorderWidth(LogicalSide::BStart)));
}
if (mStartRow) {
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
@@ -4925,8 +4925,8 @@ void BCMapCellInfo::SetBStartBorderWidths(BCPixelSize aWidth) {
void BCMapCellInfo::SetIStartBorderWidths(BCPixelSize aWidth) {
if (mCell) {
mCell->SetBorderWidth(
- eLogicalSideIStart,
- std::max(aWidth, mCell->GetBorderWidth(eLogicalSideIStart)));
+ LogicalSide::IStart,
+ std::max(aWidth, mCell->GetBorderWidth(LogicalSide::IStart)));
}
if (mStartCol) {
BCPixelSize half = BC_BORDER_END_HALF(aWidth);
@@ -4957,46 +4957,46 @@ void BCMapCellInfo::IncrementRow(bool aResetToBStartRowOfCell) {
BCCellBorder BCMapCellInfo::GetBStartEdgeBorder() {
return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame,
mRowGroup, mStartRow, mCell, mTableWM,
- eLogicalSideBStart, !ADJACENT);
+ LogicalSide::BStart, !ADJACENT);
}
BCCellBorder BCMapCellInfo::GetBEndEdgeBorder() {
return CompareBorders(mTableFrame, mCurrentColGroupFrame, mCurrentColFrame,
- mRowGroup, mEndRow, mCell, mTableWM, eLogicalSideBEnd,
+ mRowGroup, mEndRow, mCell, mTableWM, LogicalSide::BEnd,
ADJACENT);
}
BCCellBorder BCMapCellInfo::GetIStartEdgeBorder() {
return CompareBorders(mTableFrame, mColGroup, mStartCol, mRowGroup,
- mCurrentRowFrame, mCell, mTableWM, eLogicalSideIStart,
+ mCurrentRowFrame, mCell, mTableWM, LogicalSide::IStart,
!ADJACENT);
}
BCCellBorder BCMapCellInfo::GetIEndEdgeBorder() {
return CompareBorders(mTableFrame, mColGroup, mEndCol, mRowGroup,
- mCurrentRowFrame, mCell, mTableWM, eLogicalSideIEnd,
+ mCurrentRowFrame, mCell, mTableWM, LogicalSide::IEnd,
ADJACENT);
}
BCCellBorder BCMapCellInfo::GetIEndInternalBorder() {
const nsIFrame* cg = mCgAtEnd ? mColGroup : nullptr;
return CompareBorders(nullptr, cg, mEndCol, nullptr, nullptr, mCell, mTableWM,
- eLogicalSideIEnd, ADJACENT);
+ LogicalSide::IEnd, ADJACENT);
}
BCCellBorder BCMapCellInfo::GetIStartInternalBorder() {
const nsIFrame* cg = mCgAtStart ? mColGroup : nullptr;
return CompareBorders(nullptr, cg, mStartCol, nullptr, nullptr, mCell,
- mTableWM, eLogicalSideIStart, !ADJACENT);
+ mTableWM, LogicalSide::IStart, !ADJACENT);
}
BCCellBorder BCMapCellInfo::GetBEndInternalBorder() {
const nsIFrame* rg = mRgAtEnd ? mRowGroup : nullptr;
return CompareBorders(nullptr, nullptr, nullptr, rg, mEndRow, mCell, mTableWM,
- eLogicalSideBEnd, ADJACENT);
+ LogicalSide::BEnd, ADJACENT);
}
BCCellBorder BCMapCellInfo::GetBStartInternalBorder() {
const nsIFrame* rg = mRgAtStart ? mRowGroup : nullptr;
return CompareBorders(nullptr, nullptr, nullptr, rg, mStartRow, mCell,
- mTableWM, eLogicalSideBStart, !ADJACENT);
+ mTableWM, LogicalSide::BStart, !ADJACENT);
}
// Calculate border information for border-collapsed tables.
@@ -5164,9 +5164,10 @@ void nsTableFrame::CalcBCBorders() {
// table, row group, row if the border is at the bStart of the table,
// otherwise it was processed in a previous row
if (0 == info.mRowIndex) {
- if (!tableBorderReset[eLogicalSideBStart]) {
+ uint8_t idxBStart = static_cast<uint8_t>(LogicalSide::BStart);
+ if (!tableBorderReset[idxBStart]) {
propData->mBStartBorderWidth = 0;
- tableBorderReset[eLogicalSideBStart] = true;
+ tableBorderReset[idxBStart] = true;
}
for (int32_t colIdx = info.mColIndex; colIdx <= info.GetCellEndColIndex();
colIdx++) {
@@ -5175,9 +5176,9 @@ void nsTableFrame::CalcBCBorders() {
BCCornerInfo& bStartIStartCorner = bStartCorners[colIdx];
// Mark inline-end direction border from this corner.
if (0 == colIdx) {
- bStartIStartCorner.Set(eLogicalSideIEnd, currentBorder);
+ bStartIStartCorner.Set(LogicalSide::IEnd, currentBorder);
} else {
- bStartIStartCorner.Update(eLogicalSideIEnd, currentBorder);
+ bStartIStartCorner.Update(LogicalSide::IEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BStartIStart, *iter.mCellMap, 0, 0, colIdx,
LogicalSide(bStartIStartCorner.ownerSide),
@@ -5186,7 +5187,7 @@ void nsTableFrame::CalcBCBorders() {
// Above, we set the corner `colIndex` column as having a border towards
// inline-end, heading towards the next column. Vice versa is also true,
// where the next column has a border heading towards this column.
- bStartCorners[colIdx + 1].Set(eLogicalSideIStart, currentBorder);
+ bStartCorners[colIdx + 1].Set(LogicalSide::IStart, currentBorder);
MOZ_ASSERT(firstRowBStartEdgeBorder,
"Inline start border tracking not set?");
// update firstRowBStartEdgeBorder and see if a new segment starts
@@ -5196,7 +5197,7 @@ void nsTableFrame::CalcBCBorders() {
firstRowBStartEdgeBorder.ref())
: true;
// store the border segment in the cell map
- tableCellMap->SetBCBorderEdge(eLogicalSideBStart, *iter.mCellMap, 0, 0,
+ tableCellMap->SetBCBorderEdge(LogicalSide::BStart, *iter.mCellMap, 0, 0,
colIdx, 1, currentBorder.owner,
currentBorder.width, startSeg);
@@ -5225,9 +5226,10 @@ void nsTableFrame::CalcBCBorders() {
// table, col group, col if the border is at the iStart of the table,
// otherwise it was processed in a previous col
if (0 == info.mColIndex) {
- if (!tableBorderReset[eLogicalSideIStart]) {
+ uint8_t idxIStart = static_cast<uint8_t>(LogicalSide::IStart);
+ if (!tableBorderReset[idxIStart]) {
propData->mIStartBorderWidth = 0;
- tableBorderReset[eLogicalSideIStart] = true;
+ tableBorderReset[idxIStart] = true;
}
info.mCurrentRowFrame = nullptr;
for (int32_t rowB = info.mRowIndex; rowB <= info.GetCellEndRowIndex();
@@ -5236,17 +5238,17 @@ void nsTableFrame::CalcBCBorders() {
BCCellBorder currentBorder = info.GetIStartEdgeBorder();
BCCornerInfo& bStartIStartCorner =
(0 == rowB) ? bStartCorners[0] : bEndCorners[0];
- bStartIStartCorner.Update(eLogicalSideBEnd, currentBorder);
+ bStartIStartCorner.Update(LogicalSide::BEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BStartIStart, *iter.mCellMap, iter.mRowGroupStart,
rowB, 0, LogicalSide(bStartIStartCorner.ownerSide),
bStartIStartCorner.subWidth, bStartIStartCorner.bevel);
- bEndCorners[0].Set(eLogicalSideBStart, currentBorder);
+ bEndCorners[0].Set(LogicalSide::BStart, currentBorder);
// update lastBlockDirBorders and see if a new segment starts
bool startSeg = SetBorder(currentBorder, lastBlockDirBorders[0]);
// store the border segment in the cell map
- tableCellMap->SetBCBorderEdge(eLogicalSideIStart, *iter.mCellMap,
+ tableCellMap->SetBCBorderEdge(LogicalSide::IStart, *iter.mCellMap,
iter.mRowGroupStart, rowB, info.mColIndex,
1, currentBorder.owner,
currentBorder.width, startSeg);
@@ -5261,9 +5263,10 @@ void nsTableFrame::CalcBCBorders() {
// cells and the table, row group, row
if (info.mNumTableCols == info.GetCellEndColIndex() + 1) {
// touches iEnd edge of table
- if (!tableBorderReset[eLogicalSideIEnd]) {
+ uint8_t idxIEnd = static_cast<uint8_t>(LogicalSide::IEnd);
+ if (!tableBorderReset[idxIEnd]) {
propData->mIEndBorderWidth = 0;
- tableBorderReset[eLogicalSideIEnd] = true;
+ tableBorderReset[idxIEnd] = true;
}
info.mCurrentRowFrame = nullptr;
for (int32_t rowB = info.mRowIndex; rowB <= info.GetCellEndRowIndex();
@@ -5275,7 +5278,7 @@ void nsTableFrame::CalcBCBorders() {
BCCornerInfo& bStartIEndCorner =
(0 == rowB) ? bStartCorners[info.GetCellEndColIndex() + 1]
: bEndCorners[info.GetCellEndColIndex() + 1];
- bStartIEndCorner.Update(eLogicalSideBEnd, currentBorder);
+ bStartIEndCorner.Update(LogicalSide::BEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BStartIEnd, *iter.mCellMap, iter.mRowGroupStart,
rowB, info.GetCellEndColIndex(),
@@ -5283,7 +5286,7 @@ void nsTableFrame::CalcBCBorders() {
bStartIEndCorner.bevel);
BCCornerInfo& bEndIEndCorner =
bEndCorners[info.GetCellEndColIndex() + 1];
- bEndIEndCorner.Set(eLogicalSideBStart, currentBorder);
+ bEndIEndCorner.Set(LogicalSide::BStart, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BEndIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
info.GetCellEndColIndex(), LogicalSide(bEndIEndCorner.ownerSide),
@@ -5293,7 +5296,7 @@ void nsTableFrame::CalcBCBorders() {
currentBorder, lastBlockDirBorders[info.GetCellEndColIndex() + 1]);
// store the border segment in the cell map and update cellBorders
tableCellMap->SetBCBorderEdge(
- eLogicalSideIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
+ LogicalSide::IEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
info.GetCellEndColIndex(), 1, currentBorder.owner,
currentBorder.width, startSeg);
// Set border width at inline-end (table-wide and for the cell), but
@@ -5325,7 +5328,7 @@ void nsTableFrame::CalcBCBorders() {
if (info.GetCellEndColIndex() < damageArea.EndCol() &&
rowB >= damageArea.StartRow() && rowB < damageArea.EndRow()) {
tableCellMap->SetBCBorderEdge(
- eLogicalSideIEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
+ LogicalSide::IEnd, *iter.mCellMap, iter.mRowGroupStart, rowB,
info.GetCellEndColIndex(), segLength, currentBorder.owner,
currentBorder.width, startSeg);
info.SetIEndBorderWidths(currentBorder.width);
@@ -5346,7 +5349,7 @@ void nsTableFrame::CalcBCBorders() {
? &bStartCorners[info.GetCellEndColIndex() + 1]
: &bEndCorners[info.GetCellEndColIndex() +
1]; // From previous row.
- bStartIEndCorner->Update(eLogicalSideBEnd, currentBorder);
+ bStartIEndCorner->Update(LogicalSide::BEnd, currentBorder);
// If this is a rowspan, need to consider if this "corner" is generating
// an inline segment for the adjacent cell. e.g.
//
@@ -5360,7 +5363,7 @@ void nsTableFrame::CalcBCBorders() {
BCCellBorder adjacentBorder = ajaInfo.GetBStartInternalBorder();
currentBorder = CompareBorders(!CELL_CORNER, currentBorder,
adjacentBorder, INLINE_DIR);
- bStartIEndCorner->Update(eLogicalSideIEnd, currentBorder);
+ bStartIEndCorner->Update(LogicalSide::IEnd, currentBorder);
}
// Check that the spanned area is inside of the invalidation area
if (info.GetCellEndColIndex() < damageArea.EndCol() &&
@@ -5387,7 +5390,7 @@ void nsTableFrame::CalcBCBorders() {
BCCornerInfo& bEndIEndCorner =
(hitsSpanOnIEnd) ? bStartCorners[info.GetCellEndColIndex() + 1]
: bEndCorners[info.GetCellEndColIndex() + 1];
- bEndIEndCorner.Set(eLogicalSideBStart, currentBorder);
+ bEndIEndCorner.Set(LogicalSide::BStart, currentBorder);
priorAjaInfo = ajaInfo;
}
}
@@ -5400,23 +5403,24 @@ void nsTableFrame::CalcBCBorders() {
// cells and the table, row group, row
if (info.mNumTableRows == info.GetCellEndRowIndex() + 1) {
// touches bEnd edge of table
- if (!tableBorderReset[eLogicalSideBEnd]) {
+ uint8_t idxBEnd = static_cast<uint8_t>(LogicalSide::BEnd);
+ if (!tableBorderReset[idxBEnd]) {
propData->mBEndBorderWidth = 0;
- tableBorderReset[eLogicalSideBEnd] = true;
+ tableBorderReset[idxBEnd] = true;
}
for (int32_t colIdx = info.mColIndex; colIdx <= info.GetCellEndColIndex();
colIdx++) {
info.SetColumn(colIdx);
BCCellBorder currentBorder = info.GetBEndEdgeBorder();
BCCornerInfo& bEndIStartCorner = bEndCorners[colIdx];
- bEndIStartCorner.Update(eLogicalSideIEnd, currentBorder);
+ bEndIStartCorner.Update(LogicalSide::IEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BEndIStart, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx,
LogicalSide(bEndIStartCorner.ownerSide), bEndIStartCorner.subWidth,
bEndIStartCorner.bevel);
BCCornerInfo& bEndIEndCorner = bEndCorners[colIdx + 1];
- bEndIEndCorner.Update(eLogicalSideIStart, currentBorder);
+ bEndIEndCorner.Update(LogicalSide::IStart, currentBorder);
// Store the block-end inline-end corner if it also is the block-end
// inline-end of the overall table.
if (info.mNumTableCols == colIdx + 1) {
@@ -5439,7 +5443,7 @@ void nsTableFrame::CalcBCBorders() {
}
// store the border segment in the cell map and update cellBorders
tableCellMap->SetBCBorderEdge(
- eLogicalSideBEnd, *iter.mCellMap, iter.mRowGroupStart,
+ LogicalSide::BEnd, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx, 1, currentBorder.owner,
currentBorder.width, startSeg);
// update lastBEndBorders
@@ -5486,12 +5490,12 @@ void nsTableFrame::CalcBCBorders() {
} else if (prevRowIndex < info.GetCellEndRowIndex() + 1) {
// spans below the cell to the iStart side
bStartCorners[colIdx] = bEndIStartCorner;
- bEndIStartCorner.Set(eLogicalSideIEnd, currentBorder);
+ bEndIStartCorner.Set(LogicalSide::IEnd, currentBorder);
update = false;
}
}
if (update) {
- bEndIStartCorner.Update(eLogicalSideIEnd, currentBorder);
+ bEndIStartCorner.Update(LogicalSide::IEnd, currentBorder);
}
// Check that the spanned area is inside of the invalidation area
if (info.GetCellEndRowIndex() < damageArea.EndRow() &&
@@ -5506,7 +5510,7 @@ void nsTableFrame::CalcBCBorders() {
// Propagate this segment down the colspan
for (int32_t c = colIdx + 1; c < colIdx + segLength; c++) {
BCCornerInfo& corner = bEndCorners[c];
- corner.Set(eLogicalSideIEnd, currentBorder);
+ corner.Set(LogicalSide::IEnd, currentBorder);
tableCellMap->SetBCBorderCorner(
LogicalCorner::BEndIStart, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), c, LogicalSide(corner.ownerSide),
@@ -5533,7 +5537,7 @@ void nsTableFrame::CalcBCBorders() {
if (info.GetCellEndRowIndex() < damageArea.EndRow() &&
colIdx >= damageArea.StartCol() && colIdx < damageArea.EndCol()) {
tableCellMap->SetBCBorderEdge(
- eLogicalSideBEnd, *iter.mCellMap, iter.mRowGroupStart,
+ LogicalSide::BEnd, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), colIdx, segLength, currentBorder.owner,
currentBorder.width, startSeg);
info.SetBEndBorderWidths(currentBorder.width);
@@ -5541,7 +5545,7 @@ void nsTableFrame::CalcBCBorders() {
}
// update bEnd-iEnd corner
BCCornerInfo& bEndIEndCorner = bEndCorners[colIdx + segLength];
- bEndIEndCorner.Update(eLogicalSideIStart, currentBorder);
+ bEndIEndCorner.Update(LogicalSide::IStart, currentBorder);
}
}
// o------o------o
@@ -5570,7 +5574,7 @@ void nsTableFrame::CalcBCBorders() {
// new segment
if (iter.mCellMap) {
tableCellMap->ResetBStartStart(
- eLogicalSideBEnd, *iter.mCellMap, iter.mRowGroupStart,
+ LogicalSide::BEnd, *iter.mCellMap, iter.mRowGroupStart,
info.GetCellEndRowIndex(), nextColIndex);
}
}
@@ -6248,7 +6252,7 @@ static nscoord CalcVerCornerOffset(nsPresContext* aPresContext,
offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
} else {
offset =
- (eLogicalSideBStart == aCornerOwnerSide) ? smallHalf : -largeHalf;
+ (LogicalSide::BStart == aCornerOwnerSide) ? smallHalf : -largeHalf;
}
} else {
DivideBCBorderSize(aHorWidth, smallHalf, largeHalf);
@@ -6283,7 +6287,7 @@ static nscoord CalcHorCornerOffset(nsPresContext* aPresContext,
offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
} else {
offset =
- (eLogicalSideIStart == aCornerOwnerSide) ? smallHalf : -largeHalf;
+ (LogicalSide::IStart == aCornerOwnerSide) ? smallHalf : -largeHalf;
}
} else {
DivideBCBorderSize(aVerWidth, smallHalf, largeHalf);
@@ -6305,7 +6309,7 @@ BCBlockDirSeg::BCBlockDirSeg()
mCol = nullptr;
mFirstCell = mLastCell = mAjaCell = nullptr;
mOffsetI = mOffsetB = mLength = mWidth = mBStartBevelOffset = 0;
- mBStartBevelSide = eLogicalSideBStart;
+ mBStartBevelSide = LogicalSide::BStart;
mOwner = eCellOwner;
}
@@ -6322,7 +6326,7 @@ void BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
BCPixelSize aBlockSegISize,
BCPixelSize aInlineSegBSize,
Maybe<nscoord> aEmptyRowEndBSize) {
- LogicalSide ownerSide = eLogicalSideBStart;
+ LogicalSide ownerSide = LogicalSide::BStart;
bool bevel = false;
nscoord cornerSubWidth =
@@ -6339,7 +6343,7 @@ void BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
bStartBevel ? presContext->DevPixelsToAppUnits(maxInlineSegBSize) : 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mBStartBevelSide =
- (aInlineSegBSize > 0) ? eLogicalSideIEnd : eLogicalSideIStart;
+ (aInlineSegBSize > 0) ? LogicalSide::IEnd : LogicalSide::IStart;
if (aEmptyRowEndBSize && *aEmptyRowEndBSize < offset) {
// This segment is starting from an empty row. This will require the the
// starting segment to overlap with the previously drawn segment, unless the
@@ -6390,7 +6394,7 @@ void BCBlockDirSeg::Initialize(BCPaintBorderIterator& aIter) {
*/
void BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
BCPixelSize aInlineSegBSize) {
- LogicalSide ownerSide = eLogicalSideBStart;
+ LogicalSide ownerSide = LogicalSide::BStart;
nscoord cornerSubWidth = 0;
bool bevel = false;
if (aIter.mBCData) {
@@ -6410,7 +6414,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
// get the border style, color and paint the segment
LogicalSide side =
- aIter.IsDamageAreaIEndMost() ? eLogicalSideIEnd : eLogicalSideIStart;
+ aIter.IsDamageAreaIEndMost() ? LogicalSide::IEnd : LogicalSide::IStart;
int32_t relColIndex = aIter.GetRelativeColIndex();
nsTableColFrame* col = mCol;
if (!col) ABORT1(Nothing());
@@ -6430,7 +6434,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
owner = aIter.mTable;
break;
case eAjaColGroupOwner:
- side = eLogicalSideIEnd;
+ side = LogicalSide::IEnd;
if (!aIter.IsTableIEndMost() && (relColIndex > 0)) {
col = aIter.mBlockDirInfo[relColIndex - 1].mCol;
}
@@ -6441,7 +6445,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
}
break;
case eAjaColOwner:
- side = eLogicalSideIEnd;
+ side = LogicalSide::IEnd;
if (!aIter.IsTableIEndMost() && (relColIndex > 0)) {
col = aIter.mBlockDirInfo[relColIndex - 1].mCol;
}
@@ -6466,7 +6470,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
owner = mFirstRow;
break;
case eAjaCellOwner:
- side = eLogicalSideIEnd;
+ side = LogicalSide::IEnd;
cell = mAjaCell;
[[fallthrough]];
case eCellOwner:
@@ -6487,7 +6491,7 @@ Maybe<BCBorderParameters> BCBlockDirSeg::BuildBorderParameters(
(mIsBEndBevel) ? presContext->DevPixelsToAppUnits(mBEndInlineSegBSize)
: 0;
LogicalSide bEndBevelSide =
- (aInlineSegBSize > 0) ? eLogicalSideIEnd : eLogicalSideIStart;
+ (aInlineSegBSize > 0) ? LogicalSide::IEnd : LogicalSide::IStart;
// Convert logical to physical sides/coordinates for DrawTableBorderSegment.
@@ -6733,11 +6737,11 @@ void BCBlockDirSeg::IncludeCurrentBorder(BCPaintBorderIterator& aIter) {
BCInlineDirSeg::BCInlineDirSeg()
: mIsIEndBevel(false),
mIEndBevelOffset(0),
- mIEndBevelSide(eLogicalSideBStart),
+ mIEndBevelSide(LogicalSide::BStart),
mEndOffset(0),
mOwner(eTableOwner) {
mOffsetI = mOffsetB = mLength = mWidth = mIStartBevelOffset = 0;
- mIStartBevelSide = eLogicalSideBStart;
+ mIStartBevelSide = LogicalSide::BStart;
mFirstCell = mAjaCell = nullptr;
}
@@ -6751,7 +6755,7 @@ void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
BCBorderOwner aBorderOwner,
BCPixelSize aBEndBlockSegISize,
BCPixelSize aInlineSegBSize) {
- LogicalSide cornerOwnerSide = eLogicalSideBStart;
+ LogicalSide cornerOwnerSide = LogicalSide::BStart;
bool bevel = false;
mOwner = aBorderOwner;
@@ -6769,7 +6773,7 @@ void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
(iStartBevel && (aInlineSegBSize > 0)) ? maxBlockSegISize : 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mIStartBevelSide =
- (aBEndBlockSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
+ (aBEndBlockSegISize > 0) ? LogicalSide::BEnd : LogicalSide::BStart;
mOffsetI += offset;
mLength = -offset;
mWidth = aInlineSegBSize;
@@ -6787,7 +6791,7 @@ void BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
*/
void BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
BCPixelSize aIStartSegISize) {
- LogicalSide ownerSide = eLogicalSideBStart;
+ LogicalSide ownerSide = LogicalSide::BStart;
nscoord cornerSubWidth = 0;
bool bevel = false;
if (aIter.mBCData) {
@@ -6805,7 +6809,7 @@ void BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
mIEndBevelOffset =
(mIsIEndBevel) ? presContext->DevPixelsToAppUnits(verWidth) : 0;
mIEndBevelSide =
- (aIStartSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
+ (aIStartSegISize > 0) ? LogicalSide::BEnd : LogicalSide::BStart;
}
Maybe<BCBorderParameters> BCInlineDirSeg::BuildBorderParameters(
@@ -6814,7 +6818,7 @@ Maybe<BCBorderParameters> BCInlineDirSeg::BuildBorderParameters(
// get the border style, color and paint the segment
LogicalSide side =
- aIter.IsDamageAreaBEndMost() ? eLogicalSideBEnd : eLogicalSideBStart;
+ aIter.IsDamageAreaBEndMost() ? LogicalSide::BEnd : LogicalSide::BStart;
nsIFrame* rg = aIter.mRg;
if (!rg) ABORT1(Nothing());
nsIFrame* row = aIter.mRow;
@@ -6855,21 +6859,21 @@ Maybe<BCBorderParameters> BCInlineDirSeg::BuildBorderParameters(
owner = aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex - 1);
break;
case eAjaRowGroupOwner:
- side = eLogicalSideBEnd;
+ side = LogicalSide::BEnd;
rg = (aIter.IsTableBEndMost()) ? aIter.mRg : aIter.mPrevRg;
[[fallthrough]];
case eRowGroupOwner:
owner = rg;
break;
case eAjaRowOwner:
- side = eLogicalSideBEnd;
+ side = LogicalSide::BEnd;
row = (aIter.IsTableBEndMost()) ? aIter.mRow : aIter.mPrevRow;
[[fallthrough]];
case eRowOwner:
owner = row;
break;
case eAjaCellOwner:
- side = eLogicalSideBEnd;
+ side = LogicalSide::BEnd;
// if this is null due to the damage area origin-y > 0, then the border
// won't show up anyway
cell = mAjaCell;
@@ -6974,14 +6978,14 @@ void BCPaintBorderIterator::StoreColumnWidth(int32_t aIndex) {
* Determine if a block-dir segment owns the corner
*/
bool BCPaintBorderIterator::BlockDirSegmentOwnsCorner() {
- LogicalSide cornerOwnerSide = eLogicalSideBStart;
+ LogicalSide cornerOwnerSide = LogicalSide::BStart;
bool bevel = false;
if (mBCData) {
mBCData->GetCorner(cornerOwnerSide, bevel);
}
// unitialized ownerside, bevel
- return (eLogicalSideBStart == cornerOwnerSide) ||
- (eLogicalSideBEnd == cornerOwnerSide);
+ return (LogicalSide::BStart == cornerOwnerSide) ||
+ (LogicalSide::BEnd == cornerOwnerSide);
}
/**
diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp
index 1190561ee8..a6f4647429 100644
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -305,7 +305,7 @@ static nscoord GetBSizeOfRowsSpannedBelowFirst(
/**
* Post-reflow hook. This is where the table row does its post-processing
*/
-void nsTableRowFrame::DidResize() {
+void nsTableRowFrame::DidResize(ForceAlignTopForTableCell aForceAlignTop) {
// Resize and re-align the cell frames based on our row bsize
nsTableFrame* tableFrame = GetTableFrame();
@@ -369,7 +369,7 @@ void nsTableRowFrame::DidResize() {
// realign cell content based on the new bsize. We might be able to
// skip this if the bsize didn't change... maybe. Hard to tell.
- cellFrame->BlockDirAlignChild(wm, mMaxCellAscent);
+ cellFrame->BlockDirAlignChild(wm, mMaxCellAscent, aForceAlignTop);
// Always store the overflow, even if the height didn't change, since
// we'll lose part of our overflow area otherwise.
@@ -581,11 +581,8 @@ nscoord nsTableRowFrame::CalcCellActualBSize(nsTableCellFrame* aCellFrame,
const auto& bsizeStyleCoord = position->BSize(aWM);
if (bsizeStyleCoord.ConvertsToLength()) {
- // In quirks mode, table cell isize should be content-box, but bsize
- // should be border-box.
- // Because of this historic anomaly, we do not use quirk.css
- // (since we can't specify one value of box-sizing for isize and another
- // for bsize)
+ // In quirks mode, table cell bsize should always be border-box.
+ // https://quirks.spec.whatwg.org/#the-table-cell-height-box-sizing-quirk
specifiedBSize = bsizeStyleCoord.ToLength();
if (PresContext()->CompatibilityMode() != eCompatibility_NavQuirks &&
position->mBoxSizing == StyleBoxSizing::Content) {
@@ -956,7 +953,6 @@ void nsTableRowFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
WritingMode wm = aReflowInput.GetWritingMode();
@@ -999,17 +995,14 @@ void nsTableRowFrame::Reflow(nsPresContext* aPresContext,
PushDirtyBitToAbsoluteFrames();
}
-/**
- * This function is called by the row group frame's SplitRowGroup() code when
- * pushing a row frame that has cell frames that span into it. The cell frame
- * should be reflowed with the specified height
- */
nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
bool aIsTopOfPage,
nsTableCellFrame* aCellFrame,
nscoord aAvailableBSize,
nsReflowStatus& aStatus) {
+ MOZ_ASSERT(aPresContext->IsPaginated(),
+ "ReflowCellFrame currently supports only paged media!");
MOZ_ASSERT(aAvailableBSize != NS_UNCONSTRAINEDSIZE,
"Why split cell frame if available bsize is unconstrained?");
WritingMode wm = aReflowInput.GetWritingMode();
@@ -1049,7 +1042,8 @@ nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
// XXX What happens if this cell has 'vertical-align: baseline' ?
// XXX Why is it assumed that the cell's ascent hasn't changed ?
if (isCompleteAndNotTruncated) {
- aCellFrame->BlockDirAlignChild(wm, mMaxCellAscent);
+ aCellFrame->BlockDirAlignChild(wm, mMaxCellAscent,
+ ForceAlignTopForTableCell::Yes);
}
nsTableFrame::InvalidateTableFrame(
diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h
index 1d68a534c3..e24be1ea23 100644
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -15,6 +15,11 @@ class nsTableCellFrame;
namespace mozilla {
class PresShell;
struct TableCellReflowInput;
+
+// Yes if table-cells should use 'vertical-align:top' in
+// nsTableCellFrame::BlockDirAlignChild(). This is a hack to workaround our
+// current table row group fragmentation to avoid data loss.
+enum class ForceAlignTopForTableCell : uint8_t { No, Yes };
} // namespace mozilla
/**
@@ -104,7 +109,8 @@ class nsTableRowFrame : public nsContainerFrame {
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- void DidResize();
+ void DidResize(mozilla::ForceAlignTopForTableCell aForceAlignTop =
+ mozilla::ForceAlignTopForTableCell::No);
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override;
@@ -145,7 +151,11 @@ class nsTableRowFrame : public nsContainerFrame {
// See nsTableFrame.h
void AddDeletedRowIndex();
- /** used by row group frame code */
+ /**
+ * This function is called by the row group frame's SplitRowGroup() code when
+ * pushing a row frame that has cell frames that span into it. The cell frame
+ * should be reflowed with the specified available block-size.
+ */
nscoord ReflowCellFrame(nsPresContext* aPresContext,
const ReflowInput& aReflowInput, bool aIsTopOfPage,
nsTableCellFrame* aCellFrame, nscoord aAvailableBSize,
diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp
index f8dac61386..9ae8a59a90 100644
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1122,7 +1122,7 @@ void nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
FinishReflowChild(rowFrame, aPresContext, rowMetrics, &rowReflowInput,
wm, dummyPos, dummyContainerSize,
ReflowChildFlags::NoMoveFrame);
- rowFrame->DidResize();
+ rowFrame->DidResize(ForceAlignTopForTableCell::Yes);
if (!aRowForcedPageBreak && !aStatus.IsFullyComplete() &&
ShouldAvoidBreakInside(aReflowInput)) {
@@ -1324,7 +1324,6 @@ void nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableRowGroupFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
// Row geometry may be going to change so we need to invalidate any row
diff --git a/layout/tables/nsTableWrapperFrame.cpp b/layout/tables/nsTableWrapperFrame.cpp
index a3e957c4fd..aa898ddf6f 100644
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -242,7 +242,6 @@ ComputedStyle* nsTableWrapperFrame::GetParentComputedStyle(
nscoord nsTableWrapperFrame::GetMinISize(gfxContext* aRenderingContext) {
nscoord iSize = nsLayoutUtils::IntrinsicForContainer(
aRenderingContext, InnerTableFrame(), IntrinsicISizeType::MinISize);
- DISPLAY_MIN_INLINE_SIZE(this, iSize);
if (mCaptionFrames.NotEmpty()) {
nscoord capISize = nsLayoutUtils::IntrinsicForContainer(
aRenderingContext, mCaptionFrames.FirstChild(),
@@ -256,10 +255,7 @@ nscoord nsTableWrapperFrame::GetMinISize(gfxContext* aRenderingContext) {
/* virtual */
nscoord nsTableWrapperFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord maxISize;
- DISPLAY_PREF_INLINE_SIZE(this, maxISize);
-
- maxISize = nsLayoutUtils::IntrinsicForContainer(
+ nscoord maxISize = nsLayoutUtils::IntrinsicForContainer(
aRenderingContext, InnerTableFrame(), IntrinsicISizeType::PrefISize);
if (mCaptionFrames.NotEmpty()) {
// Don't let the caption's pref isize expand the table's pref isize.
@@ -547,7 +543,7 @@ ComputeSizeFlags nsTableWrapperFrame::CreateComputeSizeFlagsForChild() const {
// Shrink-wrap child frames by default, except if we're a stretched grid item.
if (MOZ_UNLIKELY(IsGridItem())) {
auto* gridContainer = static_cast<nsGridContainerFrame*>(GetParent());
- if (gridContainer->GridItemShouldStretch(this, eLogicalAxisInline)) {
+ if (gridContainer->GridItemShouldStretch(this, LogicalAxis::Inline)) {
return {};
}
}
@@ -691,7 +687,6 @@ void nsTableWrapperFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableWrapperFrame");
- DISPLAY_REFLOW(aPresContext, this, aOuterRI, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
// Initialize out parameters