mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Make scrolling work inside iframe inside transformed svg:foreignObject by using GetCrossDocParentFrame for loop in check for whether we can blit. (Bug 403443) r=roc
This commit is contained in:
parent
6f5af267a2
commit
bf87da1b16
@ -128,6 +128,32 @@ iframe {
|
||||
<div style="height:300px; background:-moz-linear-gradient(top, red, black);"></div>
|
||||
</div>
|
||||
|
||||
<iframe class="testcase" id="testNoBlitInSVG" height="200" width="200"
|
||||
src="data:text/html,<body class='testcase' style='margin:0; height:300px; background:-moz-linear-gradient(top, red, black);'>">
|
||||
</iframe>
|
||||
<script>
|
||||
// We're not in XHTML, so we have to make our SVG elements with script.
|
||||
var SVG_NS = "http://www.w3.org/2000/svg";
|
||||
var svg = document.createElementNS(SVG_NS, "svg");
|
||||
svg.setAttribute("style", "width: 300px; height: 300px");
|
||||
var g = document.createElementNS(SVG_NS, "g");
|
||||
g.setAttribute("transform", "translate(100,0) rotate(30)");
|
||||
var fo = document.createElementNS(SVG_NS, "foreignObject");
|
||||
fo.setAttribute("x", "0");
|
||||
fo.setAttribute("y", "0");
|
||||
fo.setAttribute("width", "200");
|
||||
fo.setAttribute("height", "200");
|
||||
var iframe = document.getElementById("testNoBlitInSVG");
|
||||
iframe.parentNode.replaceChild(svg, iframe);
|
||||
fo.appendChild(iframe);
|
||||
g.appendChild(fo);
|
||||
svg.appendChild(g);
|
||||
</script>
|
||||
|
||||
<iframe class="testcase" id="testNoBlitInTransform" height="200" width="200" style="-moz-transform-origin: 0 0; -moz-transform: translateX(100px) rotate(30deg)"
|
||||
src="data:text/html,<body class='testcase' style='margin:0; height:300px; background:-moz-linear-gradient(top, red, black);'>">
|
||||
</iframe>
|
||||
|
||||
<script>
|
||||
var testcases = document.querySelectorAll("div.testcase");
|
||||
var tests = [];
|
||||
@ -309,11 +335,41 @@ function testTableNoBackground(blitRegion, paintRegion) {
|
||||
"Should repaint area that was scrolled into view: " + paintRegion.toString());
|
||||
}
|
||||
|
||||
function testNoBlitInSVG(blitRegion, paintRegion) {
|
||||
ok(blitRegion.isEmpty(), "should not blit when in transformed SVG");
|
||||
// We're looking at regions in the coordinates of the inner iframe.
|
||||
// (Not the most useful test, but it does test the particular bug that we
|
||||
// should be repainting rather than blitting.)
|
||||
ok(paintRegion.equalsRegion(new Region([[0,0,200,200]])),
|
||||
"repaint rect must contain area completely inside scrolled region");
|
||||
}
|
||||
|
||||
function testNoBlitInTransform(blitRegion, paintRegion) {
|
||||
ok(blitRegion.isEmpty(), "should not blit when in CSS Transform");
|
||||
// We're looking at regions in the coordinates of the inner iframe.
|
||||
// (Not the most useful test, but it does test the particular bug that we
|
||||
// should be repainting rather than blitting.)
|
||||
ok(paintRegion.equalsRegion(new Region([[0,0,200,200]])),
|
||||
"repaint rect must contain area completely inside scrolled region");
|
||||
}
|
||||
|
||||
function clientRectToRect(cr)
|
||||
{
|
||||
return [cr.left, cr.top, cr.right, cr.bottom];
|
||||
}
|
||||
|
||||
// Return the ancestor-or-self of |container| that is a child of body.
|
||||
function bodyChild(container)
|
||||
{
|
||||
var prev;
|
||||
var next = container;
|
||||
do {
|
||||
prev = next;
|
||||
next = prev.parentNode;
|
||||
} while (next != document.body);
|
||||
return prev;
|
||||
}
|
||||
|
||||
function regionForReason(requests, reason)
|
||||
{
|
||||
var rects = [];
|
||||
@ -347,7 +403,7 @@ function afterPaint(event) {
|
||||
} else {
|
||||
testFunc(blitRegion, paintRegion);
|
||||
}
|
||||
tests[currentTest].container.style.display = 'none';
|
||||
bodyChild(tests[currentTest].container).style.display = 'none';
|
||||
|
||||
nextTest();
|
||||
}
|
||||
@ -360,7 +416,7 @@ function nextTest() {
|
||||
}
|
||||
|
||||
var t = tests[currentTest];
|
||||
t.container.style.display = "";
|
||||
bodyChild(t.container).style.display = "";
|
||||
setTimeout(function() {
|
||||
if (t.scrollable.getAttribute("class").match(/horizontal/)) {
|
||||
t.scrollable.scrollLeft = 20;
|
||||
@ -380,7 +436,7 @@ function runTests() {
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
var t = tests[i];
|
||||
t.container.style.display = "none";
|
||||
bodyChild(t.container).style.display = "none";
|
||||
// Make sure we don't remember a scroll position from history
|
||||
t.scrollable.scrollTop = 0;
|
||||
t.scrollable.scrollLeft = 0;
|
||||
|
@ -1598,7 +1598,7 @@ SortBlitRectsForCopy(nsIntPoint aPixDelta, nsTArray<nsIntRect>* aRects)
|
||||
static PRBool
|
||||
CanScrollWithBlitting(nsIFrame* aFrame)
|
||||
{
|
||||
for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
|
||||
for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
|
||||
if (f->GetStyleDisplay()->HasTransform()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user