Backed out changeset 7f0409a405f2 (bug 1435291).
authorAndrew Osmond <aosmond@mozilla.com>
Tue, 13 Mar 2018 16:03:59 -0400
changeset 464128 4058fc040cfef0ece01c386c293ab0cff01873d4
parent 464127 80ff9a92f99bcbf3392d48a9f548583e5733c6bf
child 464129 5118e942a2d79ff05b068938b6e888e7f05d1dce
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1435291
milestone61.0a1
backs out7f0409a405f2bb433b0c117431ba32b9d7006ab3
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
Backed out changeset 7f0409a405f2 (bug 1435291).
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
image/VectorImage.cpp
image/imgFrame.cpp
image/test/reftest/downscaling/reftest.list
layout/base/nsLayoutUtils.cpp
layout/painting/nsImageRenderer.cpp
layout/reftests/backgrounds/vector/reftest.list
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -149,16 +149,22 @@ WebRenderLayerManager::~WebRenderLayerMa
 }
 
 CompositorBridgeChild*
 WebRenderLayerManager::GetCompositorBridgeChild()
 {
   return WrBridge()->GetCompositorBridgeChild();
 }
 
+int32_t
+WebRenderLayerManager::GetMaxTextureSize() const
+{
+  return WrBridge()->GetMaxTextureSize();
+}
+
 bool
 WebRenderLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
 {
   mTarget = aTarget;
   return BeginTransaction();
 }
 
 bool
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -58,17 +58,17 @@ public:
 protected:
   virtual ~WebRenderLayerManager();
 
 public:
   virtual KnowsCompositor* AsKnowsCompositor() override;
   WebRenderLayerManager* AsWebRenderLayerManager() override { return this; }
   virtual CompositorBridgeChild* GetCompositorBridgeChild() override;
 
-  virtual int32_t GetMaxTextureSize() const override { return INT32_MAX; }
+  virtual int32_t GetMaxTextureSize() const override;
 
   virtual bool BeginTransactionWithTarget(gfxContext* aTarget) override;
   virtual bool BeginTransaction() override;
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override;
   void EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
                                   nsDisplayListBuilder* aDisplayListBuilder,
                                   const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>());
   virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -10,16 +10,17 @@
 #include "gfxDrawable.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "imgFrame.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/gfxVars.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Tuple.h"
 #include "nsIDOMEvent.h"
 #include "nsIPresShell.h"
 #include "nsIStreamListener.h"
 #include "nsMimeTypes.h"
 #include "nsPresContext.h"
 #include "nsRect.h"
@@ -854,42 +855,40 @@ VectorImage::GetImageContainerSize(Layer
   }
 
   return aSize;
 }
 
 NS_IMETHODIMP_(bool)
 VectorImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
 {
-  if (mError || !mIsFullyLoaded || mHaveAnimations ||
-      aManager->GetBackendType() != LayersBackend::LAYERS_WR) {
-    return false;
-  }
-
-  return true;
+  return false;
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
 VectorImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
 {
-  MOZ_ASSERT(aManager->GetBackendType() != LayersBackend::LAYERS_WR,
-             "WebRender should always use GetImageContainerAvailableAtSize!");
   return nullptr;
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(bool)
 VectorImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                              const IntSize& aSize,
                                              uint32_t aFlags)
 {
-  // Since we only support image containers with WebRender, and it can handle
-  // textures larger than the hw max texture size, we don't need to check aSize.
-  return !aSize.IsEmpty() && IsImageContainerAvailable(aManager, aFlags);
+  if (mError || !mIsFullyLoaded || aSize.IsEmpty() ||
+      mHaveAnimations || !gfxVars::GetUseWebRenderOrDefault()) {
+    return false;
+  }
+
+  int32_t maxTextureSize = aManager->GetMaxTextureSize();
+  return aSize.width <= maxTextureSize &&
+         aSize.height <= maxTextureSize;
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
 VectorImage::GetImageContainerAtSize(LayerManager* aManager,
                                      const IntSize& aSize,
                                      const Maybe<SVGImageContext>& aSVGContext,
                                      uint32_t aFlags)
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -13,17 +13,16 @@
 #include "gfx2DGlue.h"
 #include "gfxPlatform.h"
 #include "gfxPrefs.h"
 #include "gfxUtils.h"
 
 #include "GeckoProfiler.h"
 #include "MainThreadUtils.h"
 #include "mozilla/CheckedInt.h"
-#include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/Tools.h"
 #include "mozilla/gfx/SourceSurfaceRawData.h"
 #include "mozilla/layers/SourceSurfaceSharedData.h"
 #include "mozilla/layers/SourceSurfaceVolatileData.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
 #include "nsMargin.h"
 #include "nsThreadUtils.h"
--- a/image/test/reftest/downscaling/reftest.list
+++ b/image/test/reftest/downscaling/reftest.list
@@ -21,22 +21,22 @@
 # Also note that Mac OS X has its own system-level downscaling algorithm, so
 # tests here may need Mac-specific "fuzzy-if(cocoaWidget,...)" annotations.
 # Similarly, modern versions of Windows have slightly different downscaling
 # behavior than other platforms, and may require "fuzzy-if(winWidget,...)".
 
 
 # RUN TESTS NOT AFFECTED BY DOWNSCALE-DURING-DECODE:
 # ==================================================
-fuzzy-if(skiaContent,14,416) fuzzy-if(webrender,102-102,396-396) == downscale-svg-1a.html downscale-svg-1-ref.html?80
-fuzzy(80,468) fuzzy-if(webrender,65-65,579-579) == downscale-svg-1b.html downscale-svg-1-ref.html?72
-fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,62) fuzzy-if(skiaContent,8,292) fuzzy-if(webrender,14-14,316-316) == downscale-svg-1c.html downscale-svg-1-ref.html?64
-fuzzy(17,208) fuzzy-if(webrender,83-83,325-325) == downscale-svg-1d.html downscale-svg-1-ref.html?53
-fuzzy(80,216) fuzzy-if(skiaContent,110,181) fuzzy-if(webrender,84-84,216-216) == downscale-svg-1e.html downscale-svg-1-ref.html?40
-fuzzy(51,90) fuzzy-if(skiaContent,142,77) fuzzy-if(webrender,62-62,98-98) == downscale-svg-1f.html downscale-svg-1-ref.html?24
+fuzzy-if(skiaContent,14,416) fails-if(webrender) == downscale-svg-1a.html downscale-svg-1-ref.html?80
+fuzzy(80,468) == downscale-svg-1b.html downscale-svg-1-ref.html?72
+fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,62) fuzzy-if(skiaContent,8,292) == downscale-svg-1c.html downscale-svg-1-ref.html?64
+fuzzy(17,208) == downscale-svg-1d.html downscale-svg-1-ref.html?53
+fuzzy(80,216) fuzzy-if(skiaContent,110,181) == downscale-svg-1e.html downscale-svg-1-ref.html?40
+fuzzy(51,90) fuzzy-if(skiaContent,142,77) == downscale-svg-1f.html downscale-svg-1-ref.html?24
 
 # RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
 # ================================================
 default-preferences pref(image.downscale-during-decode.enabled,false)
 
 fuzzy-if(winWidget,16,20) fuzzy-if(cocoaWidget,106,31) == downscale-1.html downscale-1-ref.html
 
 fuzzy(20,999) != downscale-2a.html?203,52,left about:blank
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -7176,34 +7176,32 @@ nsLayoutUtils::ComputeImageContainerDraw
 {
   MOZ_ASSERT(aImage);
   MOZ_ASSERT(aForFrame);
 
   gfx::Size scaleFactors = aSc.GetInheritedScale();
   SamplingFilter samplingFilter =
     nsLayoutUtils::GetSamplingFilterForFrame(aForFrame);
 
-  // Compute our SVG context parameters, if any. Don't replace the viewport
-  // size if it was already set, prefer what the caller gave.
+  // Compute our SVG context parameters, if any.
   SVGImageContext::MaybeStoreContextPaint(aSVGContext, aForFrame, aImage);
   if ((scaleFactors.width != 1.0 || scaleFactors.height != 1.0) &&
-      aImage->GetType() == imgIContainer::TYPE_VECTOR &&
-      (!aSVGContext || !aSVGContext->GetViewportSize())) {
+      aImage->GetType() == imgIContainer::TYPE_VECTOR) {
+    if (!aSVGContext) {
+      aSVGContext.emplace();
+    }
+
     gfxSize gfxDestSize(aDestRect.Width(), aDestRect.Height());
     IntSize viewportSize =
       aImage->OptimalImageSizeForDest(gfxDestSize,
                                       imgIContainer::FRAME_CURRENT,
                                       samplingFilter, aFlags);
 
-    CSSIntSize cssViewportSize(viewportSize.width, viewportSize.height);
-    if (!aSVGContext) {
-      aSVGContext.emplace(Some(cssViewportSize));
-    } else {
-      aSVGContext->SetViewportSize(Some(cssViewportSize));
-    }
+    aSVGContext->SetViewportSize(Some(CSSIntSize(viewportSize.width,
+                                                 viewportSize.height)));
   }
 
   // Attempt to snap pixels, the same as ComputeSnappedImageDrawingParameters.
   // Any changes to the algorithm here will need to be reflected there.
   bool snapped = false;
   gfxSize gfxLayerSize;
   const gfx::Matrix& itm = aSc.GetInheritedTransform();
   if (!itm.HasNonAxisAlignedTransform() &&
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -595,23 +595,20 @@ nsImageRenderer::BuildWebRenderDisplayIt
       uint32_t containerFlags = imgIContainer::FLAG_ASYNC_NOTIFY;
       if (mFlags & nsImageRenderer::FLAG_PAINTING_TO_WINDOW) {
         containerFlags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
       }
       if (mFlags & nsImageRenderer::FLAG_SYNC_DECODE_IMAGES) {
         containerFlags |= imgIContainer::FLAG_SYNC_DECODE;
       }
 
-      CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
-                           nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
-      Maybe<SVGImageContext> svgContext(Some(SVGImageContext(Some(imageSize))));
-
       const int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel();
       LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
           aDest, appUnitsPerDevPixel);
+      Maybe<SVGImageContext> svgContext;
       gfx::IntSize decodeSize =
         nsLayoutUtils::ComputeImageContainerDrawingParameters(mImageContainer, mForFrame, destRect,
                                                               aSc, containerFlags, svgContext);
       RefPtr<layers::ImageContainer> container =
         mImageContainer->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
       if (!container) {
         NS_WARNING("Failed to get image container");
         return ImgDrawResult::NOT_READY;
--- a/layout/reftests/backgrounds/vector/reftest.list
+++ b/layout/reftests/backgrounds/vector/reftest.list
@@ -176,18 +176,18 @@ include empty/reftest.list
 == wide--contain--omitted-width-percent-height-viewbox.html ref-wide-lime16x128-aqua16x128.html
 == wide--contain--percent-width-nonpercent-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--contain--percent-width-nonpercent-height-viewbox.html ref-wide-lime16x128-aqua16x128.html
 == wide--contain--percent-width-omitted-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--contain--percent-width-omitted-height-viewbox.html ref-wide-lime16x128-aqua16x128.html
 == wide--contain--percent-width-percent-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--contain--percent-width-percent-height-viewbox.html ref-wide-lime16x128-aqua16x128.html
 
-fuzzy-if(webrender,127-127,768-768) == wide--cover--nonpercent-width-nonpercent-height.html ref-wide-lime768x256.html
-fuzzy-if(webrender,127-127,768-768) == wide--cover--nonpercent-width-nonpercent-height-viewbox.html ref-wide-lime768x256.html
+== wide--cover--nonpercent-width-nonpercent-height.html ref-wide-lime768x256.html
+== wide--cover--nonpercent-width-nonpercent-height-viewbox.html ref-wide-lime768x256.html
 == wide--cover--nonpercent-width-omitted-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--cover--nonpercent-width-omitted-height-viewbox.html ref-wide-lime768x256.html
 == wide--cover--nonpercent-width-percent-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--cover--nonpercent-width-percent-height-viewbox.html ref-wide-lime768x256.html
 == wide--cover--omitted-width-nonpercent-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--cover--omitted-width-nonpercent-height-viewbox.html ref-wide-lime768x256.html
 == wide--cover--omitted-width-omitted-height.html ref-wide-lime768x128-aqua768x128.html
 == wide--cover--omitted-width-omitted-height-viewbox.html ref-wide-lime768x256.html