Bug 387908 - Clean up nsSVGImageFrame.cpp: Remove an unused member variable, make constructor protected and report bad construction as an error. r+sr=tor

This commit is contained in:
longsonr%gmail.com 2007-07-13 09:32:37 +00:00
Родитель 6d0a97f8e0
Коммит a40fd1bcfc
1 изменённых файлов: 3 добавлений и 17 удалений

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

@ -37,7 +37,6 @@
#include "nsSVGPathGeometryFrame.h" #include "nsSVGPathGeometryFrame.h"
#include "nsIDOMSVGMatrix.h" #include "nsIDOMSVGMatrix.h"
#include "nsIDOMSVGAnimPresAspRatio.h" #include "nsIDOMSVGAnimPresAspRatio.h"
#include "nsIDOMSVGPresAspectRatio.h"
#include "imgIContainer.h" #include "imgIContainer.h"
#include "gfxIImageFrame.h" #include "gfxIImageFrame.h"
#include "nsStubImageDecoderObserver.h" #include "nsStubImageDecoderObserver.h"
@ -77,16 +76,15 @@ private:
class nsSVGImageFrame : public nsSVGPathGeometryFrame class nsSVGImageFrame : public nsSVGPathGeometryFrame
{ {
protected:
friend nsIFrame* friend nsIFrame*
NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext); NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
protected:
nsSVGImageFrame(nsStyleContext* aContext) : nsSVGPathGeometryFrame(aContext) {}
virtual ~nsSVGImageFrame(); virtual ~nsSVGImageFrame();
NS_IMETHOD InitSVG(); NS_IMETHOD InitSVG();
public: public:
nsSVGImageFrame(nsStyleContext* aContext) : nsSVGPathGeometryFrame(aContext) {}
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsRect *aDirtyRect); NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsRect *aDirtyRect);
NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit); NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit);
@ -121,8 +119,6 @@ public:
private: private:
already_AddRefed<nsIDOMSVGMatrix> GetImageTransform(); already_AddRefed<nsIDOMSVGMatrix> GetImageTransform();
nsCOMPtr<nsIDOMSVGPreserveAspectRatio> mPreserveAspectRatio;
nsCOMPtr<imgIDecoderObserver> mListener; nsCOMPtr<imgIDecoderObserver> mListener;
nsCOMPtr<imgIContainer> mImageContainer; nsCOMPtr<imgIContainer> mImageContainer;
@ -138,9 +134,7 @@ NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleConte
{ {
nsCOMPtr<nsIDOMSVGImageElement> Rect = do_QueryInterface(aContent); nsCOMPtr<nsIDOMSVGImageElement> Rect = do_QueryInterface(aContent);
if (!Rect) { if (!Rect) {
#ifdef DEBUG NS_ERROR("Can't create frame! Content is not an SVG image!");
printf("warning: trying to construct an SVGImageFrame for a content element that doesn't support the right interfaces\n");
#endif
return nsnull; return nsnull;
} }
@ -169,14 +163,6 @@ nsSVGImageFrame::InitSVG()
nsCOMPtr<nsIDOMSVGImageElement> Rect = do_QueryInterface(mContent); nsCOMPtr<nsIDOMSVGImageElement> Rect = do_QueryInterface(mContent);
NS_ASSERTION(Rect,"wrong content element"); NS_ASSERTION(Rect,"wrong content element");
{
nsCOMPtr<nsIDOMSVGAnimatedPreserveAspectRatio> ratio;
Rect->GetPreserveAspectRatio(getter_AddRefs(ratio));
ratio->GetAnimVal(getter_AddRefs(mPreserveAspectRatio));
NS_ASSERTION(mPreserveAspectRatio, "no preserveAspectRatio");
if (!mPreserveAspectRatio) return NS_ERROR_FAILURE;
}
mListener = new nsSVGImageListener(this); mListener = new nsSVGImageListener(this);
if (!mListener) return NS_ERROR_OUT_OF_MEMORY; if (!mListener) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent); nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);