Bug 897787. Use background-size in preference to background positioning area size for a background-image's preferered size. r=roc

This commit is contained in:
Nicholas Cameron 2013-08-01 16:22:40 +12:00
parent 9c23e87963
commit 8a2940a22f

View File

@ -3131,18 +3131,19 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
// 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();