Bug 728111. Fix the block inside foreignObject to really be the absolute containing block for its kids. r=roc

This commit is contained in:
Boris Zbarsky 2012-02-21 18:01:40 -05:00
parent c64eafbf1e
commit d389408e85
5 changed files with 34 additions and 2 deletions

View File

@ -4952,8 +4952,10 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a
}
nsFrameItems childItems;
// Claim to be relatively positioned so that we end up being the
// We should be relatively positioned so that we end up being the
// absolute containing block.
const nsStyleDisplay* disp = innerPseudoStyle->GetStyleDisplay();
NS_ASSERTION(disp->IsPositioned(), "How did this get to not be positioned?");
rv = ConstructBlock(aState, innerPseudoStyle->GetStyleDisplay(), content,
newFrame, newFrame, innerPseudoStyle,
&blockFrame, childItems, true,

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<div style="height: 100px">
</div>
<svg width="200" height="200" style="overflow: visible">
<foreignObject width="200" height="200">
<div id="x" style="position:absolute; top: 0; left: 0">
This is a test
</div>
</foreignObject>
</svg>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<div style="height: 100px">
</div>
<svg width="200" height="200" style="overflow: visible">
<foreignObject width="200" height="200">
<div id="x" style="position:absolute; top: 0; left: 0">
This is a test
</div>
</foreignObject>
<script>
document.body.offsetWidth;
var kid = document.getElementById("x");
var parent = kid.parentNode;
var nextSibling = kid.nextSibling;
parent.removeChild(kid);
parent.insertBefore(kid, nextSibling);
</script>
</svg>

View File

@ -147,6 +147,7 @@ fails-if(Android) == filter-extref-differentOrigin-01.svg pass.svg # Bug 695385
== foreignObject-start-hidden-01.svg pass.svg # followup from Bug 596765
== foreignObject-start-hidden-02.svg pass.svg
== foreignObject-style-change-01.svg pass.svg
== foreignObject-dynamic-abspos-01.html foreignObject-dynamic-abspos-01-ref.html
== getElementById-a-element-01.svg pass.svg
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated) == gradient-live-01a.svg gradient-live-01-ref.svg # bug 696674
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated) == gradient-live-01b.svg gradient-live-01-ref.svg # bug 696674

View File

@ -64,6 +64,7 @@ foreignObject {
*|*::-moz-svg-foreign-content {
display: block !important;
position: static !important;
/* We need to be an absolute container */
position: relative !important;
text-indent: 0;
}