Bug 897787. Use background-size in preference to background positioning area size for a background-image's preferered size. r=roc
authorNicholas Cameron <ncameron@mozilla.com>
Thu, 01 Aug 2013 16:22:40 +1200
changeset 153158 650bf3681eee44c85326a2d25c6fabaf0a74caa7
parent 153157 8b9f64d7a47e958c9d340267d943315dded95ac5
child 153159 caa64b53b0ba0784d38c99395c688cc9bbfa689f
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs897787
milestone25.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 897787. Use background-size in preference to background positioning area size for a background-image's preferered size. r=roc
layout/base/nsCSSRendering.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3126,28 +3126,29 @@ nsCSSRendering::PrepareBackgroundLayer(n
       bgClipRect.IntersectRect(bgClipRect, bgPositioningArea + aBorderArea.TopLeft());
     }
   }
 
   // Scale the image as specified for background-size and as required for
   // proper background positioning when background-position is defined with
   // percentages.
   CSSSizeOrRatio intrinsicSize = state.mImageRenderer.ComputeIntrinsicSize();
+  nsSize bgPositionSize = bgPositioningArea.Size();
   nsSize imageSize = ComputeDrawnSizeForBackground(intrinsicSize,
-                                                   bgPositioningArea.Size(),
+                                                   bgPositionSize,
                                                    aLayer.mSize);
   if (imageSize.width <= 0 || imageSize.height <= 0)
     return state;
 
   state.mImageRenderer.SetPreferredSize(intrinsicSize,
-                                        bgPositioningArea.Size());
+                                        imageSize);
 
   // Compute the position of the background now that the background's size is
   // determined.
-  ComputeBackgroundAnchorPoint(aLayer, bgPositioningArea.Size(), imageSize,
+  ComputeBackgroundAnchorPoint(aLayer, bgPositionSize, imageSize,
                                &imageTopLeft, &state.mAnchor);
   imageTopLeft += bgPositioningArea.TopLeft();
   state.mAnchor += bgPositioningArea.TopLeft();
 
   state.mDestArea = nsRect(imageTopLeft + aBorderArea.TopLeft(), imageSize);
   state.mFillArea = state.mDestArea;
   int repeatX = aLayer.mRepeat.mXRepeat;
   int repeatY = aLayer.mRepeat.mYRepeat;