Bug 435296 - Sync decode handling for decode-on-draw. r=roc
This commit is contained in:
Родитель
726ce5a3a1
Коммит
6d6aa0b142
|
@ -5394,7 +5394,7 @@ nsSVGFEImageElement::Filter(nsSVGFilterInstance *instance,
|
|||
nsRefPtr<gfxASurface> currentFrame;
|
||||
if (imageContainer)
|
||||
imageContainer->GetFrame(imgIContainer::FRAME_CURRENT,
|
||||
imgIContainer::FLAG_NONE,
|
||||
imgIContainer::FLAG_SYNC_DECODE,
|
||||
getter_AddRefs(currentFrame));
|
||||
|
||||
// We need to wrap the surface in a pattern to have somewhere to set the
|
||||
|
|
|
@ -91,7 +91,10 @@
|
|||
*/
|
||||
class ImageRenderer {
|
||||
public:
|
||||
ImageRenderer(nsIFrame* aForFrame, const nsStyleImage& aImage);
|
||||
enum {
|
||||
FLAG_SYNC_DECODE_IMAGES = 0x01
|
||||
};
|
||||
ImageRenderer(nsIFrame* aForFrame, const nsStyleImage& aImage, PRUint32 aFlags);
|
||||
~ImageRenderer();
|
||||
/**
|
||||
* Populates member variables to get ready for rendering.
|
||||
|
@ -125,6 +128,7 @@ private:
|
|||
nsRefPtr<nsStyleGradient> mGradientData;
|
||||
PRBool mIsReady;
|
||||
nsSize mSize;
|
||||
PRUint32 mFlags;
|
||||
};
|
||||
|
||||
// To avoid storing this data on nsInlineFrame (bloat) and to avoid
|
||||
|
@ -350,6 +354,7 @@ protected:
|
|||
static void PaintBackgroundLayer(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
PRUint32 aFlags,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
|
@ -1749,7 +1754,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||
// background-clip.
|
||||
currentBackgroundClip = aBackground.BottomLayer().mClip;
|
||||
isSolidBorder =
|
||||
(aFlags & PAINT_WILL_PAINT_BORDER) && IsSolidBorder(aBorder);
|
||||
(aFlags & PAINTBG_WILL_PAINT_BORDER) && IsSolidBorder(aBorder);
|
||||
if (isSolidBorder)
|
||||
currentBackgroundClip = NS_STYLE_BG_CLIP_PADDING;
|
||||
SetupBackgroundClip(ctx, currentBackgroundClip, aForFrame,
|
||||
|
@ -1810,7 +1815,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
if (!dirtyRectGfx.IsEmpty()) {
|
||||
PaintBackgroundLayer(aPresContext, aRenderingContext, aForFrame,
|
||||
PaintBackgroundLayer(aPresContext, aRenderingContext, aForFrame, aFlags,
|
||||
dirtyRect, aBorderArea, bgClipArea, aBackground,
|
||||
layer);
|
||||
}
|
||||
|
@ -1841,6 +1846,7 @@ static void
|
|||
PaintBackgroundLayer(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
PRUint32 aFlags,
|
||||
const nsRect& aDirtyRect, // intersected with aBGClipRect
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
|
@ -1902,7 +1908,10 @@ PaintBackgroundLayer(nsPresContext* aPresContext,
|
|||
* background-repeat
|
||||
*/
|
||||
|
||||
ImageRenderer imageRenderer(aForFrame, aLayer.mImage);
|
||||
PRUint32 irFlags = 0;
|
||||
if (aFlags & nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES)
|
||||
irFlags |= ImageRenderer::FLAG_SYNC_DECODE_IMAGES;
|
||||
ImageRenderer imageRenderer(aForFrame, aLayer.mImage, irFlags);
|
||||
if (!imageRenderer.PrepareImage()) {
|
||||
// There's no image or it's not ready to be painted.
|
||||
return;
|
||||
|
@ -3070,7 +3079,8 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
// ImageRenderer
|
||||
// ------------------
|
||||
ImageRenderer::ImageRenderer(nsIFrame* aForFrame,
|
||||
const nsStyleImage& aImage)
|
||||
const nsStyleImage& aImage,
|
||||
PRUint32 aFlags)
|
||||
: mForFrame(aForFrame)
|
||||
, mImage(aImage)
|
||||
, mType(aImage.GetType())
|
||||
|
@ -3078,6 +3088,7 @@ ImageRenderer::ImageRenderer(nsIFrame* aForFrame,
|
|||
, mGradientData(nsnull)
|
||||
, mIsReady(PR_FALSE)
|
||||
, mSize(0, 0)
|
||||
, mFlags(aFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -3093,6 +3104,13 @@ ImageRenderer::PrepareImage()
|
|||
mImage.RequestDecode();
|
||||
|
||||
// We can not prepare the image for rendering if it is not fully loaded.
|
||||
//
|
||||
// Special case: If we requested a sync decode and we have an image, push
|
||||
// on through
|
||||
nsCOMPtr<imgIContainer> img;
|
||||
if (!((mFlags & FLAG_SYNC_DECODE_IMAGES) &&
|
||||
(mType == eStyleImageType_Image) &&
|
||||
(NS_SUCCEEDED(mImage.GetImageData()->GetImage(getter_AddRefs(img))) && img)))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -3121,9 +3139,11 @@ ImageRenderer::PrepareImage()
|
|||
mImageContainer.swap(srcImage);
|
||||
} else {
|
||||
nsCOMPtr<imgIContainer> subImage;
|
||||
PRUint32 aExtractFlags = (mFlags & FLAG_SYNC_DECODE_IMAGES)
|
||||
? (PRUint32) imgIContainer::FLAG_SYNC_DECODE
|
||||
: (PRUint32) imgIContainer::FLAG_NONE;
|
||||
nsresult rv = srcImage->ExtractFrame(imgIContainer::FRAME_CURRENT,
|
||||
actualCropRect,
|
||||
imgIContainer::FLAG_NONE,
|
||||
actualCropRect, aExtractFlags,
|
||||
getter_AddRefs(subImage));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("The cropped image contains no pixels to draw; "
|
||||
|
@ -3196,10 +3216,15 @@ ImageRenderer::Draw(nsPresContext* aPresContext,
|
|||
|
||||
switch (mType) {
|
||||
case eStyleImageType_Image:
|
||||
{
|
||||
PRUint32 drawFlags = (mFlags & FLAG_SYNC_DECODE_IMAGES)
|
||||
? (PRUint32) imgIContainer::FLAG_SYNC_DECODE
|
||||
: (PRUint32) imgIContainer::FLAG_NONE;
|
||||
nsLayoutUtils::DrawImage(&aRenderingContext, mImageContainer,
|
||||
nsLayoutUtils::GetGraphicsFilterForFrame(mForFrame),
|
||||
aDest, aFill, aAnchor, aDirty, imgIContainer::FLAG_NONE);
|
||||
aDest, aFill, aAnchor, aDirty, drawFlags);
|
||||
break;
|
||||
}
|
||||
case eStyleImageType_Gradient:
|
||||
nsCSSRendering::PaintGradient(aPresContext, aRenderingContext,
|
||||
mGradientData, aDirty, aDest, aFill, aRepeat);
|
||||
|
|
|
@ -198,7 +198,10 @@ struct nsCSSRendering {
|
|||
* When this flag is passed, the element's nsDisplayBorder will be
|
||||
* painted immediately on top of this background.
|
||||
*/
|
||||
PAINT_WILL_PAINT_BORDER = 0x01
|
||||
PAINTBG_WILL_PAINT_BORDER = 0x01,
|
||||
/**
|
||||
* When this flag is passed, images are synchronously decoded. */
|
||||
PAINTBG_SYNC_DECODE_IMAGES = 0x02
|
||||
};
|
||||
static void PaintBackground(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
|
|
@ -157,6 +157,15 @@ nsDisplayListBuilder::~nsDisplayListBuilder() {
|
|||
PL_FinishArenaPool(&mPool);
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsDisplayListBuilder::GetBackgroundPaintFlags() {
|
||||
PRUint32 flags = 0;
|
||||
if (mSyncDecodeImages) {
|
||||
flags |= nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayListBuilder::SubtractFromVisibleRegion(nsRegion* aVisibleRegion,
|
||||
const nsRegion& aRegion)
|
||||
|
@ -661,11 +670,11 @@ void
|
|||
nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsIRenderingContext* aCtx, const nsRect& aDirtyRect) {
|
||||
nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
|
||||
PRUint32 flags = 0;
|
||||
PRUint32 flags = aBuilder->GetBackgroundPaintFlags();
|
||||
nsDisplayItem* nextItem = GetAbove();
|
||||
if (nextItem && nextItem->GetUnderlyingFrame() == mFrame &&
|
||||
nextItem->GetType() == TYPE_BORDER) {
|
||||
flags |= nsCSSRendering::PAINT_WILL_PAINT_BORDER;
|
||||
flags |= nsCSSRendering::PAINTBG_WILL_PAINT_BORDER;
|
||||
}
|
||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aDirtyRect, nsRect(offset, mFrame->GetSize()),
|
||||
|
|
|
@ -304,6 +304,13 @@ public:
|
|||
mSyncDecodeImages = aSyncDecodeImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to generate background painting flags based on the
|
||||
* information available in the display list builder. Currently only
|
||||
* accounts for mSyncDecodeImages.
|
||||
*/
|
||||
PRUint32 GetBackgroundPaintFlags();
|
||||
|
||||
/**
|
||||
* Subtracts aRegion from *aVisibleRegion. We avoid letting
|
||||
* aVisibleRegion become overcomplex by simplifying it if necessary ---
|
||||
|
|
|
@ -192,6 +192,7 @@ NS_IMETHODIMP nsImageLoader::OnStopRequest(imgIRequest *aRequest,
|
|||
if (mActions & ACTION_REDRAW_ON_LOAD) {
|
||||
DoRedraw(nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
|
||||
|
|
|
@ -180,7 +180,8 @@ void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsRect r = nsRect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize());
|
||||
|
||||
// draw the border and background inside the focus and outline borders
|
||||
mBFR->PaintBorderAndBackground(pc, *aCtx, aDirtyRect, r);
|
||||
mBFR->PaintBorderAndBackground(pc, *aCtx, aDirtyRect, r,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -257,7 +258,8 @@ void
|
|||
nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect)
|
||||
const nsRect& aRect,
|
||||
PRUint32 aBGFlags)
|
||||
|
||||
{
|
||||
// get the button rect this is inside the focus and outline rects
|
||||
|
@ -269,7 +271,7 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
|
|||
const nsStyleBorder* border = context->GetStyleBorder();
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, 0);
|
||||
aDirtyRect, buttonRect, aBGFlags);
|
||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
|
||||
mFrame, buttonRect, aDirtyRect);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
|
|
|
@ -75,7 +75,8 @@ public:
|
|||
void PaintBorderAndBackground(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect);
|
||||
const nsRect& aRect,
|
||||
PRUint32 aBGFlags);
|
||||
|
||||
void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
const nsDisplayListSet& aLists);
|
||||
|
||||
void PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
nsPoint aPt, const nsRect& aDirtyRect);
|
||||
nsPoint aPt, const nsRect& aDirtyRect, PRUint32 aBGFlags);
|
||||
|
||||
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
||||
nsFrameList& aFrameList);
|
||||
|
@ -207,7 +207,8 @@ nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
|
||||
{
|
||||
static_cast<nsFieldSetFrame*>(mFrame)->
|
||||
PaintBorderBackground(*aCtx, aBuilder->ToReferenceFrame(mFrame), aDirtyRect);
|
||||
PaintBorderBackground(*aCtx, aBuilder->ToReferenceFrame(mFrame),
|
||||
aDirtyRect, aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -266,7 +267,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
void
|
||||
nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
nsPoint aPt, const nsRect& aDirtyRect)
|
||||
nsPoint aPt, const nsRect& aDirtyRect, PRUint32 aBGFlags)
|
||||
{
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* borderStyle = GetStyleBorder();
|
||||
|
@ -283,7 +284,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
|
||||
|
||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, 0);
|
||||
aDirtyRect, rect, aBGFlags);
|
||||
|
||||
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
||||
this, rect, aDirtyRect);
|
||||
|
|
|
@ -436,7 +436,8 @@ public:
|
|||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aDirtyRect,
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
0, &bgClipRect);
|
||||
aBuilder->GetBackgroundPaintFlags(),
|
||||
&bgClipRect);
|
||||
}
|
||||
|
||||
NS_DISPLAY_DECL_NAME("CanvasBackground")
|
||||
|
|
|
@ -578,7 +578,8 @@ nsPageFrame::PaintPageContent(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
nsRect backgroundRect = nsRect(nsPoint(0, 0), pageContentFrame->GetSize());
|
||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||
rect, backgroundRect, 0);
|
||||
rect, backgroundRect,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
|
||||
nsLayoutUtils::PaintFrame(&aRenderingContext, pageContentFrame,
|
||||
nsRegion(rect), NS_RGBA(0,0,0,0),
|
||||
|
|
|
@ -1934,7 +1934,7 @@ void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsRect rect(mRect + aBuilder->ToReferenceFrame(mFrame));
|
||||
nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aDirtyRect, rect, *backg, *border,
|
||||
0);
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
class nsDisplayMathMLCharForeground : public nsDisplayItem {
|
||||
|
|
|
@ -363,22 +363,24 @@ nsTableCellFrame::DecorateForSelection(nsIRenderingContext& aRenderingContext,
|
|||
void
|
||||
nsTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt)
|
||||
nsPoint aPt,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsRect rect(aPt, GetSize());
|
||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect, 0);
|
||||
aDirtyRect, rect, aFlags);
|
||||
}
|
||||
|
||||
// Called by nsTablePainter
|
||||
void
|
||||
nsTableCellFrame::PaintCellBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsPoint aPt)
|
||||
const nsRect& aDirtyRect, nsPoint aPt,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (!GetStyleVisibility()->IsVisible())
|
||||
return;
|
||||
|
||||
PaintBackground(aRenderingContext, aDirtyRect, aPt);
|
||||
PaintBackground(aRenderingContext, aDirtyRect, aPt, aFlags);
|
||||
}
|
||||
|
||||
class nsDisplayTableCellBackground : public nsDisplayTableItem {
|
||||
|
@ -405,7 +407,8 @@ void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
|
||||
{
|
||||
static_cast<nsTableCellFrame*>(mFrame)->
|
||||
PaintBackground(*aCtx, aDirtyRect, aBuilder->ToReferenceFrame(mFrame));
|
||||
PaintBackground(*aCtx, aDirtyRect, aBuilder->ToReferenceFrame(mFrame),
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
@ -1153,7 +1156,8 @@ nsBCTableCellFrame::GetSelfOverflow(nsRect& aOverflowArea)
|
|||
void
|
||||
nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt)
|
||||
nsPoint aPt,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// make border-width reflect the half of the border-collapse
|
||||
// assigned border that's inside the cell
|
||||
|
@ -1172,5 +1176,5 @@ nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
|||
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect,
|
||||
*GetStyleBackground(), myBorder,
|
||||
0, nsnull);
|
||||
aFlags, nsnull);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,8 @@ public:
|
|||
const nsDisplayListSet& aLists);
|
||||
|
||||
void PaintCellBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsPoint aPt);
|
||||
const nsRect& aDirtyRect, nsPoint aPt,
|
||||
PRUint32 aFlags);
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
@ -226,7 +227,8 @@ public:
|
|||
|
||||
virtual void PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt);
|
||||
nsPoint aPt,
|
||||
PRUint32 aFlags);
|
||||
|
||||
void DecorateForSelection(nsIRenderingContext& aRenderingContext,
|
||||
nsPoint aPt);
|
||||
|
@ -329,7 +331,8 @@ public:
|
|||
|
||||
virtual void PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt);
|
||||
nsPoint aPt,
|
||||
PRUint32 aFlags);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -1216,7 +1216,8 @@ nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
{
|
||||
static_cast<nsTableFrame*>(mFrame)->
|
||||
PaintTableBorderBackground(*aCtx, aDirtyRect,
|
||||
aBuilder->ToReferenceFrame(mFrame));
|
||||
aBuilder->ToReferenceFrame(mFrame),
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
static PRInt32 GetTablePartRank(nsDisplayItem* aItem)
|
||||
|
@ -1370,13 +1371,13 @@ nsTableFrame::GetDeflationForBackground(nsPresContext* aPresContext) const
|
|||
void
|
||||
nsTableFrame::PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt)
|
||||
nsPoint aPt, PRUint32 aBGPaintFlags)
|
||||
{
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
||||
TableBackgroundPainter painter(this, TableBackgroundPainter::eOrigin_Table,
|
||||
presContext, aRenderingContext,
|
||||
aDirtyRect, aPt);
|
||||
aDirtyRect, aPt, aBGPaintFlags);
|
||||
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.
|
||||
|
|
|
@ -276,7 +276,7 @@ public:
|
|||
*/
|
||||
void PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt);
|
||||
nsPoint aPt, PRUint32 aBGPaintFlags);
|
||||
|
||||
/** 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
|
||||
|
|
|
@ -232,14 +232,16 @@ TableBackgroundPainter::TableBackgroundPainter(nsTableFrame* aTableFrame,
|
|||
nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsPoint& aRenderPt)
|
||||
const nsPoint& aRenderPt,
|
||||
PRUint32 aBGPaintFlags)
|
||||
: mPresContext(aPresContext),
|
||||
mRenderingContext(aRenderingContext),
|
||||
mRenderPt(aRenderPt),
|
||||
mDirtyRect(aDirtyRect),
|
||||
mOrigin(aOrigin),
|
||||
mCols(nsnull),
|
||||
mZeroBorder(aPresContext)
|
||||
mZeroBorder(aPresContext),
|
||||
mBGPaintFlags(aBGPaintFlags)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TableBackgroundPainter);
|
||||
|
||||
|
@ -324,7 +326,7 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
|
|||
tableData.mRect + mRenderPt,
|
||||
*tableData.mBackground,
|
||||
*tableData.mBorder,
|
||||
0);
|
||||
mBGPaintFlags);
|
||||
}
|
||||
tableData.Destroy(mPresContext);
|
||||
return NS_OK;
|
||||
|
@ -634,7 +636,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
mCols[colIndex].mColGroup->mRect + mRenderPt,
|
||||
*mCols[colIndex].mColGroup->mBackground,
|
||||
*mCols[colIndex].mColGroup->mBorder,
|
||||
0, &mCellRect);
|
||||
mBGPaintFlags, &mCellRect);
|
||||
}
|
||||
|
||||
//Paint column background
|
||||
|
@ -644,7 +646,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
mCols[colIndex].mCol.mRect + mRenderPt,
|
||||
*mCols[colIndex].mCol.mBackground,
|
||||
*mCols[colIndex].mCol.mBorder,
|
||||
0, &mCellRect);
|
||||
mBGPaintFlags, &mCellRect);
|
||||
}
|
||||
|
||||
//Paint row group background
|
||||
|
@ -653,7 +655,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
mRowGroup.mFrame, mDirtyRect,
|
||||
mRowGroup.mRect + mRenderPt,
|
||||
*mRowGroup.mBackground, *mRowGroup.mBorder,
|
||||
0, &mCellRect);
|
||||
mBGPaintFlags, &mCellRect);
|
||||
}
|
||||
|
||||
//Paint row background
|
||||
|
@ -662,13 +664,13 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
mRow.mFrame, mDirtyRect,
|
||||
mRow.mRect + mRenderPt,
|
||||
*mRow.mBackground, *mRow.mBorder,
|
||||
0, &mCellRect);
|
||||
mBGPaintFlags, &mCellRect);
|
||||
}
|
||||
|
||||
//Paint cell background in border-collapse unless we're just passing
|
||||
if (mIsBorderCollapse && !aPassSelf) {
|
||||
aCell->PaintCellBackground(mRenderingContext, mDirtyRect,
|
||||
mCellRect.TopLeft());
|
||||
mCellRect.TopLeft(), mBGPaintFlags);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -72,13 +72,15 @@ class TableBackgroundPainter
|
|||
* relative to aRenderingContext
|
||||
* @param aPt - offset of the table frame relative to
|
||||
* aRenderingContext
|
||||
* @param aBGPaintFlags - Flags of the nsCSSRendering::PAINTBG_* variety
|
||||
*/
|
||||
TableBackgroundPainter(nsTableFrame* aTableFrame,
|
||||
Origin aOrigin,
|
||||
nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsPoint& aPt);
|
||||
const nsPoint& aPt,
|
||||
PRUint32 aBGPaintFlags);
|
||||
|
||||
/** Destructor */
|
||||
~TableBackgroundPainter();
|
||||
|
@ -247,6 +249,7 @@ class TableBackgroundPainter
|
|||
nsRect mCellRect; //current cell's rect
|
||||
|
||||
nsStyleBorder mZeroBorder; //cached zero-width border
|
||||
PRUint32 mBGPaintFlags;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -597,7 +597,8 @@ nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
TableBackgroundPainter painter(tableFrame,
|
||||
TableBackgroundPainter::eOrigin_TableRow,
|
||||
mFrame->PresContext(), *aCtx,
|
||||
aDirtyRect, pt);
|
||||
aDirtyRect, pt,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
painter.PaintRow(static_cast<nsTableRowFrame*>(mFrame));
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,8 @@ nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
TableBackgroundPainter painter(tableFrame,
|
||||
TableBackgroundPainter::eOrigin_TableRowGroup,
|
||||
mFrame->PresContext(), *aCtx,
|
||||
aDirtyRect, pt);
|
||||
aDirtyRect, pt,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
painter.PaintRowGroup(static_cast<nsTableRowGroupFrame*>(mFrame));
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,8 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||
groupRect += aPt;
|
||||
|
||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, 0);
|
||||
aDirtyRect, rect,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
|
||||
if (groupBox) {
|
||||
|
||||
|
|
|
@ -3916,7 +3916,8 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
|
|||
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, aRect,
|
||||
*myColor, *myBorder, 0);
|
||||
*myColor, *myBorder,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, mStyleContext);
|
||||
|
|
Загрузка…
Ссылка в новой задаче