Bug 1280344 - Use first continuation's normal position in computing sticky scroll ranges for APZ. r=dholbert

MozReview-Commit-ID: L0wRgCvb8h8
This commit is contained in:
Corey Ford 2016-07-12 12:36:31 -04:00
parent 4fd54506f8
commit 55d426b404
4 changed files with 98 additions and 4 deletions

View File

@ -270,9 +270,9 @@ void
StickyScrollContainer::GetScrollRanges(nsIFrame* aFrame, nsRect* aOuter,
nsRect* aInner) const
{
// We need to use the first in flow; ComputeStickyLimits requires
// this, at the very least because its call to
// nsLayoutUtils::GetAllInFlowRectsUnion requires it.
// We need to use the first in flow; continuation frames should not move
// relative to each other and should get identical scroll ranges.
// Also, ComputeStickyLimits requires this.
nsIFrame *firstCont =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
@ -283,7 +283,7 @@ StickyScrollContainer::GetScrollRanges(nsIFrame* aFrame, nsRect* aOuter,
aOuter->SetRect(nscoord_MIN/2, nscoord_MIN/2, nscoord_MAX, nscoord_MAX);
aInner->SetRect(nscoord_MIN/2, nscoord_MIN/2, nscoord_MAX, nscoord_MAX);
const nsPoint normalPosition = aFrame->GetNormalPosition();
const nsPoint normalPosition = firstCont->GetNormalPosition();
// Bottom and top
if (stick.YMost() != nscoord_MAX/2) {

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<link rel="author" title="Corey Ford" href="mailto:corey@coreyford.name">
<link rel="stylesheet" type="text/css" href="ahem.css">
<style>
#scroller {
margin-top: 100px;
height: 200px;
width: 500px;
overflow: hidden;
}
#container {
background: pink;
position: relative;
margin: 50px;
height: 400px;
margin-bottom: 1000px;
}
#sticky {
position: sticky;
left: 0px;
top: 75px;
outline: 1px dotted purple;
font: 10px/1 Ahem;
}
</style>
</head>
<body>
<div id="scroller">
<div id="container">
<span id="sticky">
First line<br>
Second line<br>
Third line<br>
</span>
</div>
</div>
<script>
document.getElementById("scroller").scrollTop = 30;
</script>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html reftest-async-scroll>
<head>
<title>CSS Test: Sticky Positioning - inline, async scrolling</title>
<link rel="author" title="Corey Ford" href="mailto:corey@coreyford.name">
<link rel="match" href="inline-4-ref.html">
<meta name="assert" content="Sticky positioning on inline elements should keep continuations aligned during async scrolling">
<link rel="stylesheet" type="text/css" href="ahem.css">
<style>
#scroller {
margin-top: 100px;
height: 200px;
width: 500px;
overflow: hidden;
}
#container {
background: pink;
position: relative;
margin: 50px;
height: 400px;
margin-bottom: 1000px;
}
#sticky {
position: sticky;
left: 0px;
top: 75px;
outline: 1px dotted purple;
font: 10px/1 Ahem;
}
</style>
</head>
<body>
<div id="scroller"
reftest-displayport-x="0" reftest-displayport-y="0"
reftest-displayport-w="500" reftest-displayport-h="300"
reftest-async-scroll-y="30">
<div id="container">
<span id="sticky">
First line<br>
Second line<br>
Third line<br>
</span>
</div>
</div>
</body>
</html>

View File

@ -40,6 +40,7 @@ fuzzy-if(Android,4,810) == containing-block-1.html containing-block-1-ref.html
== inline-1.html inline-1-ref.html
== inline-2.html inline-2-ref.html
fuzzy-if(OSX==1006||OSX==1007,64,100) fuzzy-if(OSX>=1008,99,210) == inline-3.html inline-3-ref.html
skip-if(!asyncPan) == inline-4.html inline-4-ref.html
fails == column-contain-1a.html column-contain-1-ref.html
== column-contain-1b.html column-contain-1-ref.html
== column-contain-2.html column-contain-2-ref.html