summaryrefslogtreecommitdiffstats
path: root/layout/tables/nsTableRowFrame.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-04 08:41:04 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-04 08:41:48 +0100
commitbbc2206a0fda053a6f5071b457bd209dab9ed268 (patch)
tree8dae72f2c725e512dfcfca5ba4f4062dd98d1cdd /layout/tables/nsTableRowFrame.cpp
parent22b410f31b0fc61a0a99522fe2aea1a31823bd99 (diff)
parentee8c5d3878456b4e194dc3724616d194907ed466 (diff)
downloadUXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.gz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.lz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.xz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.zip
Merge branch 'table-sticky-work'
This resolves #146.
Diffstat (limited to 'layout/tables/nsTableRowFrame.cpp')
-rw-r--r--layout/tables/nsTableRowFrame.cpp66
1 files changed, 6 insertions, 60 deletions
diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp
index 1b6051ef2..ea2477b73 100644
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -561,65 +561,12 @@ nsTableRowFrame::CalcBSize(const ReflowInput& aReflowInput)
return GetInitialBSize();
}
-/**
- * We need a custom display item for table row backgrounds. This is only used
- * when the table row is the root of a stacking context (e.g., has 'opacity').
- * Table row backgrounds can extend beyond the row frame bounds, when
- * the row contains row-spanning cells.
- */
-class nsDisplayTableRowBackground : public nsDisplayTableItem {
-public:
- nsDisplayTableRowBackground(nsDisplayListBuilder* aBuilder,
- nsTableRowFrame* aFrame) :
- nsDisplayTableItem(aBuilder, aFrame) {
- MOZ_COUNT_CTOR(nsDisplayTableRowBackground);
- }
-#ifdef NS_BUILD_REFCNT_LOGGING
- virtual ~nsDisplayTableRowBackground() {
- MOZ_COUNT_DTOR(nsDisplayTableRowBackground);
- }
-#endif
-
- virtual void Paint(nsDisplayListBuilder* aBuilder,
- nsRenderingContext* aCtx) override;
- NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
-};
-
-void
-nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
- nsRenderingContext* aCtx)
-{
- auto rowFrame = static_cast<nsTableRowFrame*>(mFrame);
- TableBackgroundPainter painter(rowFrame->GetTableFrame(),
- TableBackgroundPainter::eOrigin_TableRow,
- mFrame->PresContext(), *aCtx,
- mVisibleRect, ToReferenceFrame(),
- aBuilder->GetBackgroundPaintFlags());
-
- DrawResult result = painter.PaintRow(rowFrame);
- nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
-}
-
void
nsTableRowFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
- nsDisplayTableItem* item = nullptr;
- if (IsVisibleInSelection(aBuilder)) {
- bool isRoot = aBuilder->IsAtRootOfPseudoStackingContext();
- if (isRoot) {
- // This background is created regardless of whether this frame is
- // visible or not. Visibility decisions are delegated to the
- // table background painter.
- // We would use nsDisplayGeneric for this rare case except that we
- // need the background to be larger than the row frame in some
- // cases.
- item = new (aBuilder) nsDisplayTableRowBackground(aBuilder, this);
- aLists.BorderBackground()->AppendNewToTop(item);
- }
- }
- nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item);
+ nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists);
}
nsIFrame::LogicalSides
@@ -979,12 +926,11 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// be merged into the else below if we can.)
nsMargin* computedOffsetProp =
kidFrame->GetProperty(nsIFrame::ComputedOffsetProperty());
- // Bug 975644: a position:sticky kid can end up with a null
- // property value here.
- LogicalMargin computedOffsets(wm, computedOffsetProp ?
- *computedOffsetProp : nsMargin());
- ReflowInput::ApplyRelativePositioning(kidFrame, wm, computedOffsets,
- &kidPosition, containerSize);
+
+ // On our fist reflow sticky children may not have the property yet (we
+ // need to reflow the children first to size the scroll frame).
+ LogicalMargin computedOffsets(wm, computedOffsetProp ? *computedOffsetProp : nsMargin());
+ ReflowInput::ApplyRelativePositioning(kidFrame, wm, computedOffsets, &kidPosition, containerSize);
}
// In vertical-rl mode, we are likely to have containerSize.width = 0