Bug 1342302 - Part 3. Rename ImageLayerClipState::mDirtyRectGfx to mDirtyRectInDevPx. r=mstange
authorcku <cku@mozilla.com>
Fri, 24 Feb 2017 14:56:11 +0800
changeset 344879 a1deec7b451aaf446d02bf454b296dc5fe959c13
parent 344878 f4ac43e3f67db80ac8a10fe00eb247c028ce7d4b
child 344880 1b8511b2ca4c016124cb1f5e7415267eba93fc12
push id37971
push usercku@mozilla.com
push dateSat, 25 Feb 2017 10:25:03 +0000
treeherderautoland@1b8511b2ca4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1342302
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1342302 - Part 3. Rename ImageLayerClipState::mDirtyRectGfx to mDirtyRectInDevPx. r=mstange MozReview-Commit-ID: 7YyQStU0Seq
layout/painting/nsCSSRendering.cpp
layout/painting/nsCSSRendering.h
layout/painting/nsDisplayList.cpp
--- 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);
           }
         }
       }
     }
--- a/layout/painting/nsCSSRendering.h
+++ b/layout/painting/nsCSSRendering.h
@@ -593,18 +593,18 @@ struct nsCSSRendering {
                     const nsRect& aBorderArea,
                     const nsRect& aBGClipRect,
                     const nsStyleImageLayers::Layer& aLayer,
                     bool* aOutIsTransformedFixed = nullptr);
 
   struct ImageLayerClipState {
     nsRect mBGClipArea;            // Affected by mClippedRadii
     nsRect mAdditionalBGClipArea;  // Not affected by mClippedRadii
-    nsRect mDirtyRect;
-    gfxRect mDirtyRectGfx;
+    nsRect mDirtyRectInAppUnits;
+    gfxRect mDirtyRectInDevPx;
 
     nscoord mRadii[8];
     RectCornerRadii mClippedRadii;
     bool mHasRoundedCorners;
     bool mHasAdditionalBGClipArea;
 
     // Whether we are being asked to draw with a caller provided background
     // clipping area. If this is true we also disable rounded corners.
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -7692,17 +7692,17 @@ ComputeMaskGeometry(PaintFramesParams& a
       nsCSSRendering::GetImageLayerClip(svgReset->mMask.mLayers[i],
                                        frame,
                                        *frame->StyleBorder(),
                                        userSpaceBorderArea,
                                        userSpaceDirtyRect,
                                        false, /* aWillPaintBorder */
                                        appUnitsPerDevPixel,
                                        &clipState);
-      currentMaskSurfaceRect = clipState.mDirtyRectGfx;
+      currentMaskSurfaceRect = clipState.mDirtyRectInDevPx;
     }
 
     maskInUserSpace = maskInUserSpace.Union(currentMaskSurfaceRect);
   }
 
   ctx.Save();
 
   if (!maskInUserSpace.IsEmpty()) {