зеркало из https://github.com/mozilla/pjs.git
Bug 572689 - Add an SVG property for -moz-element called BackgroundImageProperty and make it able to handle multiple observers with different observer URLs. r=roc
This commit is contained in:
Родитель
291bbf616b
Коммит
8577cd7530
|
@ -366,6 +366,36 @@ nsSVGEffects::GetPaintingProperty(nsIURI *aURI, nsIFrame *aFrame,
|
|||
GetEffectProperty(aURI, aFrame, aProp, CreatePaintingProperty));
|
||||
}
|
||||
|
||||
static nsSVGRenderingObserver *
|
||||
GetEffectPropertyForURI(nsIURI *aURI, nsIFrame *aFrame,
|
||||
const FramePropertyDescriptor *aProperty,
|
||||
nsSVGRenderingObserver * (* aCreate)(nsIURI *, nsIFrame *))
|
||||
{
|
||||
FrameProperties props = aFrame->Properties();
|
||||
nsSVGEffects::URIObserverHashtable *hashtable =
|
||||
static_cast<nsSVGEffects::URIObserverHashtable*>(props.Get(aProperty));
|
||||
if (!hashtable) {
|
||||
hashtable = new nsSVGEffects::URIObserverHashtable();
|
||||
hashtable->Init();
|
||||
props.Set(aProperty, hashtable);
|
||||
}
|
||||
nsSVGRenderingObserver* prop =
|
||||
static_cast<nsSVGRenderingObserver*>(hashtable->GetWeak(aURI));
|
||||
if (!prop) {
|
||||
prop = aCreate(aURI, aFrame);
|
||||
hashtable->Put(aURI, prop);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
nsSVGPaintingProperty *
|
||||
nsSVGEffects::GetPaintingPropertyForURI(nsIURI *aURI, nsIFrame *aFrame,
|
||||
const FramePropertyDescriptor *aProp)
|
||||
{
|
||||
return static_cast<nsSVGPaintingProperty*>(
|
||||
GetEffectPropertyForURI(aURI, aFrame, aProp, CreatePaintingProperty));
|
||||
}
|
||||
|
||||
nsSVGEffects::EffectProperties
|
||||
nsSVGEffects::GetEffectProperties(nsIFrame *aFrame)
|
||||
{
|
||||
|
@ -420,6 +450,7 @@ nsSVGEffects::UpdateEffects(nsIFrame *aFrame)
|
|||
props.Delete(MarkerEndProperty());
|
||||
props.Delete(FillProperty());
|
||||
props.Delete(StrokeProperty());
|
||||
props.Delete(BackgroundImageProperty());
|
||||
|
||||
// Ensure that the filter is repainted correctly
|
||||
// We can't do that in DoUpdate as the referenced frame may not be valid
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
#include "nsReferencedElement.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsURIHashKey.h"
|
||||
|
||||
class nsSVGClipPathFrame;
|
||||
class nsSVGFilterFrame;
|
||||
|
@ -217,12 +218,19 @@ private:
|
|||
class nsSVGEffects {
|
||||
public:
|
||||
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
||||
typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver>
|
||||
URIObserverHashtable;
|
||||
|
||||
static void DestroySupports(void* aPropertyValue)
|
||||
{
|
||||
(static_cast<nsISupports*>(aPropertyValue))->Release();
|
||||
}
|
||||
|
||||
static void DestroyHashtable(void* aPropertyValue)
|
||||
{
|
||||
delete static_cast<URIObserverHashtable*> (aPropertyValue);
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(FilterProperty, DestroySupports)
|
||||
NS_DECLARE_FRAME_PROPERTY(MaskProperty, DestroySupports)
|
||||
NS_DECLARE_FRAME_PROPERTY(ClipPathProperty, DestroySupports)
|
||||
|
@ -232,6 +240,7 @@ public:
|
|||
NS_DECLARE_FRAME_PROPERTY(FillProperty, DestroySupports)
|
||||
NS_DECLARE_FRAME_PROPERTY(StrokeProperty, DestroySupports)
|
||||
NS_DECLARE_FRAME_PROPERTY(HrefProperty, DestroySupports)
|
||||
NS_DECLARE_FRAME_PROPERTY(BackgroundImageProperty, DestroyHashtable)
|
||||
|
||||
struct EffectProperties {
|
||||
nsSVGFilterProperty* mFilter;
|
||||
|
@ -335,6 +344,13 @@ public:
|
|||
static nsSVGPaintingProperty *
|
||||
GetPaintingProperty(nsIURI *aURI, nsIFrame *aFrame,
|
||||
const FramePropertyDescriptor *aProperty);
|
||||
/**
|
||||
* 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);
|
||||
};
|
||||
|
||||
#endif /*NSSVGEFFECTS_H_*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче