mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 811301. Part 1: Save and restore state of root scroll frame when reframing the root element, and treat root scroll frame state like any other frame. r=mats
This commit is contained in:
parent
eef569aa0e
commit
d38f22466b
@ -6925,6 +6925,14 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (aFrameState) {
|
||||
// Restore frame state for the root scroll frame if there is one
|
||||
nsIFrame* rootScrollFrame = mPresShell->GetRootScrollFrame();
|
||||
if (rootScrollFrame) {
|
||||
RestoreFrameStateFor(rootScrollFrame, aFrameState);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsAccessibilityService* accService = nsIPresShell::AccService();
|
||||
if (accService) {
|
||||
|
@ -2443,8 +2443,6 @@ PresShell::RestoreRootScrollPosition()
|
||||
if (scrollFrame) {
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(scrollFrame);
|
||||
if (scrollableFrame) {
|
||||
mFrameConstructor->RestoreFrameStateFor(scrollFrame, historyState,
|
||||
nsIStatefulFrame::eDocumentScrollState);
|
||||
scrollableFrame->ScrollToRestoredPosition();
|
||||
}
|
||||
}
|
||||
@ -3587,8 +3585,6 @@ PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, bool aLeavingPage
|
||||
if (aLeavingPage) {
|
||||
nsIFrame* scrollFrame = GetRootScrollFrame();
|
||||
if (scrollFrame) {
|
||||
mFrameConstructor->CaptureFrameStateFor(scrollFrame, historyState,
|
||||
nsIStatefulFrame::eDocumentScrollState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3864,12 +3864,6 @@ nsGfxScrollFrameInner::GetCoordAttribute(nsIFrame* aBox, nsIAtom* aAtom,
|
||||
nsPresState*
|
||||
nsGfxScrollFrameInner::SaveState(nsIStatefulFrame::SpecialStateID aStateID)
|
||||
{
|
||||
// Don't save "normal" state for the root scrollframe; that's
|
||||
// handled via the eDocumentScrollState state id
|
||||
if (mIsRoot && aStateID == nsIStatefulFrame::eNoID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame());
|
||||
if (mediator) {
|
||||
// child handles its own scroll state, so don't bother saving state here
|
||||
|
6
layout/reftests/bugs/811301-1-ref.html
Normal file
6
layout/reftests/bugs/811301-1-ref.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="overflow-y:hidden">
|
||||
<div style="height:10000px; width:100px; background:yellow; position:relative; top:-200px"></div>
|
||||
</body>
|
||||
</html>
|
11
layout/reftests/bugs/811301-1.html
Normal file
11
layout/reftests/bugs/811301-1.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<p>Hello
|
||||
<div style="height:10000px; width:100px; background:yellow"></div>
|
||||
<script>
|
||||
window.scrollTo(0,200);
|
||||
document.documentElement.setAttribute("style", "overflow-y:hidden");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1727,3 +1727,4 @@ fuzzy(40,800) == 797797-1.html 797797-1-ref.html # 'opacity:N' and rgba(,,,N) te
|
||||
fuzzy(40,800) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely
|
||||
== 801994-1.html 801994-1-ref.html
|
||||
== 804323-1.html 804323-1-ref.html
|
||||
== 811301-1.html 811301-1-ref.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user