Fixing
bug 382325. SVG should fall back to 300px x 150px as per CSS 2.1 section 10.3.2. r=longsonr@gmail.com, sr=tor@acm.org, a1.9=beltzner@mozilla.com
--- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
@@ -223,17 +223,19 @@ nsSVGOuterSVGFrame::GetPrefWidth(nsIRend
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent);
nsSVGLength2 &width = svg->mLengthAttributes[nsSVGSVGElement::WIDTH];
if (width.IsPercentage()) {
- result = nscoord(0);
+ // If we're being called then our containing block's width depends on our
+ // width - fall back to 300px as required by CSS 2.1 section 10.3.2:
+ result = nsPresContext::CSSPixelsToAppUnits(300);
} else {
result = nsPresContext::CSSPixelsToAppUnits(width.GetAnimValue(svg));
if (result < 0) {
result = nscoord(0);
}
}
return result;