Bug 601406 - GetBBox crashes when called on an SVG a element r=jwatt a=blocking-final

This commit is contained in:
Robert Longson 2010-10-08 17:49:39 +01:00
parent 8a60164429
commit 2ba0cb27b5
3 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>
<![CDATA[
function boom() { document.getElementById("a").getBBox(); }
window.addEventListener("load", boom, false);
]]>
</script>
<a id="a"/>
</svg>

After

Width:  |  Height:  |  Size: 202 B

View File

@ -51,3 +51,4 @@ load 573316-1.svg
load 579356-1.svg
load 579356-2.svg
load 595608-1.svg
load 601406-1.svg

View File

@ -1324,7 +1324,8 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame)
// filter to text. When one of these facilities is applied to text
// the bounding box is the entire text element in all
// cases.
nsSVGTextContainerFrame* metrics = do_QueryFrame(aFrame);
nsSVGTextContainerFrame* metrics = do_QueryFrame(
GetFirstNonAAncestorFrame(aFrame));
if (metrics) {
while (aFrame->GetType() != nsGkAtoms::svgTextFrame) {
aFrame = aFrame->GetParent();