mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 449324. When an element has a solid border, clip background painting to the padding-rect so we don't bother trying to tile a repeating background under the border area. r+sr=vlad
This commit is contained in:
parent
3d9c20e3a8
commit
c93b3201af
@ -1410,6 +1410,36 @@ PixelSnapPoint(gfxContext* aContext, nsIDeviceContext *aDC, nsPoint& aPoint)
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsSolidBorderEdge(const nsStyleBorder& aBorder, PRUint32 aSide)
|
||||
{
|
||||
if (aBorder.GetActualBorder().side(aSide) == 0)
|
||||
return PR_TRUE;
|
||||
if (aBorder.GetBorderStyle(aSide) != NS_STYLE_BORDER_STYLE_SOLID)
|
||||
return PR_FALSE;
|
||||
|
||||
nscolor color;
|
||||
PRBool isTransparent;
|
||||
PRBool isForeground;
|
||||
aBorder.GetBorderColor(aSide, color, isTransparent, isForeground);
|
||||
return !isTransparent && NS_GET_A(color) == 255;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all border edges are either missing or opaque.
|
||||
*/
|
||||
static PRBool
|
||||
IsSolidBorder(const nsStyleBorder& aBorder)
|
||||
{
|
||||
if (nsLayoutUtils::HasNonZeroSide(aBorder.mBorderRadius) || aBorder.mBorderColors)
|
||||
return PR_FALSE;
|
||||
for (PRUint32 i = 0; i < 4; ++i) {
|
||||
if (!IsSolidBorderEdge(aBorder, i))
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
@ -1454,9 +1484,10 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
else {
|
||||
// The background is rendered over the 'background-clip' area.
|
||||
bgClipArea = aBorderArea;
|
||||
if (aColor.mBackgroundClip != NS_STYLE_BG_CLIP_BORDER) {
|
||||
NS_ASSERTION(aColor.mBackgroundClip == NS_STYLE_BG_CLIP_PADDING,
|
||||
"unknown background-clip value");
|
||||
// If the border is solid, then clip the background to the padding-box
|
||||
// so that we don't draw unnecessary tiles.
|
||||
if (aColor.mBackgroundClip != NS_STYLE_BG_CLIP_BORDER ||
|
||||
IsSolidBorder(aBorder)) {
|
||||
nsMargin border = aForFrame->GetUsedBorder();
|
||||
aForFrame->ApplySkipSides(border);
|
||||
bgClipArea.Deflate(border);
|
||||
|
Loading…
Reference in New Issue
Block a user