зеркало из https://github.com/mozilla/gecko-dev.git
Bug 548792. When scrolling content into view, make sure to check scrollable elements in ancestor documents. r=mats
This commit is contained in:
Родитель
a27c78da5a
Коммит
1ea635776b
|
@ -4154,7 +4154,7 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
|
|||
rect.IntersectRect(rect, sf->GetScrollPortRect());
|
||||
}
|
||||
rect += container->GetPosition();
|
||||
container = container->GetParent();
|
||||
container = nsLayoutUtils::GetCrossDocParentFrame(container);
|
||||
} while (container);
|
||||
|
||||
return didScroll;
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
</div>
|
||||
<div style="height:400px;"></div>
|
||||
</div>
|
||||
<div id="c4" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:200px; left:600px;">
|
||||
<iframe id="target4" style="border:none; width:100%; height:1100px; display:block;"
|
||||
src="data:text/html,
|
||||
<body style='margin:0; overflow:hidden;'>
|
||||
<div style='height:400px;'></div>
|
||||
<div><span id='target4'
|
||||
style='display:inline-block; vertical-align:top; height:300px;'>target4</span>
|
||||
</div>
|
||||
<div style='height:400px;'></div>">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
@ -43,6 +54,9 @@ function testCollapsed(id, vPercent, startAt, expected) {
|
|||
|
||||
var c = document.getElementById("c" + id);
|
||||
var target = document.getElementById("target" + id);
|
||||
if (target.contentDocument) {
|
||||
target = target.contentDocument.getElementById("target" + id);
|
||||
}
|
||||
selection.collapse(target.parentNode, 0);
|
||||
c.scrollTop = startAt;
|
||||
selection.scrollIntoView(FOCUS, true, vPercent, 0);
|
||||
|
@ -78,6 +92,16 @@ function doTest() {
|
|||
// visible.
|
||||
testCollapsed("3", -1, 1000, 400);
|
||||
|
||||
// Test scrolling an element larger than the scrollport
|
||||
testCollapsed("4", 0, 0, 400);
|
||||
testCollapsed("4", 100, 0, 500);
|
||||
testCollapsed("4", -1, 0, 400);
|
||||
testCollapsed("4", 0, 1000, 400);
|
||||
testCollapsed("4", 100, 1000, 500);
|
||||
// If the element can't be completely visible, we make the top edge
|
||||
// visible.
|
||||
testCollapsed("4", -1, 1000, 400);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче