2008-08-07 18:34:43 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Mozilla SVG project.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is IBM Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* rocallahan@mozilla.com
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef NSSVGEFFECTS_H_
|
|
|
|
#define NSSVGEFFECTS_H_
|
|
|
|
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsReferencedElement.h"
|
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2010-08-13 06:30:45 -07:00
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
#include "nsURIHashKey.h"
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
class nsSVGClipPathFrame;
|
|
|
|
class nsSVGFilterFrame;
|
|
|
|
class nsSVGMaskFrame;
|
|
|
|
|
|
|
|
/*
|
2010-09-08 13:40:39 -07:00
|
|
|
* This interface allows us to be notified when a piece of SVG content is
|
|
|
|
* re-rendered.
|
|
|
|
*
|
|
|
|
* 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.
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
|
|
|
class nsSVGRenderingObserver : public nsStubMutationObserver {
|
2008-08-07 18:34:43 -07:00
|
|
|
public:
|
2010-08-13 06:31:31 -07:00
|
|
|
typedef mozilla::dom::Element Element;
|
2010-09-08 13:40:39 -07:00
|
|
|
nsSVGRenderingObserver()
|
2011-10-17 07:59:28 -07:00
|
|
|
: mInObserverList(false)
|
2010-09-08 13:40:39 -07:00
|
|
|
{}
|
|
|
|
virtual ~nsSVGRenderingObserver()
|
|
|
|
{}
|
2008-08-07 18:34:43 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2010-08-13 06:31:31 -07:00
|
|
|
void InvalidateViaReferencedElement();
|
2010-11-16 10:35:59 -08:00
|
|
|
|
|
|
|
// When a nsSVGRenderingObserver list gets forcibly cleared, it uses this
|
|
|
|
// callback to notify every observer that's cleared from it, so they can
|
|
|
|
// react.
|
|
|
|
void NotifyEvictedFromRenderingObserverList();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsInObserverList() const { return mInObserverList; }
|
2010-09-08 13:40:39 -07:00
|
|
|
|
2010-12-19 09:47:01 -08:00
|
|
|
nsIFrame* GetReferencedFrame();
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* @param aOK this is only for the convenience of callers. We set *aOK to false
|
2010-12-19 09:47:01 -08:00
|
|
|
* if the frame is the wrong type
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIFrame* GetReferencedFrame(nsIAtom* aFrameType, bool* aOK);
|
2008-09-30 17:51:05 -07:00
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
Element* GetReferencedElement();
|
|
|
|
|
2008-08-07 18:34:43 -07:00
|
|
|
protected:
|
2010-09-08 13:40:39 -07:00
|
|
|
// Non-virtual protected methods
|
2010-08-13 06:31:31 -07:00
|
|
|
void StartListening();
|
|
|
|
void StopListening();
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
// Virtual protected methods
|
|
|
|
virtual void DoUpdate() = 0; // called when the referenced resource changes.
|
|
|
|
|
|
|
|
// This is an internally-used version of GetReferencedElement that doesn't
|
|
|
|
// forcibly add us as an observer. (whereas GetReferencedElement does)
|
|
|
|
virtual Element* GetTarget() = 0;
|
|
|
|
|
|
|
|
// Whether we're in our referenced element's observer list at this time.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mInObserverList;
|
2010-09-08 13:40:39 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SVG elements reference supporting resources by element ID. We need to
|
|
|
|
* 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 {
|
|
|
|
public:
|
|
|
|
typedef mozilla::dom::Element Element;
|
|
|
|
nsSVGIDRenderingObserver(nsIURI* aURI, nsIFrame *aFrame,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aReferenceImage);
|
2010-09-08 13:40:39 -07:00
|
|
|
virtual ~nsSVGIDRenderingObserver();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Element* GetTarget() { return mElement.get(); }
|
|
|
|
|
|
|
|
// This is called when the referenced resource changes.
|
|
|
|
virtual void DoUpdate();
|
|
|
|
|
2008-08-07 18:34:43 -07:00
|
|
|
class SourceReference : public nsReferencedElement {
|
|
|
|
public:
|
2010-09-08 13:40:39 -07:00
|
|
|
SourceReference(nsSVGIDRenderingObserver* aContainer) : mContainer(aContainer) {}
|
2008-08-07 18:34:43 -07:00
|
|
|
protected:
|
2010-05-14 10:04:51 -07:00
|
|
|
virtual void ElementChanged(Element* aFrom, Element* aTo) {
|
2010-08-13 06:31:31 -07:00
|
|
|
mContainer->StopListening();
|
2010-05-14 10:04:51 -07:00
|
|
|
nsReferencedElement::ElementChanged(aFrom, aTo);
|
2010-08-13 06:31:31 -07:00
|
|
|
mContainer->StartListening();
|
2008-08-07 18:34:43 -07:00
|
|
|
mContainer->DoUpdate();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Override IsPersistent because we want to keep tracking the element
|
|
|
|
* for the ID even when it changes.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsPersistent() { return true; }
|
2008-08-07 18:34:43 -07:00
|
|
|
private:
|
2010-09-08 13:40:39 -07:00
|
|
|
nsSVGIDRenderingObserver* mContainer;
|
2008-08-07 18:34:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
SourceReference mElement;
|
2008-09-30 17:51:05 -07:00
|
|
|
// The frame that this property is attached to
|
|
|
|
nsIFrame *mFrame;
|
|
|
|
// When a presshell is torn down, we don't delete the properties for
|
|
|
|
// each frame until after the frames are destroyed. So here we remember
|
|
|
|
// 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.
|
|
|
|
nsIPresShell *mFramePresShell;
|
2008-08-07 18:34:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsSVGFilterProperty :
|
2010-09-08 13:40:39 -07:00
|
|
|
public nsSVGIDRenderingObserver, public nsISVGFilterProperty {
|
2008-08-07 18:34:43 -07:00
|
|
|
public:
|
2010-08-13 06:36:05 -07:00
|
|
|
nsSVGFilterProperty(nsIURI *aURI, nsIFrame *aFilteredFrame,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aReferenceImage)
|
2010-09-08 13:40:39 -07:00
|
|
|
: nsSVGIDRenderingObserver(aURI, aFilteredFrame, aReferenceImage) {}
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* @return the filter frame, or null if there is no filter frame
|
|
|
|
*/
|
|
|
|
nsSVGFilterFrame *GetFilterFrame();
|
2008-08-07 18:34:43 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsISVGFilterProperty
|
|
|
|
virtual void Invalidate() { DoUpdate(); }
|
|
|
|
|
|
|
|
private:
|
2008-09-30 17:51:05 -07:00
|
|
|
// nsSVGRenderingObserver
|
2008-08-07 18:34:43 -07:00
|
|
|
virtual void DoUpdate();
|
|
|
|
};
|
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
class nsSVGMarkerProperty : public nsSVGIDRenderingObserver {
|
2008-10-10 06:14:05 -07:00
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
|
2010-09-08 13:40:39 -07:00
|
|
|
: nsSVGIDRenderingObserver(aURI, aFrame, aReferenceImage) {}
|
2008-10-10 06:14:05 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void DoUpdate();
|
|
|
|
};
|
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
class nsSVGTextPathProperty : public nsSVGIDRenderingObserver {
|
2008-10-11 04:29:35 -07:00
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGTextPathProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
|
2010-09-08 13:40:39 -07:00
|
|
|
: nsSVGIDRenderingObserver(aURI, aFrame, aReferenceImage) {}
|
2008-10-11 04:29:35 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void DoUpdate();
|
|
|
|
};
|
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
class nsSVGPaintingProperty : public nsSVGIDRenderingObserver {
|
2008-08-07 18:34:43 -07:00
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGPaintingProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
|
2010-09-08 13:40:39 -07:00
|
|
|
: nsSVGIDRenderingObserver(aURI, aFrame, aReferenceImage) {}
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
protected:
|
2008-08-07 18:34:43 -07:00
|
|
|
virtual void DoUpdate();
|
|
|
|
};
|
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* A manager for one-shot nsSVGRenderingObserver tracking.
|
|
|
|
* nsSVGRenderingObservers can be added or removed. They are not strongly
|
2010-01-23 10:47:53 -08:00
|
|
|
* referenced so an observer must be removed before it dies.
|
2008-09-30 17:51:05 -07:00
|
|
|
* When InvalidateAll is called, all outstanding references get
|
2010-08-13 06:31:31 -07:00
|
|
|
* InvalidateViaReferencedElement()
|
2008-09-30 17:51:05 -07:00
|
|
|
* called on them and the list is cleared. The intent is that
|
|
|
|
* the observer will force repainting of whatever part of the document
|
2010-01-23 10:47:53 -08:00
|
|
|
* is needed, and then at paint time the observer will do a clean lookup
|
2010-08-13 06:31:31 -07:00
|
|
|
* of the referenced element and [re-]add itself to the element's observer list.
|
2008-09-30 17:51:05 -07:00
|
|
|
*
|
|
|
|
* 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 {
|
2008-08-07 18:34:43 -07:00
|
|
|
public:
|
2009-06-24 14:19:02 -07:00
|
|
|
nsSVGRenderingObserverList() {
|
|
|
|
MOZ_COUNT_CTOR(nsSVGRenderingObserverList);
|
|
|
|
mObservers.Init(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsSVGRenderingObserverList() {
|
|
|
|
InvalidateAll();
|
|
|
|
MOZ_COUNT_DTOR(nsSVGRenderingObserverList);
|
|
|
|
}
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
void Add(nsSVGRenderingObserver* aObserver)
|
|
|
|
{ mObservers.PutEntry(aObserver); }
|
|
|
|
void Remove(nsSVGRenderingObserver* aObserver)
|
|
|
|
{ mObservers.RemoveEntry(aObserver); }
|
2010-08-13 06:31:31 -07:00
|
|
|
#ifdef DEBUG
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Contains(nsSVGRenderingObserver* aObserver)
|
2010-08-13 06:31:31 -07:00
|
|
|
{ return (mObservers.GetEntry(aObserver) != nsnull); }
|
|
|
|
#endif
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsEmpty()
|
2010-08-13 06:31:31 -07:00
|
|
|
{ return mObservers.Count() == 0; }
|
2010-01-23 10:47:53 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop all our observers, and notify them that we have changed and dropped
|
|
|
|
* our reference to them.
|
|
|
|
*/
|
2008-09-30 17:51:05 -07:00
|
|
|
void InvalidateAll();
|
2008-08-07 18:34:43 -07:00
|
|
|
|
2010-11-16 10:35:59 -08:00
|
|
|
/**
|
|
|
|
* Drop all our observers, and notify them that we have dropped our reference
|
|
|
|
* to them.
|
|
|
|
*/
|
|
|
|
void RemoveAll();
|
|
|
|
|
2008-08-07 18:34:43 -07:00
|
|
|
private:
|
2008-09-30 17:51:05 -07:00
|
|
|
nsTHashtable<nsVoidPtrHashKey> mObservers;
|
2008-08-07 18:34:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsSVGEffects {
|
|
|
|
public:
|
2010-08-13 06:31:31 -07:00
|
|
|
typedef mozilla::dom::Element Element;
|
2010-03-28 18:46:55 -07:00
|
|
|
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
2010-08-13 06:30:45 -07:00
|
|
|
typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver>
|
|
|
|
URIObserverHashtable;
|
2010-03-28 18:46:55 -07:00
|
|
|
|
|
|
|
static void DestroySupports(void* aPropertyValue)
|
|
|
|
{
|
|
|
|
(static_cast<nsISupports*>(aPropertyValue))->Release();
|
|
|
|
}
|
|
|
|
|
2010-08-13 06:30:45 -07:00
|
|
|
static void DestroyHashtable(void* aPropertyValue)
|
|
|
|
{
|
|
|
|
delete static_cast<URIObserverHashtable*> (aPropertyValue);
|
|
|
|
}
|
|
|
|
|
2010-03-28 18:46:55 -07:00
|
|
|
NS_DECLARE_FRAME_PROPERTY(FilterProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(MaskProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(ClipPathProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(MarkerBeginProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(MarkerMiddleProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(MarkerEndProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(FillProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(StrokeProperty, DestroySupports)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(HrefProperty, DestroySupports)
|
2010-08-13 06:30:45 -07:00
|
|
|
NS_DECLARE_FRAME_PROPERTY(BackgroundImageProperty, DestroyHashtable)
|
2010-03-28 18:46:55 -07:00
|
|
|
|
2008-08-07 18:34:43 -07:00
|
|
|
struct EffectProperties {
|
|
|
|
nsSVGFilterProperty* mFilter;
|
2008-09-30 17:51:05 -07:00
|
|
|
nsSVGPaintingProperty* mMask;
|
|
|
|
nsSVGPaintingProperty* mClipPath;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the clip-path frame, or null if there is no clip-path frame
|
2010-12-19 09:47:01 -08:00
|
|
|
* @param aOK if a clip-path was specified and the designated element
|
|
|
|
* exists but is an element of the wrong type, *aOK is set to false.
|
|
|
|
* Otherwise *aOK is untouched.
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGClipPathFrame *GetClipPathFrame(bool *aOK);
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* @return the mask frame, or null if there is no mask frame
|
2010-12-19 09:47:01 -08:00
|
|
|
* @param aOK if a mask was specified and the designated element
|
|
|
|
* exists but is an element of the wrong type, *aOK is set to false.
|
|
|
|
* Otherwise *aOK is untouched.
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGMaskFrame *GetMaskFrame(bool *aOK);
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* @return the filter frame, or null if there is no filter frame
|
|
|
|
* @param aOK if a filter was specified but the designated element
|
|
|
|
* does not exist or is an element of the wrong type, *aOK is set
|
|
|
|
* to false. Otherwise *aOK is untouched.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSVGFilterFrame *GetFilterFrame(bool *aOK) {
|
2008-09-30 17:51:05 -07:00
|
|
|
if (!mFilter)
|
|
|
|
return nsnull;
|
|
|
|
nsSVGFilterFrame *filter = mFilter->GetFilterFrame();
|
|
|
|
if (!filter) {
|
2011-10-17 07:59:28 -07:00
|
|
|
*aOK = false;
|
2008-09-30 17:51:05 -07:00
|
|
|
}
|
|
|
|
return filter;
|
|
|
|
}
|
2008-08-07 18:34:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
|
|
|
static EffectProperties GetEffectProperties(nsIFrame *aFrame);
|
|
|
|
/**
|
|
|
|
* Called by nsCSSFrameConstructor when style changes require the
|
|
|
|
* effect properties on aFrame to be updated
|
|
|
|
*/
|
|
|
|
static void UpdateEffects(nsIFrame *aFrame);
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
|
|
|
static nsSVGFilterProperty *GetFilterProperty(nsIFrame *aFrame);
|
|
|
|
static nsSVGFilterFrame *GetFilterFrame(nsIFrame *aFrame) {
|
|
|
|
nsSVGFilterProperty *prop = GetFilterProperty(aFrame);
|
2008-09-30 17:51:05 -07:00
|
|
|
return prop ? prop->GetFilterFrame() : nsnull;
|
2008-08-07 18:34:43 -07:00
|
|
|
}
|
2008-09-30 17:51:05 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2010-08-13 06:31:31 -07:00
|
|
|
static void AddRenderingObserver(Element *aElement, nsSVGRenderingObserver *aObserver);
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2010-08-13 06:31:31 -07:00
|
|
|
static void RemoveRenderingObserver(Element *aElement, nsSVGRenderingObserver *aObserver);
|
2010-11-16 10:35:59 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all rendering observers from aElement.
|
|
|
|
*/
|
|
|
|
static void RemoveAllRenderingObservers(Element *aElement);
|
|
|
|
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
2010-08-13 06:31:31 -07:00
|
|
|
* This can be called on any frame. We invalidate the observers of aFrame's
|
|
|
|
* element, if any, or else walk up to the nearest observable SVG parent
|
2010-01-23 10:47:53 -08:00
|
|
|
* frame with observers and invalidate them instead.
|
|
|
|
*
|
|
|
|
* Note that this method is very different to e.g.
|
2010-08-13 06:31:31 -07:00
|
|
|
* nsNodeUtils::AttributeChanged which walks up the content node tree all the
|
|
|
|
* way to the root node (not stopping if it encounters a non-container SVG
|
|
|
|
* node) invalidating all mutation observers (not just
|
|
|
|
* nsSVGRenderingObservers) on all nodes along the way (not just the first
|
|
|
|
* node it finds with observers). In other words, by doing all the
|
2010-05-13 05:19:50 -07:00
|
|
|
* things in parentheses in the preceding sentence, this method uses
|
2010-01-23 10:47:53 -08:00
|
|
|
* knowledge about our implementation and what can be affected by SVG effects
|
|
|
|
* to make invalidation relatively lightweight when an SVG effect changes.
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
|
|
|
static void InvalidateRenderingObservers(nsIFrame *aFrame);
|
|
|
|
/**
|
2010-08-13 06:31:31 -07:00
|
|
|
* This can be called on any element or frame. Only direct observers of this
|
|
|
|
* (frame's) element, if any, are invalidated.
|
2008-09-30 17:51:05 -07:00
|
|
|
*/
|
2010-08-13 06:31:31 -07:00
|
|
|
static void InvalidateDirectRenderingObservers(Element *aElement);
|
2008-09-30 17:51:05 -07:00
|
|
|
static void InvalidateDirectRenderingObservers(nsIFrame *aFrame);
|
|
|
|
|
2008-10-10 06:14:05 -07:00
|
|
|
/**
|
|
|
|
* Get an nsSVGMarkerProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGMarkerProperty *
|
2010-03-28 18:46:55 -07:00
|
|
|
GetMarkerProperty(nsIURI *aURI, nsIFrame *aFrame,
|
|
|
|
const FramePropertyDescriptor *aProperty);
|
2008-10-11 04:29:35 -07:00
|
|
|
/**
|
|
|
|
* Get an nsSVGTextPathProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGTextPathProperty *
|
2010-03-28 18:46:55 -07:00
|
|
|
GetTextPathProperty(nsIURI *aURI, nsIFrame *aFrame,
|
|
|
|
const FramePropertyDescriptor *aProperty);
|
2008-09-30 17:51:05 -07:00
|
|
|
/**
|
|
|
|
* Get an nsSVGPaintingProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGPaintingProperty *
|
2010-03-28 18:46:55 -07:00
|
|
|
GetPaintingProperty(nsIURI *aURI, nsIFrame *aFrame,
|
|
|
|
const FramePropertyDescriptor *aProperty);
|
2010-08-13 06:30:45 -07:00
|
|
|
/**
|
|
|
|
* Get an nsSVGPaintingProperty for the frame for that URI, creating a fresh
|
|
|
|
* one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGPaintingProperty *
|
|
|
|
GetPaintingPropertyForURI(nsIURI *aURI, nsIFrame *aFrame,
|
|
|
|
const FramePropertyDescriptor *aProp);
|
2008-08-07 18:34:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*NSSVGEFFECTS_H_*/
|