Fixing bug 367031. Implement nsSVGOuterSVGFrame::Get[Pref|Min]Width (at least well enough to get inline SVG in XUL working again). r=dbaron@mozilla.com, sr=tor@acm.org

This commit is contained in:
jwatt%jwatt.org 2007-01-18 00:17:35 +00:00
Родитель 76911df0d9
Коммит e9685dd7dc
3 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -987,6 +987,10 @@ nsSVGSVGElement::SetParentCoordCtxProvider(nsSVGCoordCtxProvider *parentCtx)
return NS_ERROR_FAILURE;
}
if (parentCtx == mCoordCtx) {
return NS_OK;
}
mCoordCtx = parentCtx;
// set parent's mmPerPx on our coord contexts:

Просмотреть файл

@ -207,6 +207,36 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGOuterSVGFrameBase)
//----------------------------------------------------------------------
// reflowing
/* virtual */ nscoord
nsSVGOuterSVGFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
float width =
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].GetAnimValue(this);
result = nscoord(width * GetTwipsPerPx());
return result;
}
/* virtual */ nscoord
nsSVGOuterSVGFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
float width =
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].GetAnimValue(this);
result = nscoord(width * GetTwipsPerPx());
return result;
}
NS_IMETHODIMP
nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -306,7 +336,6 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
// Let's work out our desired dimensions.
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
svg->SetParentCoordCtxProvider(this);
float width =
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].GetAnimValue(this);
float height =

Просмотреть файл

@ -68,6 +68,9 @@ private:
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
public:
// nsIFrame:
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,