Make box-shadow cause only the overflow it needs and not add on additional overflow. (Bug 514917) r=roc

This commit is contained in:
L. David Baron 2009-12-13 19:40:55 -08:00
parent 8ca1bc583c
commit 861d7e40fa
4 changed files with 52 additions and 3 deletions

View File

@ -3814,6 +3814,7 @@ SetRectProperty(nsIFrame* aFrame, nsIAtom* aProp, const nsRect& aRect)
static nsRect
ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
const nsRect& aOverflowRect,
const nsSize& aNewSize,
PRBool aStoreRectProperties) {
nsRect r = aOverflowRect;
*aAnyOutlineOrEffects = PR_FALSE;
@ -3823,7 +3824,7 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
if (boxShadows) {
nsRect shadows;
for (PRUint32 i = 0; i < boxShadows->Length(); ++i) {
nsRect tmpRect = r;
nsRect tmpRect(nsPoint(0, 0), aNewSize);
nsCSSShadowItem* shadow = boxShadows->ShadowAt(i);
// inset shadows are never painted outside the frame
@ -3987,7 +3988,8 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
// Invalidate the entire old frame+outline if the frame has an outline
PRBool anyOutlineOrEffects;
nsRect r = ComputeOutlineAndEffectsRect(this, &anyOutlineOrEffects,
aOldOverflowRect, PR_FALSE);
aOldOverflowRect, aNewDesiredSize,
PR_FALSE);
if (anyOutlineOrEffects) {
r.UnionRect(aOldOverflowRect, r);
InvalidateRectForFrameSizeChange(this, r);
@ -5558,7 +5560,7 @@ nsIFrame::GetAdditionalOverflow(const nsRect& aOverflowArea,
{
nsRect overflowRect =
ComputeOutlineAndEffectsRect(this, aHasOutlineOrEffects,
aOverflowArea, PR_TRUE);
aOverflowArea, aNewSize, PR_TRUE);
// Absolute position clipping
PRBool hasAbsPosClip;

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<title>Testcase, bug 514917</title>
<style type="text/css">
body > div > div {
width: 100px;
height: 100px;
-moz-box-shadow: blue 50px 50px;
}
body > div > div > div {
width: 160px;
height: 160px;
border: medium solid;
}
</style>
<body>
<div><div><div></div></div></div>
</body>

View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<title>Testcase, bug 514917</title>
<style type="text/css">
body > div {
overflow: auto; /* to detect too much overflow, which is the bug here */
width: 200px;
height: 200px;
}
body > div > div {
width: 100px;
height: 100px;
-moz-box-shadow: blue 50px 50px;
}
body > div > div > div {
width: 160px;
height: 160px;
border: medium solid;
}
</style>
<body>
<div><div><div></div></div></div>
</body>

View File

@ -1329,6 +1329,7 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
== 513318-1.xul 513318-1-ref.xul
!= 513318-2.xul 513318-2-ref.xul
!= 513318-3.xul 513318-3-ref.xul
== 514917-1.html 514917-1-ref.html
== 520421-1.html 520421-1-ref.html
== 520563-1.xhtml 520563-1-ref.xhtml
== 521525-1.html 521525-1-ref.html