Bug 539226. Ensure that when a scrollbar is added or removed the invalidation is not swallowed by the code that suppresses invalidation of hidden scrollbars. r=mats

This commit is contained in:
Robert O'Callahan 2010-01-14 15:30:06 +13:00
Родитель c20b3a582f
Коммит e9eefdc247
3 изменённых файлов: 30 добавлений и 5 удалений

Просмотреть файл

@ -2902,13 +2902,20 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
{
// When a child box changes shape of position, the parent
// is responsible for invalidation; the overflow rect must be invalidated
// to make sure to catch any overflow
// to make sure to catch any overflow.
// We invalidate the parent (i.e. the scrollframe) directly, because
// invalidates coming from scrollbars are suppressed by nsHTMLScrollFrame when
// mHasVScrollbar/mHasHScrollbar is false, and this is called after those
// flags have been set ... if a scrollbar is being hidden, we still need
// to invalidate the scrollbar area here.
PRBool rectChanged = aBox->GetRect() != aRect;
if (rectChanged)
aBox->Invalidate(aBox->GetOverflowRect());
if (rectChanged) {
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
}
nsBoxFrame::LayoutChildAt(aState, aBox, aRect);
if (rectChanged)
aBox->Invalidate(aBox->GetOverflowRect());
if (rectChanged) {
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
}
}
static void AdjustScrollbarRect(nsIFrame* aFrame, nsPresContext* aPresContext,

Просмотреть файл

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script>
function doTest() {
document.getElementById("inner").style.height = "0";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</head>
<body>
<div style="overflow:auto; width:100px; height:100px;">
<div id="inner" style="height:200px;"></div>
</div>
</body>
</html>

Просмотреть файл

@ -1375,3 +1375,4 @@ fails HTTP(..) == 518172-2b.html 518172-b-ref.html # bug 518172
== 537507-1.xul 537507-1-ref.xul
== 537507-2.html 537507-2-ref.html
== 537471-1.html 537471-1-ref.html
== 539226-1.html about:blank