зеркало из https://github.com/mozilla/pjs.git
Bug 551463. Don't clamp scroll positions during reflow, do it during a post-reflow callback so that temporary frame size changes don't clamp when they shouldn't. r=mats
This commit is contained in:
Родитель
7f5266d26e
Коммит
88e8d89f57
|
@ -800,8 +800,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
// oldScrollPosition is a multiple of device pixels. This could have been
|
||||
// thrown out by a zoom change.
|
||||
nsIntPoint ptDevPx;
|
||||
nsPoint oldScrollPosition =
|
||||
mInner.ClampAndRestrictToDevPixels(mInner.GetScrollPosition(), &ptDevPx);
|
||||
nsPoint oldScrollPosition = mInner.GetScrollPosition();
|
||||
|
||||
state.mComputedBorder = aReflowState.mComputedBorderPadding -
|
||||
aReflowState.mComputedPadding;
|
||||
|
@ -809,7 +808,10 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsresult rv = ReflowContents(&state, aDesiredSize);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
// Restore the old scroll position, for now, even if that's not valid anymore
|
||||
// because we changed size. We'll fix it up in a post-reflow callback, because
|
||||
// our current size may only be temporary (e.g. we're compute XUL desired sizes).
|
||||
PlaceScrollArea(state, oldScrollPosition);
|
||||
if (!mInner.mPostedReflowCallback) {
|
||||
// Make sure we'll try scrolling to restored position
|
||||
|
@ -1345,13 +1347,11 @@ nsGfxScrollFrameInner::AsyncScrollCallback(nsITimer *aTimer, void* anInstance)
|
|||
}
|
||||
|
||||
self->ScrollToImpl(destination);
|
||||
// 'self' may be a dangling pointer here since ScrollToImpl may have destroyed it
|
||||
} else {
|
||||
delete self->mAsyncScroll;
|
||||
self->mAsyncScroll = nsnull;
|
||||
|
||||
self->ScrollToImpl(self->mDestination);
|
||||
// 'self' may be a dangling pointer here since ScrollToImpl may have destroyed it
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2914,6 +2914,9 @@ nsGfxScrollFrameInner::ReflowFinished()
|
|||
|
||||
ScrollToRestoredPosition();
|
||||
|
||||
// Clamp scroll position
|
||||
ScrollToImpl(GetScrollPosition());
|
||||
|
||||
if (NS_SUBTREE_DIRTY(mOuter) || !mUpdateScrollbarAttributes)
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div style="display:-moz-box; width:400px;">
|
||||
<div id="d" style="overflow:auto; height:100px; width:400px; font-size:20px;">
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
<span style="font-size:22px;">Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.</span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var d = document.getElementById("d");
|
||||
d.scrollTop = 200;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div style="display:-moz-box; width:400px;">
|
||||
<div id="d" style="overflow:auto; height:100px; width:400px; font-size:20px;">
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
<span id="s">Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.
|
||||
Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty. Hello Kitty.</span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var d = document.getElementById("d");
|
||||
d.scrollTop = 200;
|
||||
/* Force the scrolled div d to be reflowed. We want to check that calculation
|
||||
of the XUL preferred width doesn't temporarily give d a small height
|
||||
and cause d to clamp the scroll position */
|
||||
var s = document.getElementById("s");
|
||||
s.style.fontSize = "22px";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1416,3 +1416,4 @@ random-if(!haveTestPlugin) == 541406-1.html 541406-1-ref.html
|
|||
random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
|
||||
== 549184-1.html 549184-1-ref.html
|
||||
== 550716-1.html 550716-1-ref.html
|
||||
== 551463-1.html 551463-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче