Bug 539949. Keep trying to scroll content into view even if it is clipped out. r=roc a=blocking-final+

This commit is contained in:
Timothy Nikkel 2010-11-24 19:35:01 -06:00
parent fb8abb6e9d
commit 76bebfc8a1
5 changed files with 28 additions and 16 deletions

View File

@ -4338,22 +4338,6 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
if (aFlags & nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY) {
break;
}
nsRect scrollPort = sf->GetScrollPortRect();
if (rect.XMost() < scrollPort.x ||
rect.x > scrollPort.XMost() ||
rect.YMost() < scrollPort.y ||
rect.y > scrollPort.YMost()) {
// We tried to show the rectangle, but none of it is visible,
// not even an edge.
// Stop trying to scroll ancestors into view.
break;
}
// Restrict rect to the area that is actually visible through
// the scrollport. We don't want to try to scroll some clipped-out
// part of 'rect' into view in some ancestor.
rect.IntersectRect(rect, sf->GetScrollPortRect());
}
rect += container->GetPosition();
nsIFrame* parent = container->GetParent();

View File

@ -0,0 +1,10 @@
<html>
<body>
<div style="height: 10000px;"></div>
<div style="position: relative;">
<div id="test2" style="position:absolute; top:-200px;"></div>
<div style="height: 100px; width: 100px; background: blue;"></div>
</div>
<div style="height: 10000px;"></div>
</body>
</html>

View File

@ -0,0 +1,10 @@
<html>
<body>
<div style="height: 10000px;"></div>
<div style="position: relative; overflow:hidden;">
<div id="test2" style="position:absolute; top:-200px;"></div>
<div style="height: 100px; width: 100px; background: blue;"></div>
</div>
<div style="height: 10000px;"></div>
</body>
</html>

View File

@ -1425,6 +1425,7 @@ asserts(5) == 528038-2.html 528038-2-ref.html # bug 512749
== 539323-3.html 539323-3-ref.html
== 539880-1.html 539880-1-ref.html
== 539880-1-dynamic.html 539880-1-ref.html
== 539949-1.html#test2 539949-1-ref.html#test2
== 541382-1.html 541382-1-ref.html
random-if(!haveTestPlugin) == 541406-1.html 541406-1-ref.html
!= 542116-1.html 542116-1-ref.html

View File

@ -155,9 +155,16 @@ function runTests()
image, "mousemove", "setCapture works on images");
synthesizeMouse(image, 2, 2, { type: "mouseup" });
// save scroll
var scrollX = parent ? parent.scrollX : 0;
var scrollY = parent ? parent.scrollY : 0;
var b = frames[0].document.getElementById("b");
runCaptureTest(b, selectionCallback);
// restore scroll
if (parent) parent.scroll(scrollX, scrollY);
frames[0].getSelection().collapseToStart();
var body = frames[0].document.body;