Bug 1203417. Don't report BAD_IMAGE failure when trying to paint a null image. r=seth draft
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 13 Feb 2016 09:29:05 +1300
changeset 330743 2f8c9be00dc9c7222c7f9131d12b0e059b0f35c0
parent 329763 31918b5ace5361a6c68cec2ee81689e095b313b1
child 330744 3cfeb5e0e3c5387e26abba908703d21e60e4c34a
push id10824
push userrocallahan@mozilla.com
push dateFri, 12 Feb 2016 20:32:19 +0000
reviewersseth
bugs1203417
milestone47.0a1
Bug 1203417. Don't report BAD_IMAGE failure when trying to paint a null image. r=seth MozReview-Commit-ID: 1A3a7Gs576c
layout/base/nsCSSRendering.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -2997,16 +2997,21 @@ nsCSSRendering::PaintBackgroundWithSC(ns
 
   if (drawBackgroundImage) {
     bool clipSet = false;
     uint8_t currentBackgroundClip = NS_STYLE_IMAGELAYER_CLIP_BORDER;
     NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, layers, layers.mImageCount - 1,
                                                          nLayers + (layers.mImageCount -
                                                          startLayer - 1)) {
       const nsStyleImageLayers::Layer& layer = layers.mLayers[i];
+      if (layer.mImage.GetType() == eStyleImageType_Null) {
+        // Skip all processing; we don't want 'result' to be affected.
+        // XXX why does nsStyleImageLayers always allocate an empty Layer?
+        continue;
+      }
       if (!aBGClipRect) {
         if (currentBackgroundClip != layer.mClip || !clipSet) {
           currentBackgroundClip = layer.mClip;
           // If clipSet is false that means this is the bottom layer and we
           // already called GetImageLayerClip above and it stored its results
           // in clipState.
           if (clipSet) {
             autoSR.Restore(); // reset the previous one