зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
c70d3eba5f
Коммит
29c5a02e5c
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче