Bug 1228280 - Part 8. Keep style consistent and stop doing null check for return value of operator new

MozReview-Commit-ID: GoK0xuCWTP
This commit is contained in:
CJKu 2016-05-19 15:44:42 +08:00
Родитель 5e2e2b7e08
Коммит fb8594dce2
2 изменённых файлов: 24 добавлений и 16 удалений

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

@ -475,8 +475,6 @@ GetEffectProperty(nsIURI *aURI, nsIFrame *aFrame,
if (prop) if (prop)
return prop; return prop;
prop = aCreate(aURI, aFrame, false); prop = aCreate(aURI, aFrame, false);
if (!prop)
return nullptr;
NS_ADDREF(prop); NS_ADDREF(prop);
props.Set(aProperty, static_cast<nsISupports*>(prop)); props.Set(aProperty, static_cast<nsISupports*>(prop));
return prop; return prop;
@ -494,8 +492,6 @@ GetOrCreateFilterProperty(nsIFrame *aFrame)
if (prop) if (prop)
return prop; return prop;
prop = new nsSVGFilterProperty(effects->mFilters, aFrame); prop = new nsSVGFilterProperty(effects->mFilters, aFrame);
if (!prop)
return nullptr;
NS_ADDREF(prop); NS_ADDREF(prop);
props.Set(nsSVGEffects::FilterProperty(), prop); props.Set(nsSVGEffects::FilterProperty(), prop);
return prop; return prop;

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

@ -43,7 +43,8 @@ class nsSVGFilterChainObserver;
* constructor and destructor, which should call StartListening and * constructor and destructor, which should call StartListening and
* StopListening, respectively. * StopListening, respectively.
*/ */
class nsSVGRenderingObserver : public nsStubMutationObserver { class nsSVGRenderingObserver : public nsStubMutationObserver
{
protected: protected:
virtual ~nsSVGRenderingObserver() virtual ~nsSVGRenderingObserver()
@ -108,7 +109,8 @@ protected:
* object derived from nsSVGIDRenderingObserver to manage the relationship. The * object derived from nsSVGIDRenderingObserver to manage the relationship. The
* property object is attached to the referencing frame. * property object is attached to the referencing frame.
*/ */
class nsSVGIDRenderingObserver : public nsSVGRenderingObserver { class nsSVGIDRenderingObserver : public nsSVGRenderingObserver
{
public: public:
typedef mozilla::dom::Element Element; typedef mozilla::dom::Element Element;
nsSVGIDRenderingObserver(nsIURI* aURI, nsIContent* aObservingContent, nsSVGIDRenderingObserver(nsIURI* aURI, nsIContent* aObservingContent,
@ -121,7 +123,8 @@ protected:
// This is called when the referenced resource changes. // This is called when the referenced resource changes.
virtual void DoUpdate() override; virtual void DoUpdate() override;
class SourceReference : public nsReferencedElement { class SourceReference : public nsReferencedElement
{
public: public:
explicit SourceReference(nsSVGIDRenderingObserver* aContainer) : mContainer(aContainer) {} explicit SourceReference(nsSVGIDRenderingObserver* aContainer) : mContainer(aContainer) {}
protected: protected:
@ -169,7 +172,8 @@ private:
nsIPresShell *mFramePresShell; nsIPresShell *mFramePresShell;
}; };
class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver { class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver
{
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -200,7 +204,8 @@ protected:
* The nsSVGFilterChainObserver class manages a list of nsSVGFilterReferences. * The nsSVGFilterChainObserver class manages a list of nsSVGFilterReferences.
*/ */
class nsSVGFilterReference final : public nsSVGIDRenderingObserver class nsSVGFilterReference final : public nsSVGIDRenderingObserver
, public nsISVGFilterReference { , public nsISVGFilterReference
{
public: public:
nsSVGFilterReference(nsIURI* aURI, nsSVGFilterReference(nsIURI* aURI,
nsIContent* aObservingContent, nsIContent* aObservingContent,
@ -246,7 +251,8 @@ private:
* "blur(10px)" don't reference filter elements, so they don't need an * "blur(10px)" don't reference filter elements, so they don't need an
* nsSVGFilterReference. The style system invalidates changes to CSS filters. * nsSVGFilterReference. The style system invalidates changes to CSS filters.
*/ */
class nsSVGFilterChainObserver : public nsISupports { class nsSVGFilterChainObserver : public nsISupports
{
public: public:
nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters, nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters,
nsIContent* aFilteredElement); nsIContent* aFilteredElement);
@ -268,7 +274,8 @@ private:
nsTArray<RefPtr<nsSVGFilterReference>> mReferences; nsTArray<RefPtr<nsSVGFilterReference>> mReferences;
}; };
class nsSVGFilterProperty : public nsSVGFilterChainObserver { class nsSVGFilterProperty : public nsSVGFilterChainObserver
{
public: public:
nsSVGFilterProperty(const nsTArray<nsStyleFilter> &aFilters, nsSVGFilterProperty(const nsTArray<nsStyleFilter> &aFilters,
nsIFrame *aFilteredFrame) nsIFrame *aFilteredFrame)
@ -284,7 +291,8 @@ protected:
nsSVGFrameReferenceFromProperty mFrameReference; nsSVGFrameReferenceFromProperty mFrameReference;
}; };
class nsSVGMarkerProperty final : public nsSVGRenderingObserverProperty { class nsSVGMarkerProperty final: public nsSVGRenderingObserverProperty
{
public: public:
nsSVGMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage) nsSVGMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {} : nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
@ -293,7 +301,8 @@ protected:
virtual void DoUpdate() override; virtual void DoUpdate() override;
}; };
class nsSVGTextPathProperty final : public nsSVGRenderingObserverProperty { class nsSVGTextPathProperty final : public nsSVGRenderingObserverProperty
{
public: public:
nsSVGTextPathProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage) nsSVGTextPathProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) : nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage)
@ -313,7 +322,8 @@ private:
bool mValid; bool mValid;
}; };
class nsSVGPaintingProperty final : public nsSVGRenderingObserverProperty { class nsSVGPaintingProperty final : public nsSVGRenderingObserverProperty
{
public: public:
nsSVGPaintingProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage) nsSVGPaintingProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {} : nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
@ -356,7 +366,8 @@ private:
* via nsSVGContainerFrame::RemoveFrame, since only frames in the frame * via nsSVGContainerFrame::RemoveFrame, since only frames in the frame
* tree should be referenced. * tree should be referenced.
*/ */
class nsSVGRenderingObserverList { class nsSVGRenderingObserverList
{
public: public:
nsSVGRenderingObserverList() nsSVGRenderingObserverList()
: mObservers(4) : mObservers(4)
@ -402,7 +413,8 @@ private:
nsTHashtable<nsPtrHashKey<nsSVGRenderingObserver> > mObservers; nsTHashtable<nsPtrHashKey<nsSVGRenderingObserver> > mObservers;
}; };
class nsSVGEffects { class nsSVGEffects
{
public: public:
typedef mozilla::dom::Element Element; typedef mozilla::dom::Element Element;
typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver> typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver>