Issue #146 - Part 2: Remove custom table painting component.

Since we're now putting table borders and backgrounds properly in the
display lists, we no longer need this custom component to do this work
for us.
This commit is contained in:
wolfbeast 2019-11-02 23:07:40 +01:00 committed by Roy Tam
commit 04db41da36
12 changed files with 0 additions and 1162 deletions

View file

@ -23,7 +23,6 @@
#include "nsTableRowFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsTableWrapperFrame.h"
#include "nsTablePainter.h"
#include "BasicTableLayoutStrategy.h"
#include "FixedTableLayoutStrategy.h"
@ -1167,36 +1166,6 @@ nsDisplayTableBorderCollapse::Paint(nsDisplayListBuilder* aBuilder,
static_cast<nsTableFrame*>(mFrame)->PaintBCBorders(*drawTarget, mVisibleRect - pt);
}
class nsDisplayTableBorderBackground : public nsDisplayTableItem {
public:
nsDisplayTableBorderBackground(nsDisplayListBuilder* aBuilder,
nsTableFrame* aFrame,
bool aDrawsBackground) :
nsDisplayTableItem(aBuilder, aFrame, aDrawsBackground) {
MOZ_COUNT_CTOR(nsDisplayTableBorderBackground);
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayTableBorderBackground() {
MOZ_COUNT_DTOR(nsDisplayTableBorderBackground);
}
#endif
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) override;
NS_DISPLAY_DECL_NAME("TableBorderBackground", TYPE_TABLE_BORDER_BACKGROUND)
};
void
nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
DrawResult result = static_cast<nsTableFrame*>(mFrame)->
PaintTableBorderBackground(aBuilder, *aCtx, mVisibleRect,
ToReferenceFrame());
nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
}
/* static */ void
nsTableFrame::GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
const nsRect& aDirtyRect, const nsDisplayListSet& aLists)
@ -1383,59 +1352,6 @@ nsTableFrame::GetDeflationForBackground(nsPresContext* aPresContext) const
return GetOuterBCBorder(wm).GetPhysicalMargin(wm);
}
// XXX We don't put the borders and backgrounds in tree order like we should.
// That requires some major surgery which we aren't going to do right now.
DrawResult
nsTableFrame::PaintTableBorderBackground(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt)
{
nsPresContext* presContext = PresContext();
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
TableBackgroundPainter painter(this, TableBackgroundPainter::eOrigin_Table,
presContext, aRenderingContext,
aDirtyRect, aPt, bgFlags);
nsMargin deflate = GetDeflationForBackground(presContext);
// If 'deflate' is (0,0,0,0) then we'll paint the table background
// in a separate display item, so don't do it here.
DrawResult result =
painter.PaintTable(this, deflate, deflate != nsMargin(0, 0, 0, 0));
if (StyleVisibility()->IsVisible()) {
if (!IsBorderCollapse()) {
Sides skipSides = GetSkipSides();
nsRect rect(aPt, mRect.Size());
result &=
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext,
borderFlags, skipSides);
} else {
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(aPt,
PresContext()->AppUnitsPerDevPixel());
// XXX we should probably get rid of this translation at some stage
// But that would mean modifying PaintBCBorders, ugh
AutoRestoreTransform autoRestoreTransform(drawTarget);
drawTarget->SetTransform(
drawTarget->GetTransform().PreTranslate(ToPoint(devPixelOffset)));
PaintBCBorders(*drawTarget, aDirtyRect - aPt);
}
}
return result;
}
nsIFrame::LogicalSides
nsTableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{