--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -1987,19 +1987,19 @@ ComputeBoxValue(nsIFrame* aForFrame, Sty
}
return aBox;
}
bool
nsCSSRendering::ImageLayerClipState::IsValid() const
{
- // mDirtyRectGfx comes from mDirtyRect. If mDirtyRectGfx is not empty,
- // mDirtyRect can never be empty.
- if (!mDirtyRectGfx.IsEmpty() && mDirtyRect.IsEmpty()) {
+ // mDirtyRectInDevPx comes from mDirtyRectInAppUnits. mDirtyRectInAppUnits
+ // can not be empty if mDirtyRectInDevPx is not.
+ if (!mDirtyRectInDevPx.IsEmpty() && mDirtyRectInAppUnits.IsEmpty()) {
return false;
}
if (mHasRoundedCorners == mClippedRadii.IsEmpty()) {
return false;
}
return true;
@@ -2038,28 +2038,28 @@ nsCSSRendering::GetImageLayerClip(const
// Which coordinate space chosen for aBorderArea is not matter. What
// matter is to ensure returning aClipState->mBGClipArea in the consistent
// coordiante space with aBorderArea. So we evaluate the position of clip
// area base on the position of aBorderArea here.
aClipState->mBGClipArea =
clipAreaRelativeToStrokeBox + aBorderArea.TopLeft();
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
- aAppUnitsPerPixel, &aClipState->mDirtyRect,
- &aClipState->mDirtyRectGfx);
+ aAppUnitsPerPixel, &aClipState->mDirtyRectInAppUnits,
+ &aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
return;
}
if (layerClip == StyleGeometryBox::NoClip) {
aClipState->mBGClipArea = aCallerDirtyRect;
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
- aAppUnitsPerPixel, &aClipState->mDirtyRect,
- &aClipState->mDirtyRectGfx);
+ aAppUnitsPerPixel, &aClipState->mDirtyRectInAppUnits,
+ &aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
return;
}
MOZ_ASSERT(!aForFrame->IsFrameOfType(nsIFrame::eSVG) ||
aForFrame->GetType() == nsGkAtoms::svgOuterSVGFrame);
// Compute the outermost boundary of the area that might be painted.
@@ -2158,40 +2158,39 @@ nsCSSRendering::GetImageLayerClip(const
if (!haveRoundedCorners && aClipState->mHasAdditionalBGClipArea) {
// Do the intersection here to account for the fast path(?) below.
aClipState->mBGClipArea =
aClipState->mBGClipArea.Intersect(aClipState->mAdditionalBGClipArea);
aClipState->mHasAdditionalBGClipArea = false;
}
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect, aAppUnitsPerPixel,
- &aClipState->mDirtyRect, &aClipState->mDirtyRectGfx);
+ &aClipState->mDirtyRectInAppUnits,
+ &aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
}
static void
SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,
gfxContext *aCtx, nscoord aAppUnitsPerPixel,
gfxContextAutoSaveRestore* aAutoSR)
{
- if (aClipState.mDirtyRectGfx.IsEmpty()) {
+ if (aClipState.mDirtyRectInDevPx.IsEmpty()) {
// Our caller won't draw anything under this condition, so no need
// to set more up.
return;
}
if (aClipState.mCustomClip) {
// We don't support custom clips and rounded corners, arguably a bug, but
// table painting seems to depend on it.
return;
}
- DrawTarget* drawTarget = aCtx->GetDrawTarget();
-
// If we have rounded corners, clip all subsequent drawing to the
// rounded rectangle defined by bgArea and bgRadii (we don't know
// whether the rounded corners intrude on the dirtyRect or not).
// Do not do this if we have a caller-provided clip rect --
// as above with bgArea, arguably a bug, but table painting seems
// to depend on it.
if (aClipState.mHasAdditionalBGClipArea) {
@@ -2210,63 +2209,64 @@ SetupImageLayerClip(nsCSSRendering::Imag
Rect bgAreaGfx = NSRectToRect(aClipState.mBGClipArea, aAppUnitsPerPixel);
bgAreaGfx.Round();
if (bgAreaGfx.IsEmpty()) {
// I think it's become possible to hit this since
// https://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
NS_WARNING("converted background area should not be empty");
// Make our caller not do anything.
- aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
+ aClipState.mDirtyRectInDevPx.SizeTo(gfxSize(0.0, 0.0));
return;
}
aAutoSR->EnsureSaved(aCtx);
RefPtr<Path> roundedRect =
- MakePathForRoundedRect(*drawTarget, bgAreaGfx, aClipState.mClippedRadii);
+ MakePathForRoundedRect(*aCtx->GetDrawTarget(), bgAreaGfx,
+ aClipState.mClippedRadii);
aCtx->Clip(roundedRect);
}
}
static void
DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
gfxContext *aCtx, nscoord aAppUnitsPerPixel)
{
- if (aClipState.mDirtyRectGfx.IsEmpty()) {
+ if (aClipState.mDirtyRectInDevPx.IsEmpty()) {
// Our caller won't draw anything under this condition, so no need
// to set more up.
return;
}
DrawTarget* drawTarget = aCtx->GetDrawTarget();
// We don't support custom clips and rounded corners, arguably a bug, but
// table painting seems to depend on it.
if (!aClipState.mHasRoundedCorners || aClipState.mCustomClip) {
aCtx->NewPath();
- aCtx->Rectangle(aClipState.mDirtyRectGfx, true);
+ aCtx->Rectangle(aClipState.mDirtyRectInDevPx, true);
aCtx->Fill();
return;
}
Rect bgAreaGfx = NSRectToRect(aClipState.mBGClipArea, aAppUnitsPerPixel);
bgAreaGfx.Round();
if (bgAreaGfx.IsEmpty()) {
// I think it's become possible to hit this since
// https://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
NS_WARNING("converted background area should not be empty");
// Make our caller not do anything.
- aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
+ aClipState.mDirtyRectInDevPx.SizeTo(gfxSize(0.0, 0.0));
return;
}
aCtx->Save();
- gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectGfx);
+ gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectInDevPx);
aCtx->NewPath();
aCtx->Rectangle(dirty, true);
aCtx->Clip();
if (aClipState.mHasAdditionalBGClipArea) {
gfxRect bgAdditionalAreaGfx = nsLayoutUtils::RectToGfxRect(
aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel);
@@ -3401,17 +3401,18 @@ nsCSSRendering::PaintStyleImageLayerWith
gfxContext* ctx = aParams.renderingCtx.ThebesContext();
nscoord appUnitsPerPixel = aParams.presCtx.AppUnitsPerDevPixel();
ImageLayerClipState clipState;
if (aParams.bgClipRect) {
clipState.mBGClipArea = *aParams.bgClipRect;
clipState.mCustomClip = true;
clipState.mHasRoundedCorners = false;
SetupDirtyRects(clipState.mBGClipArea, aParams.dirtyRect, appUnitsPerPixel,
- &clipState.mDirtyRect, &clipState.mDirtyRectGfx);
+ &clipState.mDirtyRectInAppUnits,
+ &clipState.mDirtyRectInDevPx);
} else {
GetImageLayerClip(layers.BottomLayer(),
aParams.frame, aBorder, aParams.borderArea,
aParams.dirtyRect,
(aParams.paintFlags & PAINTBG_WILL_PAINT_BORDER),
appUnitsPerPixel,
&clipState);
}
@@ -3495,17 +3496,17 @@ nsCSSRendering::PaintStyleImageLayerWith
autoSR.EnsureSaved(ctx);
ctx->NewPath();
ctx->SnappedRectangle(clip);
ctx->Clip();
}
}
}
if ((aParams.layer < 0 || i == (uint32_t)startLayer) &&
- !clipState.mDirtyRectGfx.IsEmpty()) {
+ !clipState.mDirtyRectInDevPx.IsEmpty()) {
CompositionOp co = DetermineCompositionOp(aParams, layers, i);
nsBackgroundLayerState state =
PrepareImageLayer(&aParams.presCtx, aParams.frame,
aParams.paintFlags, paintBorderArea, clipState.mBGClipArea,
layer, nullptr);
result &= state.mImageRenderer.PrepareResult();
if (!state.mFillArea.IsEmpty()) {
if (co != CompositionOp::OP_OVER) {
@@ -3515,17 +3516,17 @@ nsCSSRendering::PaintStyleImageLayerWith
ctx->SetOp(co);
}
result &=
state.mImageRenderer.DrawLayer(&aParams.presCtx,
aParams.renderingCtx,
state.mDestArea, state.mFillArea,
state.mAnchor + paintBorderArea.TopLeft(),
- clipState.mDirtyRect,
+ clipState.mDirtyRectInAppUnits,
state.mRepeatSize, aParams.opacity);
if (co != CompositionOp::OP_OVER) {
ctx->SetOp(CompositionOp::OP_OVER);
}
}
}
}