Bug 1209765 (Part 9) - Support sync decoding and track draw results when drawing borders in nsTableFrame. r=tn

This commit is contained in:
Seth Fowler 2015-10-22 19:54:49 -07:00
parent bbd8f63e67
commit 1b8e0f237f
2 changed files with 19 additions and 10 deletions

View File

@ -1164,9 +1164,8 @@ nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) nsRenderingContext* aCtx)
{ {
DrawResult result = static_cast<nsTableFrame*>(mFrame)-> DrawResult result = static_cast<nsTableFrame*>(mFrame)->
PaintTableBorderBackground(*aCtx, mVisibleRect, PaintTableBorderBackground(aBuilder, *aCtx, mVisibleRect,
ToReferenceFrame(), ToReferenceFrame());
aBuilder->GetBackgroundPaintFlags());
nsDisplayTableItemGeometry::UpdateDrawResult(this, result); nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
} }
@ -1358,15 +1357,21 @@ nsTableFrame::GetDeflationForBackground(nsPresContext* aPresContext) const
// XXX We don't put the borders and backgrounds in tree order like we should. // 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. // That requires some major surgery which we aren't going to do right now.
DrawResult DrawResult
nsTableFrame::PaintTableBorderBackground(nsRenderingContext& aRenderingContext, nsTableFrame::PaintTableBorderBackground(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, uint32_t aBGPaintFlags) nsPoint aPt)
{ {
nsPresContext* presContext = PresContext(); nsPresContext* presContext = PresContext();
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
TableBackgroundPainter painter(this, TableBackgroundPainter::eOrigin_Table, TableBackgroundPainter painter(this, TableBackgroundPainter::eOrigin_Table,
presContext, aRenderingContext, presContext, aRenderingContext,
aDirtyRect, aPt, aBGPaintFlags); aDirtyRect, aPt, bgFlags);
nsMargin deflate = GetDeflationForBackground(presContext); nsMargin deflate = GetDeflationForBackground(presContext);
// If 'deflate' is (0,0,0,0) then we'll paint the table background // 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. // in a separate display item, so don't do it here.
@ -1377,8 +1382,11 @@ nsTableFrame::PaintTableBorderBackground(nsRenderingContext& aRenderingContext,
if (!IsBorderCollapse()) { if (!IsBorderCollapse()) {
Sides skipSides = GetSkipSides(); Sides skipSides = GetSkipSides();
nsRect rect(aPt, mRect.Size()); nsRect rect(aPt, mRect.Size());
result &=
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext, skipSides); aDirtyRect, rect, mStyleContext,
borderFlags, skipSides);
} }
else { else {
gfxContext* ctx = aRenderingContext.ThebesContext(); gfxContext* ctx = aRenderingContext.ThebesContext();

View File

@ -272,9 +272,10 @@ public:
* columns, row groups, rows, and cells), and the table border, and all * columns, row groups, rows, and cells), and the table border, and all
* internal borders if border-collapse is on. * internal borders if border-collapse is on.
*/ */
DrawResult PaintTableBorderBackground(nsRenderingContext& aRenderingContext, DrawResult PaintTableBorderBackground(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, uint32_t aBGPaintFlags); nsPoint aPt);
/** Get the outer half (i.e., the part outside the height and width of /** Get the outer half (i.e., the part outside the height and width of
* the table) of the largest segment (?) of border-collapsed border on * the table) of the largest segment (?) of border-collapsed border on