Bug 885009. Handle clip-all-descendants cases with rounded corners. r=mats

--HG--
extra : rebase_source : 284587e5fa70532bc6435f987f03c1282edc9cb8
This commit is contained in:
Robert O'Callahan 2013-07-26 13:36:05 +12:00
parent 269f816a9e
commit 71ed3a62d3
5 changed files with 22 additions and 12 deletions

View File

@ -53,9 +53,14 @@ DisplayListClipState::ClipContainingBlockDescendants(const nsRect& aRect,
void
DisplayListClipState::ClipContentDescendants(const nsRect& aRect,
const nscoord* aRadii,
DisplayItemClip& aClipOnStack)
{
aClipOnStack.SetTo(aRect);
if (aRadii) {
aClipOnStack.SetTo(aRect, aRadii);
} else {
aClipOnStack.SetTo(aRect);
}
if (mClipContentDescendants) {
aClipOnStack.IntersectWith(*mClipContentDescendants);
}

View File

@ -79,6 +79,7 @@ private:
DisplayItemClip& aClipOnStack);
void ClipContentDescendants(const nsRect& aRect,
const nscoord* aRadii,
DisplayItemClip& aClipOnStack);
/**
@ -150,7 +151,7 @@ public:
* the result, stored in aClipOnStack.
*/
void ClipContainingBlockDescendants(const nsRect& aRect,
const nscoord* aRadii)
const nscoord* aRadii = nullptr)
{
NS_ASSERTION(!mRestored, "Already restored!");
NS_ASSERTION(!mClipUsed, "mClip already used");
@ -158,12 +159,13 @@ public:
mState.ClipContainingBlockDescendants(aRect, aRadii, mClip);
}
void ClipContentDescendants(const nsRect& aRect)
void ClipContentDescendants(const nsRect& aRect,
const nscoord* aRadii = nullptr)
{
NS_ASSERTION(!mRestored, "Already restored!");
NS_ASSERTION(!mClipUsed, "mClip already used");
mClipUsed = true;
mState.ClipContentDescendants(aRect, mClip);
mState.ClipContentDescendants(aRect, aRadii, mClip);
}
/**

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body style="display: -moz-inline-stack; overflow: scroll; border-style: solid; border-radius: 4px;"></body>
</html>

View File

@ -497,3 +497,4 @@ test-pref(layout.css.flexbox.enabled,true) load 862947-1.html
needs-focus pref(accessibility.browsewithcaret,true) load 868906.html
test-pref(layout.css.flexbox.enabled,true) load 866547-1.html
asserts(1-4) test-pref(layout.css.flexbox.enabled,true) load 876074-1.html # bug 876749
load 885009-1.html

View File

@ -2251,18 +2251,13 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
} else {
nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
nscoord radii[8];
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
// Our override of GetBorderRadii ensures we never have a radius at
// the corners where we have a scrollbar.
if (mClipAllDescendants) {
#ifdef DEBUG
nscoord radii[8];
#endif
NS_ASSERTION(!mOuter->GetPaddingBoxBorderRadii(radii),
"Roots with radii not supported");
clipState.ClipContentDescendants(clip);
clipState.ClipContentDescendants(clip, haveRadii ? radii : nullptr);
} else {
nscoord radii[8];
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
clipState.ClipContainingBlockDescendants(clip, haveRadii ? radii : nullptr);
}
}