b=24998, background images spill beyond rounded borders; r+sr=roc

This commit is contained in:
vladimir@pobox.com 2007-12-18 12:59:48 -08:00
parent ffcc3e4673
commit f486de3a54
4 changed files with 62 additions and 25 deletions

View File

@ -3642,12 +3642,59 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
anchor.y += bgClipArea.y - aBorderArea.y;
}
#if (!defined(XP_UNIX) && !defined(XP_BEOS)) || defined(XP_MACOSX)
// Setup clipping so that rendering doesn't leak out of the computed
// dirty rect
aRenderingContext.PushState();
aRenderingContext.SetClipRect(dirtyRect, nsClipCombine_kIntersect);
#endif
nsRefPtr<gfxContext> ctx = (gfxContext*)
aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
ctx->Save();
nscoord appUnitsPerPixel = aPresContext->DevPixelsToAppUnits(1);
ctx->NewPath();
ctx->Rectangle(RectToGfxRect(dirtyRect, appUnitsPerPixel), PR_TRUE);
ctx->Clip();
nsStyleCoord bordStyleRadius[4];
nscoord borderRadii[4];
// get the radius for our border
aBorder.mBorderRadius.GetTop(bordStyleRadius[NS_SIDE_TOP]); // topleft
aBorder.mBorderRadius.GetRight(bordStyleRadius[NS_SIDE_RIGHT]); // topright
aBorder.mBorderRadius.GetBottom(bordStyleRadius[NS_SIDE_BOTTOM]); // bottomright
aBorder.mBorderRadius.GetLeft(bordStyleRadius[NS_SIDE_LEFT]); // bottomleft
PRBool haveRadius = PR_FALSE;
PRUint8 side = 0;
for (; side < 4; ++side) {
borderRadii[side] = 0;
switch (bordStyleRadius[side].GetUnit()) {
case eStyleUnit_Percent:
borderRadii[side] = nscoord(bordStyleRadius[side].GetPercentValue() *
aForFrame->GetSize().width);
break;
case eStyleUnit_Coord:
borderRadii[side] = bordStyleRadius[side].GetCoordValue();
break;
default:
break;
}
if (borderRadii[side] != 0)
haveRadius = PR_TRUE;
}
if (haveRadius) {
gfxFloat radii[4];
ComputePixelRadii(borderRadii, bgClipArea, aBorder.GetBorder(),
aForFrame ? aForFrame->GetSkipSides() : 0,
appUnitsPerPixel, radii);
gfxRect oRect(RectToGfxRect(bgClipArea, appUnitsPerPixel));
oRect.Round();
oRect.Condition();
ctx->NewPath();
DoRoundedRectCWSubPath(ctx, oRect, radii);
ctx->Clip();
}
// Compute the x and y starting points and limits for tiling
@ -3794,10 +3841,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
}
}
#if (!defined(XP_UNIX) && !defined(XP_BEOS)) || defined(XP_MACOSX)
// Restore clipping
aRenderingContext.PopState();
#endif
ctx->Restore();
}

View File

@ -6,9 +6,9 @@
div {
height: 100px;
width: 100px;
border: 10px solid black;
-moz-border-radius: 100px;
background-color: #00FF00;
border: 10px solid black;
-moz-border-radius: 100px;
background-color: #0000ff;
}
</style>
</head>

View File

@ -6,9 +6,10 @@
div {
height: 100px;
width: 100px;
border: 10px solid black;
border: 10px solid black;
-moz-border-radius: 100px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12Ng%2BM8AAAICAQCqKp4nAAAAAElFTkSuQmCC);
/* this must be bigger than 1x1 */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACEAIAAACtREYwAAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAACAAAAAgBqLH6AAAAAGUlEQVQI12NkYGBg+P+fgYGBgYGBiQEJAAApJQICMg0uAAAAAABJRU5ErkJggg==);
}
</style>
</head>

View File

@ -32,7 +32,7 @@
== 18217-zorder-5.html 18217-zorder-ref-inline-table.html
== 23604-1.html 23604-1-ref.html
== 23604-2.html 23604-2-ref.html
fails == 24998.html 24998-ref.html
== 24998-1.html 24998-1-ref.html
fails == 25888-1l.html 25888-1l-ref.html # bug 25888
fails != 25888-1l.html 25888-1l-notref.html # bug 25888
fails == 25888-1r.html 25888-1r-ref.html # bug 25888
@ -262,14 +262,6 @@ fails == 352980-1h.html 352980-1-ref.html
== 363329-2.html 363329-2-ref.html
== 363370-1.html 363370-1-ref.html
== 363637-1.html 363637-1-ref.html
== 363858-1.html 363858-1-ref.html
== 363858-2.html 363858-2-ref.html
== 363858-3.html 363858-3-ref.html
== 363858-4.html 363858-4-ref.html
== 363858-5a.html 363858-5-ref.html
== 363858-5b.html 363858-5-ref.html
== 363858-6a.html 363858-6-ref.html
== 363858-6b.html 363858-6-ref.html
== 363874.html 363874-ref.html
== 363874-max-width.html 363874-max-width-ref.html
== 364066-1.html 364066-1-ref.html
@ -518,7 +510,7 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 403656-3.html 403656-3-ref.html
== 403656-4.html 403656-4-ref.html
== 403656-5.html 403656-5-ref.html
#== 403657-1.html 403657-1-ref.html # Fails depending on the fonts...
== 403657-1.html 403657-1-ref.html
== 403733-1.html 403733-1-ref.html
== 403962-1.xhtml 403962-1-ref.xhtml
== 404180-1.html 404180-1-ref.html