mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 13:25:00 +00:00
Bug 548792. When scrolling content into view, make sure to check scrollable elements in ancestor documents. r=mats
This commit is contained in:
parent
a27c78da5a
commit
1ea635776b
@ -4154,7 +4154,7 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
|
|||||||
rect.IntersectRect(rect, sf->GetScrollPortRect());
|
rect.IntersectRect(rect, sf->GetScrollPortRect());
|
||||||
}
|
}
|
||||||
rect += container->GetPosition();
|
rect += container->GetPosition();
|
||||||
container = container->GetParent();
|
container = nsLayoutUtils::GetCrossDocParentFrame(container);
|
||||||
} while (container);
|
} while (container);
|
||||||
|
|
||||||
return didScroll;
|
return didScroll;
|
||||||
|
@ -30,6 +30,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="height:400px;"></div>
|
<div style="height:400px;"></div>
|
||||||
</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">
|
<pre id="test">
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
@ -43,6 +54,9 @@ function testCollapsed(id, vPercent, startAt, expected) {
|
|||||||
|
|
||||||
var c = document.getElementById("c" + id);
|
var c = document.getElementById("c" + id);
|
||||||
var target = document.getElementById("target" + id);
|
var target = document.getElementById("target" + id);
|
||||||
|
if (target.contentDocument) {
|
||||||
|
target = target.contentDocument.getElementById("target" + id);
|
||||||
|
}
|
||||||
selection.collapse(target.parentNode, 0);
|
selection.collapse(target.parentNode, 0);
|
||||||
c.scrollTop = startAt;
|
c.scrollTop = startAt;
|
||||||
selection.scrollIntoView(FOCUS, true, vPercent, 0);
|
selection.scrollIntoView(FOCUS, true, vPercent, 0);
|
||||||
@ -78,6 +92,16 @@ function doTest() {
|
|||||||
// visible.
|
// visible.
|
||||||
testCollapsed("3", -1, 1000, 400);
|
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();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user