Bug 1376855 - Support image mode of nsDisplayBorder in layers free mode. r=kats draft
authorMorris Tseng <mtseng@mozilla.com>
Wed, 28 Jun 2017 13:57:00 -0700
changeset 603974 2cd1deabc0d4b90a51a4566d83bc974527711603
parent 603973 07f20451cf3ec17c1c99d1873f00068a904e367d
child 603975 d653be78c0f7e47b284bb48ed2f36be0139816cd
push id66921
push userbmo:mtseng@mozilla.com
push dateWed, 05 Jul 2017 03:31:35 +0000
reviewerskats
bugs1376855
milestone56.0a1
Bug 1376855 - Support image mode of nsDisplayBorder in layers free mode. r=kats MozReview-Commit-ID: 8FgUKpeCbka
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4957,30 +4957,31 @@ nsDisplayBorder::CreateWebRenderCommands
   if (aManager->IsLayersFreeTransaction()) {
     ContainerLayerParameters parameter;
     if (GetLayerState(aDisplayListBuilder, aManager, parameter) != LAYER_ACTIVE) {
       return false;
     }
   }
 
   if (mBorderImageRenderer) {
-    // TODO: support image type display items.
-    //CreateBorderImageWebRenderCommands(aBuilder, aSc, aParentCommands, aLayer);
+    CreateBorderImageWebRenderCommands(aBuilder, aSc, aParentCommands,
+                                       aManager, aDisplayListBuilder);
   } else if (mBorderRenderer) {
     mBorderRenderer->CreateWebRenderCommands(aBuilder, aSc);
   }
 
   return true;
 };
 
 void
 nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
                                                     const StackingContextHelper& aSc,
                                                     nsTArray<WebRenderParentCommand>& aParentCommands,
-                                                    WebRenderDisplayItemLayer* aLayer)
+                                                    mozilla::layers::WebRenderLayerManager* aManager,
+                                                    nsDisplayListBuilder* aDisplayListBuilder)
 {
   MOZ_ASSERT(mBorderImageRenderer);
   if (!mBorderImageRenderer->mImageRenderer.IsReady()) {
     return;
   }
 
   float widths[4];
   float slice[4];
@@ -5001,28 +5002,28 @@ nsDisplayBorder::CreateBorderImageWebRen
     LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
       mBorderImageRenderer->mClip, appUnitsPerDevPixel);
     clip = aSc.ToRelativeWrRectRounded(clipRect);
   }
 
   switch (mBorderImageRenderer->mImageRenderer.GetType()) {
     case eStyleImageType_Image:
     {
-      nsDisplayListBuilder* builder = aLayer->GetDisplayListBuilder();
-      uint32_t flags = builder->ShouldSyncDecodeImages() ?
+      uint32_t flags = aDisplayListBuilder->ShouldSyncDecodeImages() ?
                        imgIContainer::FLAG_SYNC_DECODE :
                        imgIContainer::FLAG_NONE;
 
       RefPtr<imgIContainer> img = mBorderImageRenderer->mImageRenderer.GetImage();
-      RefPtr<layers::ImageContainer> container = img->GetImageContainer(aLayer->WrManager(), flags);
+      RefPtr<layers::ImageContainer> container = img->GetImageContainer(aManager, flags);
       if (!container) {
         return;
       }
 
-      Maybe<wr::ImageKey> key = aLayer->SendImageContainer(container, aParentCommands);
+      gfx::IntSize size;
+      Maybe<wr::ImageKey> key = aManager->CreateImageKey(this, container, aBuilder, aSc, size);
       if (key.isNothing()) {
         return;
       }
 
       aBuilder.PushBorderImage(dest,
                                clip,
                                wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
                                key.value(),
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2902,17 +2902,18 @@ public:
     *aSnap = true;
     return CalculateBounds(*mFrame->StyleBorder());
   }
 
 protected:
   void CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
                                           const StackingContextHelper& aSc,
                                           nsTArray<WebRenderParentCommand>& aParentCommands,
-                                          WebRenderDisplayItemLayer* aLayer);
+                                          mozilla::layers::WebRenderLayerManager* aManager,
+                                          nsDisplayListBuilder* aDisplayListBuilder);
   nsRegion CalculateBounds(const nsStyleBorder& aStyleBorder);
 
   mozilla::Array<mozilla::gfx::Color, 4> mColors;
   mozilla::Array<mozilla::LayerCoord, 4> mWidths;
   mozilla::Array<mozilla::LayerSize, 4> mCorners;
   mozilla::Array<uint8_t, 4> mBorderStyles;
   mozilla::LayerRect mRect;