Bug 1568227. Use the visible rect as the display items bounds for fallback items. r=nical
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 10 Sep 2019 17:48:39 +0000
changeset 492566 9163b1b1da061853f0c34b2725937cbca6975def
parent 492565 b188ca5e00bb94c106ff796c18ab1d79c9db8743
child 492567 521655c73cd1f418b8732c47b9821661ccfb303b
push id94986
push userjmuizelaar@mozilla.com
push dateTue, 10 Sep 2019 17:49:44 +0000
treeherderautoland@9163b1b1da06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1568227
milestone71.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 1568227. Use the visible rect as the display items bounds for fallback items. r=nical Differential Revision: https://phabricator.services.mozilla.com/D45323
gfx/layers/wr/WebRenderCommandBuilder.cpp
testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -2177,31 +2177,29 @@ WebRenderCommandBuilder::GenerateFallbac
   auto trans =
       ViewAs<LayerPixel>(aSc.GetSnappingSurfaceTransform().GetTranslation());
   auto snappedTrans = LayerIntPoint::Floor(trans);
   LayerPoint residualOffset = trans - snappedTrans;
 
   auto dtRect = LayerIntRect::FromUnknownRect(
       ScaleToOutsidePixelsOffset(paintBounds, scale.width, scale.height,
                                  appUnitsPerDevPixel, residualOffset));
-  auto dtSize = dtRect.Size();
 
   auto visibleRect = LayerIntRect::FromUnknownRect(
                          ScaleToOutsidePixelsOffset(
                              aItem->GetBuildingRect(), scale.width,
                              scale.height, appUnitsPerDevPixel, residualOffset))
                          .Intersect(dtRect);
-  // visibleRect is relative to the blob origin so adjust for that
-  visibleRect -= dtRect.TopLeft();
 
-  if (dtSize.IsEmpty()) {
+  auto visibleSize = visibleRect.Size();
+  if (visibleSize.IsEmpty()) {
     return nullptr;
   }
   // Display item bounds should be unscaled
-  aImageRect = dtRect / layerScale;
+  aImageRect = visibleRect / layerScale;
 
   nsDisplayItemGeometry* geometry = fallbackData->mGeometry;
 
   bool needPaint = true;
 
   // nsDisplayFilters is rendered via BasicLayerManager which means the
   // invalidate region is unknown until we traverse the displaylist contained by
   // it.
@@ -2262,53 +2260,53 @@ WebRenderCommandBuilder::GenerateFallbac
                     validFonts = false;
                     break;
                   }
                   BlobFont font = {key.value(), scaled};
                   aStream.write((const char*)&font, sizeof(font));
                 }
                 fonts = std::move(aScaledFonts);
               },
-              dtRect.ToUnknownRect().TopLeft());
+              visibleRect.ToUnknownRect().TopLeft());
       RefPtr<gfx::DrawTarget> dummyDt = gfx::Factory::CreateDrawTarget(
           gfx::BackendType::SKIA, gfx::IntSize(1, 1), format);
       RefPtr<gfx::DrawTarget> dt = gfx::Factory::CreateRecordingDrawTarget(
           recorder, dummyDt, dtRect.ToUnknownRect());
       if (!fallbackData->mBasicLayerManager) {
         fallbackData->mBasicLayerManager =
             new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
       }
       // aOffset is (0, 0) because blobs don't want to normalize their
       // coordinates
       bool isInvalidated = PaintItemByDrawTarget(
           aItem, dt, LayoutDevicePoint(0, 0),
-          /*aVisibleRect: */ dtRect.ToUnknownRect(), aDisplayListBuilder,
+          /*aVisibleRect: */ visibleRect.ToUnknownRect(), aDisplayListBuilder,
           fallbackData->mBasicLayerManager, scale, highlight);
       if (!isInvalidated) {
         if (!aItem->GetBuildingRect().IsEqualInterior(
                 fallbackData->mBuildingRect)) {
           // The building rect has changed but we didn't see any invalidations.
           // We should still consider this an invalidation.
           isInvalidated = true;
         }
       }
-      recorder->FlushItem(dtRect.ToUnknownRect());
+      recorder->FlushItem(visibleRect.ToUnknownRect());
       recorder->Finish();
 
       if (!validFonts) {
         gfxCriticalNote << "Failed serializing fonts for blob image";
         return nullptr;
       }
 
       if (isInvalidated) {
         Range<uint8_t> bytes((uint8_t*)recorder->mOutputStream.mData,
                              recorder->mOutputStream.mLength);
         wr::BlobImageKey key =
             wr::BlobImageKey{mManager->WrBridge()->GetNextImageKey()};
-        wr::ImageDescriptor descriptor(dtSize.ToUnknownSize(), 0,
+        wr::ImageDescriptor descriptor(visibleSize.ToUnknownSize(), 0,
                                        dt->GetFormat(), opacity);
         if (!aResources.AddBlobImage(
                 key, descriptor, bytes,
                 ViewAs<ImagePixel>(visibleRect,
                                    PixelCastJustification::LayerIsImage))) {
           return nullptr;
         }
         TakeExternalSurfaces(
@@ -2334,17 +2332,17 @@ WebRenderCommandBuilder::GenerateFallbac
       imageData->CreateImageClientIfNeeded();
       RefPtr<ImageClient> imageClient = imageData->GetImageClient();
       RefPtr<ImageContainer> imageContainer =
           LayerManager::CreateImageContainer();
       bool isInvalidated = false;
 
       {
         UpdateImageHelper helper(imageContainer, imageClient,
-                                 dtSize.ToUnknownSize(), format);
+                                 visibleSize.ToUnknownSize(), format);
         {
           RefPtr<gfx::DrawTarget> dt = helper.GetDrawTarget();
           if (!dt) {
             return nullptr;
           }
           if (!fallbackData->mBasicLayerManager) {
             fallbackData->mBasicLayerManager =
                 new BasicLayerManager(mManager->GetWidget());
--- a/testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
+++ b/testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
@@ -1,5 +1,7 @@
 [paint-order-001.tentative.html]
   disabled:
     if os == "android" and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1520847
   expected:
     if (os == "win"): FAIL
+  fuzzy:
+    if webrender: maxDifference=64;totalPixels=0-46