--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -470,18 +470,16 @@ GetEffectProperty(nsIURI *aURI, nsIFrame
return nullptr;
FrameProperties props = aFrame->Properties();
nsSVGRenderingObserver *prop =
static_cast<nsSVGRenderingObserver*>(props.Get(aProperty));
if (prop)
return prop;
prop = aCreate(aURI, aFrame, false);
- if (!prop)
- return nullptr;
NS_ADDREF(prop);
props.Set(aProperty, static_cast<nsISupports*>(prop));
return prop;
}
static nsSVGFilterProperty*
GetOrCreateFilterProperty(nsIFrame *aFrame)
{
@@ -489,18 +487,16 @@ GetOrCreateFilterProperty(nsIFrame *aFra
if (!effects->HasFilters())
return nullptr;
FrameProperties props = aFrame->Properties();
nsSVGFilterProperty *prop = props.Get(nsSVGEffects::FilterProperty());
if (prop)
return prop;
prop = new nsSVGFilterProperty(effects->mFilters, aFrame);
- if (!prop)
- return nullptr;
NS_ADDREF(prop);
props.Set(nsSVGEffects::FilterProperty(), prop);
return prop;
}
static nsSVGMaskProperty*
GetOrCreateMaskProperty(nsIFrame *aFrame)
{
--- a/layout/svg/nsSVGEffects.h
+++ b/layout/svg/nsSVGEffects.h
@@ -38,17 +38,18 @@ class nsSVGFilterChainObserver;
*
* Concrete implementations of this interface need to implement
* "GetTarget()" to specify the piece of SVG content that they'd like to
* monitor, and they need to implement "DoUpdate" to specify how we'll react
* when that content gets re-rendered. They also need to implement a
* constructor and destructor, which should call StartListening and
* StopListening, respectively.
*/
-class nsSVGRenderingObserver : public nsStubMutationObserver {
+class nsSVGRenderingObserver : public nsStubMutationObserver
+{
protected:
virtual ~nsSVGRenderingObserver()
{}
public:
typedef mozilla::dom::Element Element;
nsSVGRenderingObserver()
@@ -103,30 +104,32 @@ protected:
* track when those resources change and when the DOM changes in ways
* that affect which element is referenced by a given ID (e.g., when
* element IDs change). The code here is responsible for that.
*
* When a frame references a supporting resource, we create a property
* object derived from nsSVGIDRenderingObserver to manage the relationship. The
* property object is attached to the referencing frame.
*/
-class nsSVGIDRenderingObserver : public nsSVGRenderingObserver {
+class nsSVGIDRenderingObserver : public nsSVGRenderingObserver
+{
public:
typedef mozilla::dom::Element Element;
nsSVGIDRenderingObserver(nsIURI* aURI, nsIContent* aObservingContent,
bool aReferenceImage);
virtual ~nsSVGIDRenderingObserver();
protected:
Element* GetTarget() override { return mElement.get(); }
// This is called when the referenced resource changes.
virtual void DoUpdate() override;
- class SourceReference : public nsReferencedElement {
+ class SourceReference : public nsReferencedElement
+ {
public:
explicit SourceReference(nsSVGIDRenderingObserver* aContainer) : mContainer(aContainer) {}
protected:
virtual void ElementChanged(Element* aFrom, Element* aTo) override {
mContainer->StopListening();
nsReferencedElement::ElementChanged(aFrom, aTo);
mContainer->StartListening();
mContainer->DoUpdate();
@@ -164,17 +167,18 @@ private:
// the presshell for the frames we care about and, before we use the frame,
// we test the presshell to see if it's destroying itself. If it is,
// then the frame pointer is not valid and we know the frame has gone away.
// mFramePresShell may be null, but when mFrame is non-null, mFramePresShell
// is guaranteed to be non-null, too.
nsIPresShell *mFramePresShell;
};
-class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver {
+class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver
+{
public:
NS_DECL_ISUPPORTS
nsSVGRenderingObserverProperty(nsIURI* aURI, nsIFrame *aFrame,
bool aReferenceImage)
: nsSVGIDRenderingObserver(aURI, aFrame->GetContent(), aReferenceImage)
, mFrameReference(aFrame)
{}
@@ -195,17 +199,18 @@ protected:
* e.g. url(#svg-filter-1)
*
* It fires invalidations when the SVG filter element's id changes or when
* the SVG filter element's content changes.
*
* The nsSVGFilterChainObserver class manages a list of nsSVGFilterReferences.
*/
class nsSVGFilterReference final : public nsSVGIDRenderingObserver
- , public nsISVGFilterReference {
+ , public nsISVGFilterReference
+{
public:
nsSVGFilterReference(nsIURI* aURI,
nsIContent* aObservingContent,
nsSVGFilterChainObserver* aFilterChainObserver)
: nsSVGIDRenderingObserver(aURI, aObservingContent, false)
, mFilterChainObserver(aFilterChainObserver)
{
}
@@ -241,17 +246,18 @@ private:
* reference filters in a filter chain.
* e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);
*
* In the above example, the nsSVGFilterChainObserver will manage two
* nsSVGFilterReferences, one for each SVG reference filter. CSS filters like
* "blur(10px)" don't reference filter elements, so they don't need an
* nsSVGFilterReference. The style system invalidates changes to CSS filters.
*/
-class nsSVGFilterChainObserver : public nsISupports {
+class nsSVGFilterChainObserver : public nsISupports
+{
public:
nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters,
nsIContent* aFilteredElement);
bool ReferencesValidResources();
bool IsInObserverLists() const;
void Invalidate() { DoUpdate(); }
@@ -263,42 +269,45 @@ protected:
virtual ~nsSVGFilterChainObserver();
virtual void DoUpdate() = 0;
private:
nsTArray<RefPtr<nsSVGFilterReference>> mReferences;
};
-class nsSVGFilterProperty : public nsSVGFilterChainObserver {
+class nsSVGFilterProperty : public nsSVGFilterChainObserver
+{
public:
nsSVGFilterProperty(const nsTArray<nsStyleFilter> &aFilters,
nsIFrame *aFilteredFrame)
: nsSVGFilterChainObserver(aFilters, aFilteredFrame->GetContent())
, mFrameReference(aFilteredFrame)
{}
void DetachFromFrame() { mFrameReference.Detach(); }
protected:
virtual void DoUpdate() override;
nsSVGFrameReferenceFromProperty mFrameReference;
};
-class nsSVGMarkerProperty final : public nsSVGRenderingObserverProperty {
+class nsSVGMarkerProperty final: public nsSVGRenderingObserverProperty
+{
public:
nsSVGMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
protected:
virtual void DoUpdate() override;
};
-class nsSVGTextPathProperty final : public nsSVGRenderingObserverProperty {
+class nsSVGTextPathProperty final : public nsSVGRenderingObserverProperty
+{
public:
nsSVGTextPathProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage)
, mValid(true) {}
virtual bool ObservesReflow() override { return false; }
protected:
@@ -308,17 +317,18 @@ private:
/**
* Returns true if the target of the textPath is the frame of a 'path' element.
*/
bool TargetIsValid();
bool mValid;
};
-class nsSVGPaintingProperty final : public nsSVGRenderingObserverProperty {
+class nsSVGPaintingProperty final : public nsSVGRenderingObserverProperty
+{
public:
nsSVGPaintingProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
protected:
virtual void DoUpdate() override;
};
@@ -351,17 +361,18 @@ private:
* is needed, and then at paint time the observer will do a clean lookup
* of the referenced element and [re-]add itself to the element's observer list.
*
* InvalidateAll must be called before this object is destroyed, i.e.
* before the referenced frame is destroyed. This should normally happen
* via nsSVGContainerFrame::RemoveFrame, since only frames in the frame
* tree should be referenced.
*/
-class nsSVGRenderingObserverList {
+class nsSVGRenderingObserverList
+{
public:
nsSVGRenderingObserverList()
: mObservers(4)
{
MOZ_COUNT_CTOR(nsSVGRenderingObserverList);
}
~nsSVGRenderingObserverList() {
@@ -397,17 +408,18 @@ public:
* to them.
*/
void RemoveAll();
private:
nsTHashtable<nsPtrHashKey<nsSVGRenderingObserver> > mObservers;
};
-class nsSVGEffects {
+class nsSVGEffects
+{
public:
typedef mozilla::dom::Element Element;
typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver>
URIObserverHashtable;
using ObserverPropertyDescriptor =
const mozilla::FramePropertyDescriptor<nsISupports>*;
using URIObserverHashtablePropertyDescriptor =