Bug 613659 - Implement box-decoration-break layout for backgrounds. r=cam,jmuizelaar

--HG--
rename : layout/reftests/backgrounds/background-size-each-box.html => layout/reftests/backgrounds/background-size-clone.html
rename : layout/reftests/backgrounds/background-size-cover-each-box.html => layout/reftests/backgrounds/background-size-cover-clone.html
rename : layout/reftests/backgrounds/background-size-cover-continuous.html => layout/reftests/backgrounds/background-size-cover-slice.html
rename : layout/reftests/backgrounds/background-size-continuous.html => layout/reftests/backgrounds/background-size-slice.html
This commit is contained in:
Mats Palmgren 2014-04-17 12:11:07 +00:00
parent 8fca6e72ff
commit 8629612bac
19 changed files with 112 additions and 257 deletions

View File

@ -831,14 +831,12 @@ public:
mContext->Save(); mContext->Save();
} }
void Reset(gfxContext *aContext) { void EnsureSaved(gfxContext *aContext) {
// Do the equivalent of destroying and re-creating this object. MOZ_ASSERT(!mContext || mContext == aContext, "wrong context");
NS_PRECONDITION(aContext, "must provide a context"); if (!mContext) {
if (mContext) { mContext = aContext;
mContext->Restore(); mContext->Save();
} }
mContext = aContext;
mContext->Save();
} }
private: private:

View File

@ -527,6 +527,18 @@ BoxDecorationRectForBorder(nsIFrame* aFrame, const nsRect& aBorderArea,
: aBorderArea; : aBorderArea;
} }
static nsRect
BoxDecorationRectForBackground(nsIFrame* aFrame, const nsRect& aBorderArea,
const nsStyleBorder* aStyleBorder = nullptr)
{
if (!aStyleBorder) {
aStyleBorder = aFrame->StyleBorder();
}
return ::IsBoxDecorationSlice(*aStyleBorder)
? ::JoinBoxesForSlice(aFrame, aBorderArea, eForBackground)
: aBorderArea;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Thebes Border Rendering Code Start // Thebes Border Rendering Code Start
@ -1697,6 +1709,7 @@ GetBackgroundClip(gfxContext *aCtx, uint8_t aBackgroundClip,
aClipState->mCustomClip = false; aClipState->mCustomClip = false;
aClipState->mRadiiAreOuter = true; aClipState->mRadiiAreOuter = true;
aClipState->mClippedRadii = aBGRadii; aClipState->mClippedRadii = aBGRadii;
if (aForFrame->GetType() == nsGkAtoms::scrollFrame && if (aForFrame->GetType() == nsGkAtoms::scrollFrame &&
NS_STYLE_BG_ATTACHMENT_LOCAL == aBackgroundAttachment) { NS_STYLE_BG_ATTACHMENT_LOCAL == aBackgroundAttachment) {
// As of this writing, this is still in discussion in the CSS Working Group // As of this writing, this is still in discussion in the CSS Working Group
@ -1795,15 +1808,13 @@ SetupBackgroundClip(BackgroundClipState& aClipState, gfxContext *aCtx,
// as above with bgArea, arguably a bug, but table painting seems // as above with bgArea, arguably a bug, but table painting seems
// to depend on it. // to depend on it.
if (aHaveRoundedCorners || aClipState.mHasAdditionalBGClipArea) {
aAutoSR->Reset(aCtx);
}
if (aClipState.mHasAdditionalBGClipArea) { if (aClipState.mHasAdditionalBGClipArea) {
gfxRect bgAreaGfx = nsLayoutUtils::RectToGfxRect( gfxRect bgAreaGfx = nsLayoutUtils::RectToGfxRect(
aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel); aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel);
bgAreaGfx.Round(); bgAreaGfx.Round();
bgAreaGfx.Condition(); bgAreaGfx.Condition();
aAutoSR->EnsureSaved(aCtx);
aCtx->NewPath(); aCtx->NewPath();
aCtx->Rectangle(bgAreaGfx, true); aCtx->Rectangle(bgAreaGfx, true);
aCtx->Clip(); aCtx->Clip();
@ -1824,6 +1835,7 @@ SetupBackgroundClip(BackgroundClipState& aClipState, gfxContext *aCtx,
return; return;
} }
aAutoSR->EnsureSaved(aCtx);
aCtx->NewPath(); aCtx->NewPath();
aCtx->RoundedRectangle(bgAreaGfx, aClipState.mClippedRadii, aClipState.mRadiiAreOuter); aCtx->RoundedRectangle(bgAreaGfx, aClipState.mClippedRadii, aClipState.mRadiiAreOuter);
aCtx->Clip(); aCtx->Clip();
@ -2598,26 +2610,14 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
return; return;
// Compute the outermost boundary of the area that might be painted. // Compute the outermost boundary of the area that might be painted.
gfxContext *ctx = aRenderingContext.ThebesContext(); // Same coordinate space as aBorderArea & aBGClipRect.
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel(); nsRect paintBorderArea =
::BoxDecorationRectForBackground(aForFrame, aBorderArea, &aBorder);
// Same coordinate space as aBorderArea & aBGClipRect nsRect clipBorderArea =
::BoxDecorationRectForBorder(aForFrame, aBorderArea, &aBorder);
gfxCornerSizes bgRadii; gfxCornerSizes bgRadii;
bool haveRoundedCorners; bool haveRoundedCorners =
{ ::GetRadii(aForFrame, aBorder, aBorderArea, clipBorderArea, &bgRadii);
nscoord radii[8];
nsSize frameSize = aForFrame->GetSize();
if (&aBorder == aForFrame->StyleBorder() &&
frameSize == aBorderArea.Size()) {
haveRoundedCorners = aForFrame->GetBorderRadii(radii);
} else {
haveRoundedCorners = nsIFrame::ComputeBorderRadii(aBorder.mBorderRadius,
frameSize, aBorderArea.Size(),
aForFrame->GetSkipSides(), radii);
}
if (haveRoundedCorners)
ComputePixelRadii(radii, appUnitsPerPixel, &bgRadii);
}
// The 'bgClipArea' (used only by the image tiling logic, far below) // The 'bgClipArea' (used only by the image tiling logic, far below)
// is the caller-provided aBGClipRect if any, or else the area // is the caller-provided aBGClipRect if any, or else the area
@ -2625,6 +2625,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// SetupCurrentBackgroundClip. (Arguably it should be the // SetupCurrentBackgroundClip. (Arguably it should be the
// intersection, but that breaks the table painter -- in particular, // intersection, but that breaks the table painter -- in particular,
// taking the intersection breaks reftests/bugs/403249-1[ab].) // taking the intersection breaks reftests/bugs/403249-1[ab].)
gfxContext* ctx = aRenderingContext.ThebesContext();
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
BackgroundClipState clipState; BackgroundClipState clipState;
uint8_t currentBackgroundClip; uint8_t currentBackgroundClip;
bool isSolidBorder; bool isSolidBorder;
@ -2654,7 +2656,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
} }
GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment, GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment,
aForFrame, aBorderArea, aForFrame, clipBorderArea,
aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel, aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel,
&clipState); &clipState);
} }
@ -2663,6 +2665,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
if (drawBackgroundColor && !isCanvasFrame) if (drawBackgroundColor && !isCanvasFrame)
ctx->SetColor(gfxRGBA(bgColor)); ctx->SetColor(gfxRGBA(bgColor));
// NOTE: no Save() yet, we do that later by calling autoSR.EnsureSaved(ctx)
// in the cases we need it.
gfxContextAutoSaveRestore autoSR; gfxContextAutoSaveRestore autoSR;
// If there is no background image, draw a color. (If there is // If there is no background image, draw a color. (If there is
@ -2722,19 +2726,30 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// already called GetBackgroundClip above and it stored its results // already called GetBackgroundClip above and it stored its results
// in clipState. // in clipState.
if (clipSet) { if (clipSet) {
autoSR = gfxContextAutoSaveRestore(); // reset the previous one
GetBackgroundClip(ctx, currentBackgroundClip, layer.mAttachment, aForFrame, GetBackgroundClip(ctx, currentBackgroundClip, layer.mAttachment, aForFrame,
aBorderArea, aDirtyRect, haveRoundedCorners, clipBorderArea, aDirtyRect, haveRoundedCorners,
bgRadii, appUnitsPerPixel, &clipState); bgRadii, appUnitsPerPixel, &clipState);
} }
SetupBackgroundClip(clipState, ctx, haveRoundedCorners, SetupBackgroundClip(clipState, ctx, haveRoundedCorners,
appUnitsPerPixel, &autoSR); appUnitsPerPixel, &autoSR);
clipSet = true; clipSet = true;
if (!clipBorderArea.IsEqualEdges(aBorderArea)) {
// We're drawing the background for the joined continuation boxes
// so we need to clip that to the slice that we want for this frame.
gfxRect clip =
nsLayoutUtils::RectToGfxRect(aBorderArea, appUnitsPerPixel);
autoSR.EnsureSaved(ctx);
ctx->NewPath();
ctx->SnappedRectangle(clip);
ctx->Clip();
}
} }
} }
if ((aLayer < 0 || i == (uint32_t)startLayer) && if ((aLayer < 0 || i == (uint32_t)startLayer) &&
!clipState.mDirtyRectGfx.IsEmpty()) { !clipState.mDirtyRectGfx.IsEmpty()) {
nsBackgroundLayerState state = PrepareBackgroundLayer(aPresContext, aForFrame, nsBackgroundLayerState state = PrepareBackgroundLayer(aPresContext, aForFrame,
aFlags, aBorderArea, clipState.mBGClipArea, *bg, layer); aFlags, paintBorderArea, clipState.mBGClipArea, layer);
if (!state.mFillArea.IsEmpty()) { if (!state.mFillArea.IsEmpty()) {
if (state.mCompositingOp != gfxContext::OPERATOR_OVER) { if (state.mCompositingOp != gfxContext::OPERATOR_OVER) {
NS_ASSERTION(ctx->CurrentOperator() == gfxContext::OPERATOR_OVER, NS_ASSERTION(ctx->CurrentOperator() == gfxContext::OPERATOR_OVER,
@ -2743,7 +2758,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
} }
state.mImageRenderer.DrawBackground(aPresContext, aRenderingContext, state.mImageRenderer.DrawBackground(aPresContext, aRenderingContext,
state.mDestArea, state.mFillArea, state.mDestArea, state.mFillArea,
state.mAnchor + aBorderArea.TopLeft(), state.mAnchor + paintBorderArea.TopLeft(),
clipState.mDirtyRect); clipState.mDirtyRect);
if (state.mCompositingOp != gfxContext::OPERATOR_OVER) { if (state.mCompositingOp != gfxContext::OPERATOR_OVER) {
ctx->SetOperator(gfxContext::OPERATOR_OVER); ctx->SetOperator(gfxContext::OPERATOR_OVER);
@ -2798,26 +2813,12 @@ nsCSSRendering::PaintBackgroundColorWithSC(nsPresContext* aPresContext,
} }
// Compute the outermost boundary of the area that might be painted. // Compute the outermost boundary of the area that might be painted.
gfxContext *ctx = aRenderingContext.ThebesContext(); // Same coordinate space as aBorderArea.
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel(); nsRect clipBorderArea =
::BoxDecorationRectForBorder(aForFrame, aBorderArea, &aBorder);
// Same coordinate space as aBorderArea
gfxCornerSizes bgRadii; gfxCornerSizes bgRadii;
bool haveRoundedCorners; bool haveRoundedCorners =
{ ::GetRadii(aForFrame, aBorder, aBorderArea, clipBorderArea, &bgRadii);
nscoord radii[8];
nsSize frameSize = aForFrame->GetSize();
if (&aBorder == aForFrame->StyleBorder() &&
frameSize == aBorderArea.Size()) {
haveRoundedCorners = aForFrame->GetBorderRadii(radii);
} else {
haveRoundedCorners = nsIFrame::ComputeBorderRadii(aBorder.mBorderRadius,
frameSize, aBorderArea.Size(),
aForFrame->GetSkipSides(), radii);
}
if (haveRoundedCorners)
ComputePixelRadii(radii, appUnitsPerPixel, &bgRadii);
}
// The background is rendered over the 'background-clip' area, // The background is rendered over the 'background-clip' area,
// which is normally equal to the border area but may be reduced // which is normally equal to the border area but may be reduced
@ -2827,6 +2828,8 @@ nsCSSRendering::PaintBackgroundColorWithSC(nsPresContext* aPresContext,
// radii as the border code will. // radii as the border code will.
// The background-color is drawn based on the bottom // The background-color is drawn based on the bottom
// background-clip. // background-clip.
gfxContext* ctx = aRenderingContext.ThebesContext();
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
const nsStyleBackground *bg = aBackgroundSC->StyleBackground(); const nsStyleBackground *bg = aBackgroundSC->StyleBackground();
uint8_t currentBackgroundClip = bg->BottomLayer().mClip; uint8_t currentBackgroundClip = bg->BottomLayer().mClip;
bool isSolidBorder = bool isSolidBorder =
@ -2841,7 +2844,7 @@ nsCSSRendering::PaintBackgroundColorWithSC(nsPresContext* aPresContext,
BackgroundClipState clipState; BackgroundClipState clipState;
GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment, GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment,
aForFrame, aBorderArea, aForFrame, clipBorderArea,
aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel, aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel,
&clipState); &clipState);
@ -2866,47 +2869,17 @@ nsRect
nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext, nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer, const nsStyleBackground::Layer& aLayer,
nsIFrame** aAttachedToFrame) nsIFrame** aAttachedToFrame)
{ {
// Compute background origin area relative to aBorderArea now as we may need // Compute background origin area relative to aBorderArea now as we may need
// it to compute the effective image size for a CSS gradient. // it to compute the effective image size for a CSS gradient.
nsRect bgPositioningArea(0, 0, 0, 0); nsRect bgPositioningArea;
nsIAtom* frameType = aForFrame->GetType(); nsIAtom* frameType = aForFrame->GetType();
nsIFrame* geometryFrame = aForFrame; nsIFrame* geometryFrame = aForFrame;
if (frameType == nsGkAtoms::inlineFrame) { if (MOZ_UNLIKELY(frameType == nsGkAtoms::scrollFrame &&
// XXXjwalden Strictly speaking this is not quite faithful to how NS_STYLE_BG_ATTACHMENT_LOCAL == aLayer.mAttachment)) {
// background-break is supposed to interact with background-origin values,
// but it's a non-trivial amount of work to make it fully conformant, and
// until the specification is more finalized (and assuming background-break
// even makes the cut) it doesn't make sense to hammer out exact behavior.
switch (aBackground.mBackgroundInlinePolicy) {
case NS_STYLE_BG_INLINE_POLICY_EACH_BOX:
bgPositioningArea = nsRect(nsPoint(0,0), aBorderArea.Size());
break;
case NS_STYLE_BG_INLINE_POLICY_BOUNDING_BOX:
bgPositioningArea = gInlineBGData->GetBoundingRect(aForFrame);
break;
default:
NS_ERROR("Unknown background-inline-policy value! "
"Please, teach me what to do.");
case NS_STYLE_BG_INLINE_POLICY_CONTINUOUS:
bgPositioningArea = gInlineBGData->GetContinuousRect(aForFrame);
break;
}
} else if (frameType == nsGkAtoms::canvasFrame) {
geometryFrame = aForFrame->GetFirstPrincipalChild();
// geometryFrame might be null if this canvas is a page created
// as an overflow container (e.g. the in-flow content has already
// finished and this page only displays the continuations of
// absolutely positioned content).
if (geometryFrame) {
bgPositioningArea = geometryFrame->GetRect();
}
} else if (frameType == nsGkAtoms::scrollFrame &&
NS_STYLE_BG_ATTACHMENT_LOCAL == aLayer.mAttachment) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame);
bgPositioningArea = nsRect( bgPositioningArea = nsRect(
scrollableFrame->GetScrolledFrame()->GetPosition() scrollableFrame->GetScrolledFrame()->GetPosition()
@ -2930,6 +2903,17 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
} }
*aAttachedToFrame = aForFrame; *aAttachedToFrame = aForFrame;
return bgPositioningArea; return bgPositioningArea;
}
if (MOZ_UNLIKELY(frameType == nsGkAtoms::canvasFrame)) {
geometryFrame = aForFrame->GetFirstPrincipalChild();
// geometryFrame might be null if this canvas is a page created
// as an overflow container (e.g. the in-flow content has already
// finished and this page only displays the continuations of
// absolutely positioned content).
if (geometryFrame) {
bgPositioningArea = geometryFrame->GetRect();
}
} else { } else {
bgPositioningArea = nsRect(nsPoint(0,0), aBorderArea.Size()); bgPositioningArea = nsRect(nsPoint(0,0), aBorderArea.Size());
} }
@ -2943,7 +2927,6 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
NS_ASSERTION(aLayer.mOrigin == NS_STYLE_BG_ORIGIN_CONTENT, NS_ASSERTION(aLayer.mOrigin == NS_STYLE_BG_ORIGIN_CONTENT,
"unknown background-origin value"); "unknown background-origin value");
} }
geometryFrame->ApplySkipSides(border);
bgPositioningArea.Deflate(border); bgPositioningArea.Deflate(border);
} }
@ -3027,11 +3010,10 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
uint32_t aFlags, uint32_t aFlags,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsRect& aBGClipRect, const nsRect& aBGClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer) const nsStyleBackground::Layer& aLayer)
{ {
/* /*
* The background properties we need to keep in mind when drawing background * The properties we need to keep in mind when drawing background
* layers are: * layers are:
* *
* background-image * background-image
@ -3041,8 +3023,8 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
* background-clip * background-clip
* background-origin * background-origin
* background-size * background-size
* background-break (-moz-background-inline-policy)
* background-blend-mode * background-blend-mode
* box-decoration-break
* *
* (background-color applies to the entire element and not to individual * (background-color applies to the entire element and not to individual
* layers, so it is irrelevant to this method.) * layers, so it is irrelevant to this method.)
@ -3065,22 +3047,21 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
* depends upon background-attachment (only in the case where that value * depends upon background-attachment (only in the case where that value
* is 'fixed') * is 'fixed')
* background-size * background-size
* depends upon background-break (for the background positioning area for * depends upon box-decoration-break (for the background positioning area
* resolving percentages), background-image (for the image's intrinsic * for resolving percentages), background-image (for the image's intrinsic
* size), background-repeat (if that value is 'round'), and * size), background-repeat (if that value is 'round'), and
* background-origin (for the background painting area, when * background-origin (for the background painting area, when
* background-repeat is 'round') * background-repeat is 'round')
* background-break * box-decoration-break
* depends upon background-origin (specifying how the boxes making up the * no dependencies
* background positioning area are determined)
* *
* As a result of only-if dependencies we don't strictly do a topological * As a result of only-if dependencies we don't strictly do a topological
* sort of the above properties when processing, but it's pretty close to one: * sort of the above properties when processing, but it's pretty close to one:
* *
* background-clip (by caller) * background-clip (by caller)
* background-image * background-image
* background-break, background-origin * box-decoration-break, background-origin
* background-attachment (postfix for background-{origin,break} if 'fixed') * background-attachment (postfix for background-origin if 'fixed')
* background-size * background-size
* background-position * background-position
* background-repeat * background-repeat
@ -3106,7 +3087,7 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
// it to compute the effective image size for a CSS gradient. // it to compute the effective image size for a CSS gradient.
nsRect bgPositioningArea = nsRect bgPositioningArea =
ComputeBackgroundPositioningArea(aPresContext, aForFrame, aBorderArea, ComputeBackgroundPositioningArea(aPresContext, aForFrame, aBorderArea,
aBackground, aLayer, &attachedToFrame); aLayer, &attachedToFrame);
// For background-attachment:fixed backgrounds, we'll limit the area // For background-attachment:fixed backgrounds, we'll limit the area
// where the background can be drawn to the viewport. // where the background can be drawn to the viewport.
@ -3176,13 +3157,13 @@ nsCSSRendering::GetBackgroundLayerRect(nsPresContext* aPresContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsRect& aClipRect, const nsRect& aClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer, const nsStyleBackground::Layer& aLayer,
uint32_t aFlags) uint32_t aFlags)
{ {
nsRect borderArea = ::BoxDecorationRectForBackground(aForFrame, aBorderArea);
nsBackgroundLayerState state = nsBackgroundLayerState state =
PrepareBackgroundLayer(aPresContext, aForFrame, aFlags, aBorderArea, PrepareBackgroundLayer(aPresContext, aForFrame, aFlags, borderArea,
aClipRect, aBackground, aLayer); aClipRect, aLayer);
return state.mFillArea; return state.mFillArea;
} }

View File

@ -456,7 +456,6 @@ struct nsCSSRendering {
ComputeBackgroundPositioningArea(nsPresContext* aPresContext, ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer, const nsStyleBackground::Layer& aLayer,
nsIFrame** aAttachedToFrame); nsIFrame** aAttachedToFrame);
@ -466,7 +465,6 @@ struct nsCSSRendering {
uint32_t aFlags, uint32_t aFlags,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsRect& aBGClipRect, const nsRect& aBGClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer); const nsStyleBackground::Layer& aLayer);
/** /**
@ -542,7 +540,6 @@ struct nsCSSRendering {
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsRect& aClipRect, const nsRect& aClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer, const nsStyleBackground::Layer& aLayer,
uint32_t aFlags); uint32_t aFlags);

View File

@ -1934,14 +1934,8 @@ nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuil
return false; return false;
nsBackgroundLayerState state = nsBackgroundLayerState state =
nsCSSRendering::PrepareBackgroundLayer(presContext, nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
mFrame, borderArea, aClipRect, layer);
flags,
borderArea,
aClipRect,
*mBackgroundStyle,
layer);
nsImageRenderer* imageRenderer = &state.mImageRenderer; nsImageRenderer* imageRenderer = &state.mImageRenderer;
// We only care about images here, not gradients. // We only care about images here, not gradients.
if (!imageRenderer->IsRasterImage()) if (!imageRenderer->IsRasterImage())
@ -1974,14 +1968,8 @@ nsDisplayBackgroundImage::TryOptimizeToImageLayer(LayerManager* aManager,
} }
nsBackgroundLayerState state = nsBackgroundLayerState state =
nsCSSRendering::PrepareBackgroundLayer(presContext, nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
mFrame, borderArea, borderArea, layer);
flags,
borderArea,
borderArea,
*mBackgroundStyle,
layer);
nsImageRenderer* imageRenderer = &state.mImageRenderer; nsImageRenderer* imageRenderer = &state.mImageRenderer;
// We only care about images here, not gradients. // We only care about images here, not gradients.
if (!imageRenderer->IsRasterImage()) if (!imageRenderer->IsRasterImage())
@ -2247,7 +2235,7 @@ nsDisplayBackgroundImage::GetPositioningArea()
return nsCSSRendering::ComputeBackgroundPositioningArea( return nsCSSRendering::ComputeBackgroundPositioningArea(
mFrame->PresContext(), mFrame, mFrame->PresContext(), mFrame,
nsRect(ToReferenceFrame(), mFrame->GetSize()), nsRect(ToReferenceFrame(), mFrame->GetSize()),
*mBackgroundStyle, mBackgroundStyle->mLayers[mLayer], mBackgroundStyle->mLayers[mLayer],
&attachedToFrame) + ToReferenceFrame(); &attachedToFrame) + ToReferenceFrame();
} }
@ -2361,8 +2349,7 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
} }
const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer]; const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame, return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
borderBox, clipRect, borderBox, clipRect, layer,
*mBackgroundStyle, layer,
aBuilder->GetBackgroundPaintFlags()); aBuilder->GetBackgroundPaintFlags());
} }

View File

@ -78,7 +78,7 @@ function foo()
<br style="clear: none;" id="br2"> <br style="clear: none;" id="br2">
<br style="height: auto; clear: both; width: auto;" id="br3"> <br style="height: auto; clear: both; width: auto;" id="br3">
<br style="position: static;" id="br4"> <br style="position: static;" id="br4">
<br style="background: yellow none repeat scroll 0% 0%; background-clip: initial; background-origin: initial; -moz-background-inline-policy: initial; display: inline;" id="br5"> <br style="background: yellow none repeat scroll 0% 0%; background-clip: initial; background-origin: initial; display: inline;" id="br5">
<br style="width: 1px; visibility: visible;" id="br6"> <br style="width: 1px; visibility: visible;" id="br6">
<br style="color: black; width: 2px; display: table-cell;" id="br7"> <br style="color: black; width: 2px; display: table-cell;" id="br7">
<table border="1"><tbody><tr style="display: list-item;" id="tableRow"><td>x</td></tr></tbody></table> <table border="1"><tbody><tr style="display: list-item;" id="tableRow"><td>x</td></tr></tbody></table>

View File

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-break: bounding-box</title>
<style type="text/css">
@font-face
{
font-family: Ahem;
src: url(../fonts/Ahem.ttf);
}
#outer
{
border: 1px solid black;
width: 10em;
}
#ahem-lines
{
font-family: Ahem;
font-size: 32px;
white-space: pre;
background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat;
-moz-background-inline-policy: bounding-box;
}
</style>
</head>
<body>
<div id="outer">
<span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL -->
<!-- EOL -->
<!-- EOL -->
</span></div>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>background-break: each-box</title> <title>box-decoration-break: clone</title>
<style type="text/css"> <style type="text/css">
@font-face @font-face
{ {
@ -21,14 +21,14 @@
white-space: pre; white-space: pre;
background-image: url(blue-8x20-green-8x20.png); background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat; background-repeat: no-repeat;
-moz-background-inline-policy: each-box; box-decoration-break: clone;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="outer"> <div id="outer">
<span id="ahem-lines"> <!-- EOL --> <span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL --> <!-- mix it up for clone --><!-- EOL -->
<!-- EOL --> <!-- EOL -->
<!-- EOL --> <!-- EOL -->
</span></div> </span></div>

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-size: cover; background-break: bounding-box</title>
<style type="text/css">
@font-face
{
font-family: Ahem;
src: url(../fonts/Ahem.ttf);
}
#outer
{
border: 1px solid black;
width: 10em;
}
#ahem-lines
{
font-family: Ahem;
font-size: 32px;
white-space: pre;
background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat;
background-size: cover;
-moz-background-inline-policy: bounding-box;
}
</style>
</head>
<body>
<div id="outer">
<span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL -->
<!-- EOL -->
<!-- EOL -->
</span></div>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>background-size: cover; background-break: each-box</title> <title>background-size: cover; box-decoration-break: clone</title>
<style type="text/css"> <style type="text/css">
@font-face @font-face
{ {
@ -22,14 +22,14 @@
background-image: url(blue-8x20-green-8x20.png); background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
-moz-background-inline-policy: each-box; box-decoration-break: clone;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="outer"> <div id="outer">
<span id="ahem-lines"> <!-- EOL --> <span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL --> <!-- mix it up for clone --><!-- EOL -->
<!-- EOL --> <!-- EOL -->
<!-- EOL --> <!-- EOL -->
</span></div> </span></div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>background-size: cover; background-break: continuous</title> <title>background-size: cover; box-decoration-break: slice</title>
<style type="text/css"> <style type="text/css">
@font-face @font-face
{ {
@ -22,14 +22,14 @@
background-image: url(blue-8x20-green-8x20.png); background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
-moz-background-inline-policy: continuous; box-decoration-break: slice;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="outer"> <div id="outer">
<span id="ahem-lines"> <!-- EOL --> <span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL --> <!-- mix it up for slice --><!-- EOL -->
<!-- EOL --> <!-- EOL -->
<!-- EOL --> <!-- EOL -->
</span></div> </span></div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>background-break: continuous</title> <title>box-decoration-break: slice</title>
<style type="text/css"> <style type="text/css">
@font-face @font-face
{ {
@ -21,14 +21,14 @@
white-space: pre; white-space: pre;
background-image: url(blue-8x20-green-8x20.png); background-image: url(blue-8x20-green-8x20.png);
background-repeat: no-repeat; background-repeat: no-repeat;
-moz-background-inline-policy: continuous; box-decoration-break: slice;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="outer"> <div id="outer">
<span id="ahem-lines"> <!-- EOL --> <span id="ahem-lines"> <!-- EOL -->
<!-- mix it up for each-box and bounding-box --><!-- EOL --> <!-- mix it up for slice --><!-- EOL -->
<!-- EOL --> <!-- EOL -->
<!-- EOL --> <!-- EOL -->
</span></div> </span></div>

View File

@ -90,19 +90,15 @@ fails-if(smallScreen&&Android) != background-size-body-contain-no-repeat.html ba
skip-if(B2G) == background-layers-1a.html background-layers-1-ref.html # bug 773482 skip-if(B2G) == background-layers-1a.html background-layers-1-ref.html # bug 773482
== background-layers-1b.html background-layers-1-ref.html == background-layers-1b.html background-layers-1-ref.html
# -moz-background-inline-policy is touchy and hard to test due to stretching # box-decoration-break's effect on backgrounds is touchy and hard to test due to stretching
# artifacts and the difficulty of covering exact lines, and its CSS3 analog is # artifacts and the difficulty of covering exact lines, so just make sure
# on the chopping block at the moment, so just make sure background-size results # background-size results in a different rendering when present.
# in a different rendering when present. pref(layout.css.box-decoration-break.enabled,true) != background-size-cover-slice.html background-size-slice.html
!= background-size-cover-continuous.html background-size-continuous.html pref(layout.css.box-decoration-break.enabled,true) != background-size-cover-clone.html background-size-clone.html
!= background-size-cover-each-box.html background-size-each-box.html
!= background-size-cover-bounding-box.html background-size-bounding-box.html
# ...and make sure each rendering with background-size is different from the # ...and make sure each rendering with background-size is different from the
# others # other
!= background-size-cover-continuous.html background-size-cover-each-box.html pref(layout.css.box-decoration-break.enabled,true) != background-size-cover-slice.html background-size-cover-clone.html
!= background-size-cover-continuous.html background-size-cover-bounding-box.html
!= background-size-cover-each-box.html background-size-cover-bounding-box.html
== background-size-monster-ch.html background-size-monster-ref.html == background-size-monster-ch.html background-size-monster-ref.html
== background-size-monster-cm.html background-size-monster-ref.html == background-size-monster-cm.html background-size-monster-ref.html

View File

@ -5,7 +5,7 @@
</head> </head>
<body style="line-height: 3; width: 500px; height: 250px;"> <body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: border-box; background-clip: border; background-origin: padding-box; background-origin: padding; margin: 7px 4px 2px 18px; border: 6px transparent solid; border-width: 2px 10px 15px 2px; -moz-background-inline-policy: continuous; background-inline-policy: continuous;"> <span style="background: url(repeatable-diagonal-gradient.png); background-clip: border-box; background-clip: border; background-origin: padding-box; background-origin: padding; margin: 7px 4px 2px 18px; border: 6px transparent solid; border-width: 2px 10px 15px 2px;">
blah<br> blah<br>
blah<br> blah<br>
blah blah

View File

@ -5,7 +5,7 @@
</head> </head>
<body style="line-height: 3; width: 500px; height: 250px;"> <body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: content-box; background-origin: content; border: medium transparent solid; border-width: 7px 4px 2px 18px; padding: 2px 2% 3% 2px; -moz-background-inline-policy: continuous; background-inline-policy: continuous;"> <span style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: content-box; background-origin: content; border: medium transparent solid; border-width: 7px 4px 2px 18px; padding: 2px 2% 3% 2px;">
blah<br> blah<br>
blah<br> blah<br>
blah blah

View File

@ -1,15 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Testcase, bug 368020</title>
</head>
<body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: border-box; background-clip: border; background-origin: padding-box; background-origin: padding; margin: 7px 4px 2px 18px; border: 6px transparent solid; border-width: 2px 10px 15px 2px; -moz-background-inline-policy: bounding-box; background-inline-policy: bounding-box;">
blah<br>
blah<br>
blah
</span>
</body>
</html>

View File

@ -1,15 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Testcase, bug 368020</title>
</head>
<body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: content-box; background-origin: content; border: medium transparent solid; border-width: 7px 4px 2px 18px; padding: 2px 2% 3% 2px; -moz-background-inline-policy: bounding-box; background-inline-policy: bounding-box;">
blah<br>
blah<br>
blah
</span>
</body>
</html>

View File

@ -5,7 +5,7 @@
</head> </head>
<body style="line-height: 3; width: 500px; height: 250px;"> <body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: border-box; background-clip: border; background-origin: padding-box; background-origin: padding; margin: 7px 4px 2px 18px; border: 6px transparent solid; border-width: 2px 10px 15px 2px; -moz-background-inline-policy: each-box; background-inline-policy: each-box;"> <span style="background: url(repeatable-diagonal-gradient.png); background-clip: border-box; background-clip: border; background-origin: padding-box; background-origin: padding; margin: 7px 4px 2px 18px; border: 6px transparent solid; border-width: 2px 10px 15px 2px; box-decoration-break: clone;">
blah<br> blah<br>
blah<br> blah<br>
blah blah

View File

@ -5,7 +5,7 @@
</head> </head>
<body style="line-height: 3; width: 500px; height: 250px;"> <body style="line-height: 3; width: 500px; height: 250px;">
<span style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: content-box; background-origin: content; border: medium transparent solid; border-width: 7px 4px 2px 18px; padding: 2px 10px 15px 2px; -moz-background-inline-policy: each-box; background-inline-policy: each-box;"> <span style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: content-box; background-origin: content; border: medium transparent solid; border-width: 7px 4px 2px 18px; padding: 2px 10px 15px 2px; box-decoration-break: clone;">
blah<br> blah<br>
blah<br> blah<br>
blah blah

View File

@ -596,8 +596,7 @@ skip-if(B2G) == 367247-l-scroll.html 367247-l-auto.html
skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == 368020-1.html 368020-1-ref.html skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == 368020-1.html 368020-1-ref.html
== 368020-2.html 368020-2-ref.html == 368020-2.html 368020-2-ref.html
fails == 368020-3.html 368020-3-ref.html # bug 368085 fails == 368020-3.html 368020-3-ref.html # bug 368085
fails == 368020-4.html 368020-4-ref.html # bug 368085 pref(layout.css.box-decoration-break.enabled,true) == 368020-5.html 368020-5-ref.html
== 368020-5.html 368020-5-ref.html
== 368155-1.xhtml 368155-1-ref.xhtml == 368155-1.xhtml 368155-1-ref.xhtml
asserts(4) == 368155-negative-margins-1.html 368155-negative-margins-1-ref.html # bug 387205 / bug 457397 asserts(4) == 368155-negative-margins-1.html 368155-negative-margins-1-ref.html # bug 387205 / bug 457397
# we can't test this because there's antialiasing involved, and our comparison # we can't test this because there's antialiasing involved, and our comparison