mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1228280 - Part 1. Change the parameter of nsCSSRendering::PaintBackground;
MozReview-Commit-ID: 41KgAlkx9oZ
This commit is contained in:
parent
65234fb791
commit
be0a6b927b
@ -1641,46 +1641,79 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsCSSRendering::PaintBGParams
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsIFrame *aFrame,
|
||||
uint32_t aPaintFlags)
|
||||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea);
|
||||
|
||||
result.frame = aFrame;
|
||||
result.paintFlags = aPaintFlags;
|
||||
result.layer = -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsCSSRendering::PaintBGParams
|
||||
nsCSSRendering::PaintBGParams::ForSingleLayer(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsIFrame *aFrame,
|
||||
uint32_t aPaintFlags,
|
||||
int32_t aLayer,
|
||||
CompositionOp aCompositionOp)
|
||||
{
|
||||
MOZ_ASSERT(aFrame && (aLayer != -1));
|
||||
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea);
|
||||
|
||||
result.frame = aFrame;
|
||||
result.paintFlags = aPaintFlags;
|
||||
|
||||
result.layer = aLayer;
|
||||
result.compositionOp = aCompositionOp;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DrawResult
|
||||
nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
uint32_t aFlags,
|
||||
nsRect* aBGClipRect,
|
||||
int32_t aLayer,
|
||||
CompositionOp aCompositonOp)
|
||||
nsCSSRendering::PaintBackground(const PaintBGParams& aParams)
|
||||
{
|
||||
PROFILER_LABEL("nsCSSRendering", "PaintBackground",
|
||||
js::ProfileEntry::Category::GRAPHICS);
|
||||
|
||||
NS_PRECONDITION(aForFrame,
|
||||
NS_PRECONDITION(aParams.frame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
nsStyleContext *sc;
|
||||
if (!FindBackground(aForFrame, &sc)) {
|
||||
if (!FindBackground(aParams.frame, &sc)) {
|
||||
// We don't want to bail out if moz-appearance is set on a root
|
||||
// node. If it has a parent content node, bail because it's not
|
||||
// a root, otherwise keep going in order to let the theme stuff
|
||||
// draw the background. The canvas really should be drawing the
|
||||
// bg, but there's no way to hook that up via css.
|
||||
if (!aForFrame->StyleDisplay()->mAppearance) {
|
||||
if (!aParams.frame->StyleDisplay()->mAppearance) {
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
nsIContent* content = aForFrame->GetContent();
|
||||
nsIContent* content = aParams.frame->GetContent();
|
||||
if (!content || content->GetParent()) {
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
sc = aForFrame->StyleContext();
|
||||
sc = aParams.frame->StyleContext();
|
||||
}
|
||||
|
||||
return PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, sc,
|
||||
*aForFrame->StyleBorder(), aFlags,
|
||||
aBGClipRect, aLayer, aCompositonOp);
|
||||
return PaintBackgroundWithSC(aParams, sc, *aParams.frame->StyleBorder());
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -2855,41 +2888,36 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
DrawResult
|
||||
nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext* aBackgroundSC,
|
||||
const nsStyleBorder& aBorder,
|
||||
uint32_t aFlags,
|
||||
nsRect* aBGClipRect,
|
||||
int32_t aLayer,
|
||||
CompositionOp aCompositonOp)
|
||||
nsCSSRendering::PaintBackgroundWithSC(const PaintBGParams& aParams,
|
||||
nsStyleContext *aBackgroundSC,
|
||||
const nsStyleBorder& aBorder)
|
||||
{
|
||||
NS_PRECONDITION(aForFrame,
|
||||
NS_PRECONDITION(aParams.frame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
// If we're drawing all layers, aCompositonOp is ignored, so make sure that
|
||||
// it was left at its default value.
|
||||
MOZ_ASSERT_IF(aLayer == -1, aCompositonOp == CompositionOp::OP_OVER);
|
||||
MOZ_ASSERT_IF(aParams.layer == -1,
|
||||
aParams.compositionOp == CompositionOp::OP_OVER);
|
||||
|
||||
DrawResult result = DrawResult::SUCCESS;
|
||||
|
||||
// Check to see if we have an appearance defined. If so, we let the theme
|
||||
// renderer draw the background and bail out.
|
||||
// XXXzw this ignores aBGClipRect.
|
||||
const nsStyleDisplay* displayData = aForFrame->StyleDisplay();
|
||||
// XXXzw this ignores aParams.bgClipRect.
|
||||
const nsStyleDisplay* displayData = aParams.frame->StyleDisplay();
|
||||
if (displayData->mAppearance) {
|
||||
nsITheme *theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
nsITheme *theme = aParams.presCtx.GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(&aParams.presCtx,
|
||||
aParams.frame,
|
||||
displayData->mAppearance)) {
|
||||
nsRect drawing(aBorderArea);
|
||||
theme->GetWidgetOverflow(aPresContext->DeviceContext(),
|
||||
aForFrame, displayData->mAppearance, &drawing);
|
||||
drawing.IntersectRect(drawing, aDirtyRect);
|
||||
theme->DrawWidgetBackground(&aRenderingContext, aForFrame,
|
||||
displayData->mAppearance, aBorderArea,
|
||||
nsRect drawing(aParams.borderArea);
|
||||
theme->GetWidgetOverflow(aParams.presCtx.DeviceContext(),
|
||||
aParams.frame, displayData->mAppearance,
|
||||
&drawing);
|
||||
drawing.IntersectRect(drawing, aParams.dirtyRect);
|
||||
theme->DrawWidgetBackground(&aParams.renderingCtx, aParams.frame,
|
||||
displayData->mAppearance, aParams.borderArea,
|
||||
drawing);
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
@ -2902,26 +2930,26 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// nsPresShell::AddCanvasBackgroundColorItem, and painted by
|
||||
// nsDisplayCanvasBackground directly.) Either way we don't need to
|
||||
// paint the background color here.
|
||||
bool isCanvasFrame = IsCanvasFrame(aForFrame);
|
||||
bool isCanvasFrame = IsCanvasFrame(aParams.frame);
|
||||
|
||||
// Determine whether we are drawing background images and/or
|
||||
// background colors.
|
||||
bool drawBackgroundImage;
|
||||
bool drawBackgroundColor;
|
||||
|
||||
nscolor bgColor = DetermineBackgroundColor(aPresContext,
|
||||
nscolor bgColor = DetermineBackgroundColor(&aParams.presCtx,
|
||||
aBackgroundSC,
|
||||
aForFrame,
|
||||
aParams.frame,
|
||||
drawBackgroundImage,
|
||||
drawBackgroundColor);
|
||||
|
||||
bool paintMask = (aFlags & PAINTBG_MASK_IMAGE);
|
||||
bool paintMask = (aParams.paintFlags & PAINTBG_MASK_IMAGE);
|
||||
const nsStyleImageLayers& layers = paintMask ?
|
||||
aBackgroundSC->StyleSVGReset()->mMask :
|
||||
aBackgroundSC->StyleBackground()->mImage;
|
||||
// If we're drawing a specific layer, we don't want to draw the
|
||||
// background color.
|
||||
if ((drawBackgroundColor && aLayer >= 0) || paintMask) {
|
||||
if ((drawBackgroundColor && aParams.layer >= 0) || paintMask) {
|
||||
drawBackgroundColor = false;
|
||||
}
|
||||
|
||||
@ -2932,32 +2960,35 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
return DrawResult::SUCCESS;
|
||||
|
||||
// Compute the outermost boundary of the area that might be painted.
|
||||
// Same coordinate space as aBorderArea & aBGClipRect.
|
||||
Sides skipSides = aForFrame->GetSkipSides();
|
||||
// Same coordinate space as aParams.borderArea & aParams.bgClipRect.
|
||||
Sides skipSides = aParams.frame->GetSkipSides();
|
||||
nsRect paintBorderArea =
|
||||
::BoxDecorationRectForBackground(aForFrame, aBorderArea, skipSides, &aBorder);
|
||||
::BoxDecorationRectForBackground(aParams.frame, aParams.borderArea,
|
||||
skipSides, &aBorder);
|
||||
nsRect clipBorderArea =
|
||||
::BoxDecorationRectForBorder(aForFrame, aBorderArea, skipSides, &aBorder);
|
||||
::BoxDecorationRectForBorder(aParams.frame, aParams.borderArea,
|
||||
skipSides, &aBorder);
|
||||
|
||||
// The 'bgClipArea' (used only by the image tiling logic, far below)
|
||||
// is the caller-provided aBGClipRect if any, or else the area
|
||||
// is the caller-provided aParams.bgClipRect if any, or else the area
|
||||
// determined by the value of 'background-clip' in
|
||||
// SetupCurrentBackgroundClip. (Arguably it should be the
|
||||
// intersection, but that breaks the table painter -- in particular,
|
||||
// taking the intersection breaks reftests/bugs/403249-1[ab].)
|
||||
gfxContext* ctx = aRenderingContext.ThebesContext();
|
||||
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
|
||||
gfxContext* ctx = aParams.renderingCtx.ThebesContext();
|
||||
nscoord appUnitsPerPixel = aParams.presCtx.AppUnitsPerDevPixel();
|
||||
ImageLayerClipState clipState;
|
||||
if (aBGClipRect) {
|
||||
clipState.mBGClipArea = *aBGClipRect;
|
||||
if (aParams.bgClipRect) {
|
||||
clipState.mBGClipArea = *aParams.bgClipRect;
|
||||
clipState.mCustomClip = true;
|
||||
clipState.mHasRoundedCorners = false;
|
||||
SetupDirtyRects(clipState.mBGClipArea, aDirtyRect, appUnitsPerPixel,
|
||||
SetupDirtyRects(clipState.mBGClipArea, aParams.dirtyRect, appUnitsPerPixel,
|
||||
&clipState.mDirtyRect, &clipState.mDirtyRectGfx);
|
||||
} else {
|
||||
GetImageLayerClip(layers.BottomLayer(),
|
||||
aForFrame, aBorder, aBorderArea,
|
||||
aDirtyRect, (aFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
aParams.frame, aBorder, aParams.borderArea,
|
||||
aParams.dirtyRect,
|
||||
(aParams.paintFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
appUnitsPerPixel,
|
||||
&clipState);
|
||||
}
|
||||
@ -2987,7 +3018,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Validate the layer range before we start iterating.
|
||||
int32_t startLayer = aLayer;
|
||||
int32_t startLayer = aParams.layer;
|
||||
int32_t nLayers = 1;
|
||||
if (startLayer < 0) {
|
||||
startLayer = (int32_t)layers.mImageCount - 1;
|
||||
@ -2997,9 +3028,10 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// Ensure we get invalidated for loads of the image. We need to do
|
||||
// this here because this might be the only code that knows about the
|
||||
// association of the style data with the frame.
|
||||
if (aBackgroundSC != aForFrame->StyleContext()) {
|
||||
if (aBackgroundSC != aParams.frame->StyleContext()) {
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, layers, startLayer, nLayers) {
|
||||
aForFrame->AssociateImage(layers.mLayers[i].mImage, aPresContext);
|
||||
aParams.frame->AssociateImage(layers.mLayers[i].mImage,
|
||||
&aParams.presCtx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3016,7 +3048,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
nLayers + (layers.mImageCount -
|
||||
startLayer - 1)) {
|
||||
const nsStyleImageLayers::Layer& layer = layers.mLayers[i];
|
||||
if (!aBGClipRect) {
|
||||
if (!aParams.bgClipRect) {
|
||||
if (currentBackgroundClip != layer.mClip || !clipSet) {
|
||||
currentBackgroundClip = layer.mClip;
|
||||
// If clipSet is false that means this is the bottom layer and we
|
||||
@ -3024,17 +3056,18 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// in clipState.
|
||||
if (clipSet) {
|
||||
autoSR.Restore(); // reset the previous one
|
||||
GetImageLayerClip(layer, aForFrame,
|
||||
aBorder, aBorderArea, aDirtyRect, (aFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
GetImageLayerClip(layer, aParams.frame,
|
||||
aBorder, aParams.borderArea, aParams.dirtyRect,
|
||||
(aParams.paintFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
appUnitsPerPixel, &clipState);
|
||||
}
|
||||
SetupImageLayerClip(clipState, ctx, appUnitsPerPixel, &autoSR);
|
||||
clipSet = true;
|
||||
if (!clipBorderArea.IsEqualEdges(aBorderArea)) {
|
||||
if (!clipBorderArea.IsEqualEdges(aParams.borderArea)) {
|
||||
// We're drawing the background for the joined continuation boxes
|
||||
// so we need to clip that to the slice that we want for this frame.
|
||||
gfxRect clip =
|
||||
nsLayoutUtils::RectToGfxRect(aBorderArea, appUnitsPerPixel);
|
||||
nsLayoutUtils::RectToGfxRect(aParams.borderArea, appUnitsPerPixel);
|
||||
autoSR.EnsureSaved(ctx);
|
||||
ctx->NewPath();
|
||||
ctx->SnappedRectangle(clip);
|
||||
@ -3042,16 +3075,16 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((aLayer < 0 || i == (uint32_t)startLayer) &&
|
||||
if ((aParams.layer < 0 || i == (uint32_t)startLayer) &&
|
||||
!clipState.mDirtyRectGfx.IsEmpty()) {
|
||||
// When we're drawing a single layer, use the specified composition op,
|
||||
// otherwise get the compositon op from the image layer.
|
||||
CompositionOp co = (aLayer >= 0) ? aCompositonOp :
|
||||
CompositionOp co = (aParams.layer >= 0) ? aParams.compositionOp :
|
||||
(paintMask ? GetGFXCompositeMode(layer.mComposite) :
|
||||
GetGFXBlendMode(layer.mBlendMode));
|
||||
nsBackgroundLayerState state =
|
||||
PrepareImageLayer(aPresContext, aForFrame,
|
||||
aFlags, paintBorderArea, clipState.mBGClipArea,
|
||||
PrepareImageLayer(&aParams.presCtx, aParams.frame,
|
||||
aParams.paintFlags, paintBorderArea, clipState.mBGClipArea,
|
||||
layer, nullptr, co);
|
||||
result &= state.mImageRenderer.PrepareResult();
|
||||
if (!state.mFillArea.IsEmpty()) {
|
||||
@ -3065,7 +3098,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
result &=
|
||||
state.mImageRenderer.DrawBackground(aPresContext, aRenderingContext,
|
||||
state.mImageRenderer.DrawBackground(&aParams.presCtx,
|
||||
aParams.renderingCtx,
|
||||
state.mDestArea, state.mFillArea,
|
||||
state.mAnchor + paintBorderArea.TopLeft(),
|
||||
clipState.mDirtyRect);
|
||||
|
@ -589,15 +589,47 @@ struct nsCSSRendering {
|
||||
*/
|
||||
PAINTBG_MASK_IMAGE = 0x08
|
||||
};
|
||||
static DrawResult PaintBackground(nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
uint32_t aFlags,
|
||||
nsRect* aBGClipRect = nullptr,
|
||||
int32_t aLayer = -1,
|
||||
CompositionOp aCompositionOp = CompositionOp::OP_OVER);
|
||||
|
||||
struct PaintBGParams {
|
||||
nsPresContext& presCtx;
|
||||
nsRenderingContext& renderingCtx;
|
||||
nsRect dirtyRect;
|
||||
nsRect borderArea;
|
||||
nsIFrame* frame;
|
||||
uint32_t paintFlags = 0;
|
||||
nsRect* bgClipRect = nullptr;
|
||||
int32_t layer; // -1 means painting all layers; other
|
||||
// value means painting one specific
|
||||
// layer only.
|
||||
CompositionOp compositionOp = CompositionOp::OP_OVER;
|
||||
|
||||
static PaintBGParams ForAllLayers(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsIFrame *aFrame,
|
||||
uint32_t aPaintFlags);
|
||||
static PaintBGParams ForSingleLayer(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsIFrame *aFrame,
|
||||
uint32_t aPaintFlags,
|
||||
int32_t aLayer,
|
||||
CompositionOp aCompositionOp = CompositionOp::OP_OVER);
|
||||
|
||||
private:
|
||||
PaintBGParams(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea)
|
||||
: presCtx(aPresCtx),
|
||||
renderingCtx(aRenderingCtx),
|
||||
dirtyRect(aDirtyRect),
|
||||
borderArea(aBorderArea) { }
|
||||
};
|
||||
|
||||
static DrawResult PaintBackground(const PaintBGParams& aParams);
|
||||
|
||||
|
||||
/**
|
||||
@ -612,17 +644,9 @@ struct nsCSSRendering {
|
||||
* If all layers are painted, the image layer's blend mode (or the mask
|
||||
* layer's composition mode) will be used.
|
||||
*/
|
||||
static DrawResult PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext *aStyleContext,
|
||||
const nsStyleBorder& aBorder,
|
||||
uint32_t aFlags,
|
||||
nsRect* aBGClipRect = nullptr,
|
||||
int32_t aLayer = -1,
|
||||
CompositionOp aCompositionOp = CompositionOp::OP_OVER);
|
||||
static DrawResult PaintBackgroundWithSC(const PaintBGParams& aParams,
|
||||
nsStyleContext *mBackgroundSC,
|
||||
const nsStyleBorder& aBorder);
|
||||
|
||||
/**
|
||||
* Returns the rectangle covered by the given background layer image, taking
|
||||
|
@ -2961,12 +2961,15 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
|
||||
GenerateAndPushTextMask(mFrame, aCtx, mBackgroundRect);
|
||||
}
|
||||
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForSingleLayer(*mFrame->PresContext(),
|
||||
*aCtx,
|
||||
aBounds, mBackgroundRect,
|
||||
mFrame, flags, mLayer,
|
||||
CompositionOp::OP_OVER);
|
||||
params.bgClipRect = aClipRect;
|
||||
image::DrawResult result =
|
||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aBounds,
|
||||
mBackgroundRect,
|
||||
flags, aClipRect, mLayer,
|
||||
CompositionOp::OP_OVER);
|
||||
nsCSSRendering::PaintBackground(params);
|
||||
|
||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
ctx->PopGroupAndBlend();
|
||||
|
@ -1914,12 +1914,12 @@ void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
{
|
||||
const nsStyleBorder* border = mStyleContext->StyleBorder();
|
||||
nsRect rect(mRect + ToReferenceFrame());
|
||||
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mFrame->PresContext(), *aCtx,
|
||||
mVisibleRect, rect, mFrame,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
DrawResult result =
|
||||
nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
|
||||
mVisibleRect, rect,
|
||||
mStyleContext, *border,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
nsCSSRendering::PaintBackgroundWithSC(params, mStyleContext, *border);
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
@ -588,18 +588,18 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
|
||||
maskTarget->SetMatrix(matrixAutoSaveRestore.Matrix() * gfxMatrix::Translation(-drawRect.TopLeft()));
|
||||
|
||||
// Compose all mask-images onto maskSurface.
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags() |
|
||||
nsCSSRendering::PAINTBG_MASK_IMAGE;
|
||||
nsRenderingContext rc(maskTarget);
|
||||
nsRenderingContext rc(target);
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*aFrame->PresContext(), rc,
|
||||
aDirtyRect, aBorderArea,
|
||||
aFrame,
|
||||
aBuilder->GetBackgroundPaintFlags() |
|
||||
nsCSSRendering::PAINTBG_MASK_IMAGE);
|
||||
|
||||
// FIXME We should use the return value, see bug 1258510.
|
||||
Unused << nsCSSRendering::PaintBackgroundWithSC(aFrame->PresContext(),
|
||||
rc,
|
||||
aFrame,
|
||||
aDirtyRect,
|
||||
aBorderArea,
|
||||
Unused << nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
firstFrame->StyleContext(),
|
||||
*aFrame->StyleBorder(),
|
||||
flags);
|
||||
*aFrame->StyleBorder());
|
||||
maskSurface = maskTargetDT->Snapshot();
|
||||
|
||||
// Compute mask transform.
|
||||
|
@ -372,8 +372,12 @@ nsTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
nsRect rect(aPt, GetSize());
|
||||
return nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect, aFlags);
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*PresContext(),
|
||||
aRenderingContext,
|
||||
aDirtyRect, rect,
|
||||
this, aFlags);
|
||||
return nsCSSRendering::PaintBackground(params);
|
||||
}
|
||||
|
||||
// Called by nsTablePainter
|
||||
@ -1218,11 +1222,13 @@ nsBCTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
|
||||
myBorder.SetBorderWidth(side, borderWidth.Side(side));
|
||||
}
|
||||
|
||||
nsRect rect(aPt, GetSize());
|
||||
// bypassing nsCSSRendering::PaintBackground is safe because this kind
|
||||
// of frame cannot be used for the root element
|
||||
return nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext,
|
||||
this, aDirtyRect, rect,
|
||||
StyleContext(), myBorder,
|
||||
aFlags, nullptr);
|
||||
nsRect rect(aPt, GetSize());
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*PresContext(),
|
||||
aRenderingContext, aDirtyRect,
|
||||
rect, this,
|
||||
aFlags);
|
||||
return nsCSSRendering::PaintBackgroundWithSC(params, StyleContext(), myBorder);
|
||||
}
|
||||
|
@ -230,13 +230,18 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
|
||||
DrawResult result = DrawResult::SUCCESS;
|
||||
|
||||
if (tableData.IsVisible()) {
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mPresContext,
|
||||
mRenderingContext,
|
||||
mDirtyRect,
|
||||
tableData.mRect + mRenderPt,
|
||||
tableData.mFrame,
|
||||
mBGPaintFlags);
|
||||
|
||||
result &=
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
tableData.mFrame, mDirtyRect,
|
||||
tableData.mRect + mRenderPt,
|
||||
nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
tableData.mFrame->StyleContext(),
|
||||
tableData.StyleBorder(mZeroBorder),
|
||||
mBGPaintFlags);
|
||||
tableData.StyleBorder(mZeroBorder));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -567,46 +572,60 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
||||
|
||||
//Paint column group background
|
||||
if (haveColumns && mCols[colIndex].mColGroup.IsVisible()) {
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mPresContext, mRenderingContext,
|
||||
mDirtyRect,
|
||||
mCols[colIndex].mColGroup.mRect + mRenderPt,
|
||||
mCols[colIndex].mColGroup.mFrame,
|
||||
mBGPaintFlags);
|
||||
params.bgClipRect = &aColBGRect;
|
||||
result &=
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mCols[colIndex].mColGroup.mFrame, mDirtyRect,
|
||||
mCols[colIndex].mColGroup.mRect + mRenderPt,
|
||||
nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
mCols[colIndex].mColGroup.mFrame->StyleContext(),
|
||||
mCols[colIndex].mColGroup.StyleBorder(mZeroBorder),
|
||||
mBGPaintFlags, &aColBGRect);
|
||||
mCols[colIndex].mColGroup.StyleBorder(mZeroBorder));
|
||||
}
|
||||
|
||||
//Paint column background
|
||||
if (haveColumns && mCols[colIndex].mCol.IsVisible()) {
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mPresContext, mRenderingContext,
|
||||
mDirtyRect,
|
||||
mCols[colIndex].mCol.mRect + mRenderPt,
|
||||
mCols[colIndex].mCol.mFrame,
|
||||
mBGPaintFlags);
|
||||
params.bgClipRect = &aColBGRect;
|
||||
result &=
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mCols[colIndex].mCol.mFrame, mDirtyRect,
|
||||
mCols[colIndex].mCol.mRect + mRenderPt,
|
||||
nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
mCols[colIndex].mCol.mFrame->StyleContext(),
|
||||
mCols[colIndex].mCol.StyleBorder(mZeroBorder),
|
||||
mBGPaintFlags, &aColBGRect);
|
||||
mCols[colIndex].mCol.StyleBorder(mZeroBorder));
|
||||
}
|
||||
|
||||
//Paint row group background
|
||||
if (aRowGroupBGData.IsVisible()) {
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mPresContext, mRenderingContext,
|
||||
mDirtyRect,
|
||||
aRowGroupBGData.mRect + mRenderPt,
|
||||
aRowGroupBGData.mFrame, mBGPaintFlags);
|
||||
params.bgClipRect = &aRowGroupBGRect;
|
||||
result &=
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
aRowGroupBGData.mFrame, mDirtyRect,
|
||||
aRowGroupBGData.mRect + mRenderPt,
|
||||
nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
aRowGroupBGData.mFrame->StyleContext(),
|
||||
aRowGroupBGData.StyleBorder(mZeroBorder),
|
||||
mBGPaintFlags, &aRowGroupBGRect);
|
||||
aRowGroupBGData.StyleBorder(mZeroBorder));
|
||||
}
|
||||
|
||||
//Paint row background
|
||||
if (aRowBGData.IsVisible()) {
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*mPresContext, mRenderingContext,
|
||||
mDirtyRect,
|
||||
aRowBGData.mRect + mRenderPt,
|
||||
aRowBGData.mFrame, mBGPaintFlags);
|
||||
params.bgClipRect = &aRowBGRect;
|
||||
result &=
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
aRowBGData.mFrame, mDirtyRect,
|
||||
aRowBGData.mRect + mRenderPt,
|
||||
nsCSSRendering::PaintBackgroundWithSC(params,
|
||||
aRowBGData.mFrame->StyleContext(),
|
||||
aRowBGData.StyleBorder(mZeroBorder),
|
||||
mBGPaintFlags, &aRowBGRect);
|
||||
aRowBGData.StyleBorder(mZeroBorder));
|
||||
}
|
||||
|
||||
//Paint cell background in border-collapse unless we're just passing
|
||||
|
@ -4087,12 +4087,12 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
const nsStyleBorder* myBorder = aStyleContext->StyleBorder();
|
||||
|
||||
nsCSSRendering::PaintBGParams params =
|
||||
nsCSSRendering::PaintBGParams::ForAllLayers(*aPresContext, aRenderingContext,
|
||||
aDirtyRect, aRect, this,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
DrawResult result =
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, aRect,
|
||||
aStyleContext, *myBorder,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
nsCSSRendering::PaintBackgroundWithSC(params, aStyleContext, *myBorder);
|
||||
|
||||
result &=
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(aPresContext, aRenderingContext,
|
||||
|
Loading…
Reference in New Issue
Block a user