зеркало из https://github.com/mozilla/gecko-dev.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:
Родитель
76911df0d9
Коммит
e9685dd7dc
|
@ -987,6 +987,10 @@ nsSVGSVGElement::SetParentCoordCtxProvider(nsSVGCoordCtxProvider *parentCtx)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parentCtx == mCoordCtx) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
mCoordCtx = parentCtx;
|
mCoordCtx = parentCtx;
|
||||||
|
|
||||||
// set parent's mmPerPx on our coord contexts:
|
// set parent's mmPerPx on our coord contexts:
|
||||||
|
|
|
@ -207,6 +207,36 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGOuterSVGFrameBase)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// reflowing
|
// 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
|
NS_IMETHODIMP
|
||||||
nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
|
nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize,
|
nsHTMLReflowMetrics& aDesiredSize,
|
||||||
|
@ -306,7 +336,6 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
|
||||||
// Let's work out our desired dimensions.
|
// Let's work out our desired dimensions.
|
||||||
|
|
||||||
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
||||||
svg->SetParentCoordCtxProvider(this);
|
|
||||||
float width =
|
float width =
|
||||||
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].GetAnimValue(this);
|
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].GetAnimValue(this);
|
||||||
float height =
|
float height =
|
||||||
|
|
|
@ -68,6 +68,9 @@ private:
|
||||||
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
|
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
|
||||||
public:
|
public:
|
||||||
// nsIFrame:
|
// nsIFrame:
|
||||||
|
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||||
|
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||||
|
|
||||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize,
|
nsHTMLReflowMetrics& aDesiredSize,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче