2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-08-08 05:34:43 +04:00
|
|
|
|
|
|
|
#ifndef NSSVGEFFECTS_H_
|
|
|
|
#define NSSVGEFFECTS_H_
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-09-08 12:02:05 +03:00
|
|
|
#include "mozilla/dom/IDTracker.h"
|
2017-05-27 14:36:00 +03:00
|
|
|
#include "FrameProperties.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsID.h"
|
2008-08-08 05:34:43 +04:00
|
|
|
#include "nsIFrame.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsIMutationObserver.h"
|
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
#include "nsISupportsBase.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2008-08-08 05:34:43 +04:00
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsTHashtable.h"
|
2010-08-13 17:30:45 +04:00
|
|
|
#include "nsURIHashKey.h"
|
2014-09-09 19:14:46 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2012-03-20 16:15:55 +04:00
|
|
|
class nsIPresShell;
|
|
|
|
class nsIURI;
|
2008-10-01 04:51:05 +04:00
|
|
|
class nsSVGClipPathFrame;
|
2012-08-05 23:10:21 +04:00
|
|
|
class nsSVGPaintServerFrame;
|
2008-10-01 04:51:05 +04:00
|
|
|
class nsSVGFilterFrame;
|
|
|
|
class nsSVGMaskFrame;
|
2014-09-09 19:14:46 +04:00
|
|
|
class nsSVGFilterChainObserver;
|
2008-10-01 04:51:05 +04:00
|
|
|
|
|
|
|
/*
|
2010-09-09 00:40:39 +04: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
|
2017-09-15 12:01:34 +03:00
|
|
|
* monitor, and they need to implement "OnRenderingChange" to specify how
|
|
|
|
* we'll react when that content gets re-rendered. They also need to implement
|
|
|
|
* a constructor and destructor, which should call StartObserving and
|
2017-09-14 11:47:19 +03:00
|
|
|
* StopObserving, respectively.
|
2008-10-01 04:51:05 +04:00
|
|
|
*/
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGRenderingObserver : public nsStubMutationObserver
|
|
|
|
{
|
2014-06-24 02:40:01 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsSVGRenderingObserver()
|
|
|
|
{}
|
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2010-08-13 17:31:31 +04:00
|
|
|
typedef mozilla::dom::Element Element;
|
2010-09-09 00:40:39 +04:00
|
|
|
nsSVGRenderingObserver()
|
2011-10-17 18:59:28 +04:00
|
|
|
: mInObserverList(false)
|
2010-09-09 00:40:39 +04:00
|
|
|
{}
|
2008-08-08 05:34:43 +04:00
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2017-09-15 16:54:27 +03:00
|
|
|
/**
|
|
|
|
* Called when non-DOM-mutation changes to the observed element should likely
|
|
|
|
* cause the rendering of our observer to change. This includes changes to
|
|
|
|
* CSS computed values, but also changes to rendering observers that the
|
|
|
|
* observed element itself may have (for example, when we're being used to
|
|
|
|
* observe an SVG pattern, and an element in that pattern references and
|
|
|
|
* observes a gradient that has changed).
|
|
|
|
*/
|
|
|
|
void OnNonDOMMutationRenderingChange();
|
2010-11-16 21:35:59 +03: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-29 10:19:26 +04:00
|
|
|
bool IsInObserverList() const { return mInObserverList; }
|
2010-09-09 00:40:39 +04:00
|
|
|
|
2010-12-19 20:47:01 +03:00
|
|
|
nsIFrame* GetReferencedFrame();
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
|
|
|
* @param aOK this is only for the convenience of callers. We set *aOK to false
|
2010-12-19 20:47:01 +03:00
|
|
|
* if the frame is the wrong type
|
2008-10-01 04:51:05 +04:00
|
|
|
*/
|
2017-05-01 20:32:52 +03:00
|
|
|
nsIFrame* GetReferencedFrame(mozilla::LayoutFrameType aFrameType, bool* aOK);
|
2008-10-01 04:51:05 +04:00
|
|
|
|
2010-09-09 00:40:39 +04:00
|
|
|
Element* GetReferencedElement();
|
|
|
|
|
2012-08-29 09:49:16 +04:00
|
|
|
virtual bool ObservesReflow() { return true; }
|
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
protected:
|
2017-09-14 11:47:19 +03:00
|
|
|
void StartObserving();
|
|
|
|
void StopObserving();
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2017-09-15 12:01:34 +03:00
|
|
|
/**
|
|
|
|
* Called whenever the rendering of the observed element may have changed.
|
|
|
|
*
|
|
|
|
* More specifically, this method is called whenever DOM mutation occurs in
|
|
|
|
* the observed element's subtree, or whenever
|
|
|
|
* SVGObserverUtils::InvalidateRenderingObservers or
|
|
|
|
* SVGObserverUtils::InvalidateDirectRenderingObservers is called for the
|
|
|
|
* observed element's frame.
|
|
|
|
*
|
|
|
|
* Subclasses should override this method to handle rendering changes
|
|
|
|
* appropriately.
|
|
|
|
*/
|
|
|
|
virtual void OnRenderingChange() = 0;
|
2010-09-09 00:40:39 +04:00
|
|
|
|
|
|
|
// 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-29 10:19:26 +04:00
|
|
|
bool mInObserverList;
|
2010-09-09 00:40:39 +04: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.
|
2014-08-01 04:37:35 +04:00
|
|
|
*
|
2010-09-09 00:40:39 +04:00
|
|
|
* 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.
|
|
|
|
*/
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGIDRenderingObserver : public nsSVGRenderingObserver
|
|
|
|
{
|
2010-09-09 00:40:39 +04:00
|
|
|
public:
|
|
|
|
typedef mozilla::dom::Element Element;
|
2017-09-08 12:02:05 +03:00
|
|
|
typedef mozilla::dom::IDTracker IDTracker;
|
|
|
|
|
2014-09-09 19:14:45 +04:00
|
|
|
nsSVGIDRenderingObserver(nsIURI* aURI, nsIContent* aObservingContent,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aReferenceImage);
|
2010-09-09 00:40:39 +04:00
|
|
|
virtual ~nsSVGIDRenderingObserver();
|
|
|
|
|
|
|
|
protected:
|
2017-09-12 11:36:08 +03:00
|
|
|
Element* GetTarget() override { return mObservedElementTracker.get(); }
|
2010-09-09 00:40:39 +04:00
|
|
|
|
2017-09-15 12:01:34 +03:00
|
|
|
void OnRenderingChange() override;
|
2010-09-09 00:40:39 +04:00
|
|
|
|
2017-09-12 11:36:08 +03:00
|
|
|
/**
|
|
|
|
* Helper that provides a reference to the element with the ID that our
|
|
|
|
* observer wants to observe, and that will invalidate our observer if the
|
|
|
|
* element that that ID identifies changes to a different element (or none).
|
|
|
|
*/
|
|
|
|
class ElementTracker final : public IDTracker
|
2016-05-19 10:44:42 +03:00
|
|
|
{
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2017-09-12 11:36:08 +03:00
|
|
|
explicit ElementTracker(nsSVGIDRenderingObserver* aOwningObserver)
|
|
|
|
: mOwningObserver(aOwningObserver)
|
|
|
|
{}
|
2008-08-08 05:34:43 +04:00
|
|
|
protected:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ElementChanged(Element* aFrom, Element* aTo) override {
|
2017-09-14 11:47:19 +03:00
|
|
|
mOwningObserver->StopObserving(); // stop observing the old element
|
2017-09-08 12:02:05 +03:00
|
|
|
IDTracker::ElementChanged(aFrom, aTo);
|
2017-09-14 11:47:19 +03:00
|
|
|
mOwningObserver->StartObserving(); // start observing the new element
|
2017-09-15 12:01:34 +03:00
|
|
|
mOwningObserver->OnRenderingChange();
|
2008-08-08 05:34:43 +04:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Override IsPersistent because we want to keep tracking the element
|
|
|
|
* for the ID even when it changes.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsPersistent() override { return true; }
|
2008-08-08 05:34:43 +04:00
|
|
|
private:
|
2017-09-12 11:36:08 +03:00
|
|
|
nsSVGIDRenderingObserver* mOwningObserver;
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
2014-08-01 04:37:35 +04:00
|
|
|
|
2017-09-12 11:36:08 +03:00
|
|
|
ElementTracker mObservedElementTracker;
|
2014-09-09 19:14:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nsSVGFrameReferenceFromProperty
|
|
|
|
{
|
2014-09-11 23:41:21 +04:00
|
|
|
explicit nsSVGFrameReferenceFromProperty(nsIFrame* aFrame)
|
2014-09-09 19:14:45 +04:00
|
|
|
: mFrame(aFrame)
|
2017-11-09 05:00:48 +03:00
|
|
|
, mFramePresShell(aFrame->PresShell())
|
2014-09-09 19:14:45 +04:00
|
|
|
{}
|
|
|
|
|
|
|
|
// Clear our reference to the frame.
|
|
|
|
void Detach();
|
|
|
|
|
|
|
|
// null if the frame has become invalid
|
|
|
|
nsIFrame* Get();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The frame that this property is attached to, may be null
|
2013-02-11 10:22:20 +04:00
|
|
|
nsIFrame *mFrame;
|
2008-10-01 04:51:05 +04:00
|
|
|
// 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.
|
2014-09-09 19:14:45 +04:00
|
|
|
// mFramePresShell may be null, but when mFrame is non-null, mFramePresShell
|
|
|
|
// is guaranteed to be non-null, too.
|
2008-10-01 04:51:05 +04:00
|
|
|
nsIPresShell *mFramePresShell;
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver
|
|
|
|
{
|
2014-09-09 19:14:45 +04:00
|
|
|
public:
|
2015-07-09 21:32:00 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2014-09-09 19:14:45 +04:00
|
|
|
nsSVGRenderingObserverProperty(nsIURI* aURI, nsIFrame *aFrame,
|
|
|
|
bool aReferenceImage)
|
|
|
|
: nsSVGIDRenderingObserver(aURI, aFrame->GetContent(), aReferenceImage)
|
|
|
|
, mFrameReference(aFrame)
|
|
|
|
{}
|
|
|
|
|
|
|
|
protected:
|
2015-07-09 21:32:00 +03:00
|
|
|
virtual ~nsSVGRenderingObserverProperty() {}
|
|
|
|
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2014-09-09 19:14:45 +04:00
|
|
|
|
|
|
|
nsSVGFrameReferenceFromProperty mFrameReference;
|
|
|
|
};
|
|
|
|
|
2014-02-10 08:31:03 +04:00
|
|
|
/**
|
|
|
|
* In a filter chain, there can be multiple SVG reference filters.
|
|
|
|
* e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);
|
|
|
|
*
|
|
|
|
* This class keeps track of one SVG reference filter in a filter chain.
|
|
|
|
* 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.
|
|
|
|
*
|
2014-09-09 19:14:46 +04:00
|
|
|
* The nsSVGFilterChainObserver class manages a list of nsSVGFilterReferences.
|
2014-02-10 08:31:03 +04:00
|
|
|
*/
|
2016-05-06 19:25:55 +03:00
|
|
|
class nsSVGFilterReference final : public nsSVGIDRenderingObserver
|
2016-05-19 10:44:42 +03:00
|
|
|
, public nsISVGFilterReference
|
|
|
|
{
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2014-09-09 19:14:46 +04:00
|
|
|
nsSVGFilterReference(nsIURI* aURI,
|
|
|
|
nsIContent* aObservingContent,
|
2014-09-09 19:14:46 +04:00
|
|
|
nsSVGFilterChainObserver* aFilterChainObserver)
|
2014-09-09 19:14:46 +04:00
|
|
|
: nsSVGIDRenderingObserver(aURI, aObservingContent, false)
|
|
|
|
, mFilterChainObserver(aFilterChainObserver)
|
|
|
|
{
|
|
|
|
}
|
2014-02-10 08:31:03 +04:00
|
|
|
|
|
|
|
bool ReferencesValidResource() { return GetFilterFrame(); }
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2014-09-09 19:14:46 +04:00
|
|
|
void DetachFromChainObserver() { mFilterChainObserver = nullptr; }
|
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
|
|
|
* @return the filter frame, or null if there is no filter frame
|
|
|
|
*/
|
|
|
|
nsSVGFilterFrame *GetFilterFrame();
|
2008-08-08 05:34:43 +04:00
|
|
|
|
|
|
|
// nsISupports
|
2014-09-09 19:14:46 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSVGFilterReference, nsSVGIDRenderingObserver)
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2014-02-10 08:31:03 +04:00
|
|
|
// nsISVGFilterReference
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void Invalidate() override { OnRenderingChange(); };
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2014-07-09 01:23:18 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsSVGFilterReference() {}
|
|
|
|
|
2014-09-09 19:14:46 +04:00
|
|
|
// nsSVGIDRenderingObserver
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2014-09-09 19:14:46 +04:00
|
|
|
|
|
|
|
private:
|
2014-09-09 19:14:46 +04:00
|
|
|
nsSVGFilterChainObserver* mFilterChainObserver;
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
2014-02-10 08:31:03 +04:00
|
|
|
/**
|
|
|
|
* This class manages a list of nsSVGFilterReferences, which represent SVG
|
|
|
|
* reference filters in a filter chain.
|
|
|
|
* e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);
|
|
|
|
*
|
2014-09-09 19:14:46 +04:00
|
|
|
* In the above example, the nsSVGFilterChainObserver will manage two
|
2014-02-10 08:31:03 +04:00
|
|
|
* 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.
|
|
|
|
*/
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGFilterChainObserver : public nsISupports
|
|
|
|
{
|
2014-02-10 08:31:03 +04:00
|
|
|
public:
|
2014-09-09 19:14:46 +04:00
|
|
|
nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters,
|
2016-07-23 11:16:59 +03:00
|
|
|
nsIContent* aFilteredElement,
|
|
|
|
nsIFrame* aFiltedFrame = nullptr);
|
2014-02-10 08:31:03 +04:00
|
|
|
|
|
|
|
bool ReferencesValidResources();
|
|
|
|
bool IsInObserverLists() const;
|
2017-09-15 12:01:34 +03:00
|
|
|
void Invalidate() { OnRenderingChange(); }
|
2014-02-10 08:31:03 +04:00
|
|
|
|
|
|
|
// nsISupports
|
2014-09-09 19:14:46 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsSVGFilterChainObserver)
|
2014-02-10 08:31:03 +04:00
|
|
|
|
2014-06-24 02:40:01 +04:00
|
|
|
protected:
|
2014-09-09 19:14:46 +04:00
|
|
|
virtual ~nsSVGFilterChainObserver();
|
2014-09-09 19:14:46 +04:00
|
|
|
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() = 0;
|
2014-06-24 02:40:01 +04:00
|
|
|
|
2014-02-10 08:31:03 +04:00
|
|
|
private:
|
2016-07-15 02:40:30 +03:00
|
|
|
|
|
|
|
void DetachReferences()
|
|
|
|
{
|
|
|
|
for (uint32_t i = 0; i < mReferences.Length(); i++) {
|
|
|
|
mReferences[i]->DetachFromChainObserver();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<nsSVGFilterReference>> mReferences;
|
2014-09-09 19:14:46 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGFilterProperty : public nsSVGFilterChainObserver
|
|
|
|
{
|
2014-09-09 19:14:46 +04:00
|
|
|
public:
|
2016-08-02 14:06:14 +03:00
|
|
|
nsSVGFilterProperty(const nsTArray<nsStyleFilter>& aFilters,
|
|
|
|
nsIFrame* aFilteredFrame)
|
2016-07-23 11:16:59 +03:00
|
|
|
: nsSVGFilterChainObserver(aFilters, aFilteredFrame->GetContent(),
|
|
|
|
aFilteredFrame)
|
2014-09-09 19:14:46 +04:00
|
|
|
, mFrameReference(aFilteredFrame)
|
|
|
|
{}
|
|
|
|
|
2014-09-09 19:14:46 +04:00
|
|
|
void DetachFromFrame() { mFrameReference.Detach(); }
|
|
|
|
|
2014-09-09 19:14:46 +04:00
|
|
|
protected:
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2014-09-09 19:14:46 +04:00
|
|
|
|
2014-09-09 19:14:46 +04:00
|
|
|
nsSVGFrameReferenceFromProperty mFrameReference;
|
2014-02-10 08:31:03 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGMarkerProperty final: public nsSVGRenderingObserverProperty
|
|
|
|
{
|
2008-10-10 17:14:05 +04:00
|
|
|
public:
|
2016-08-02 14:06:14 +03:00
|
|
|
nsSVGMarkerProperty(nsIURI* aURI, nsIFrame* aFrame, bool aReferenceImage)
|
2014-09-09 19:14:45 +04:00
|
|
|
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
|
2008-10-10 17:14:05 +04:00
|
|
|
|
|
|
|
protected:
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2008-10-10 17:14:05 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGTextPathProperty final : public nsSVGRenderingObserverProperty
|
|
|
|
{
|
2008-10-11 15:29:35 +04:00
|
|
|
public:
|
2016-08-02 14:06:14 +03:00
|
|
|
nsSVGTextPathProperty(nsIURI* aURI, nsIFrame* aFrame, bool aReferenceImage)
|
2014-09-09 19:14:45 +04:00
|
|
|
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage)
|
2013-02-11 10:22:20 +04:00
|
|
|
, mValid(true) {}
|
2008-10-11 15:29:35 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ObservesReflow() override { return false; }
|
2012-08-29 09:49:16 +04:00
|
|
|
|
2008-10-11 15:29:35 +04:00
|
|
|
protected:
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2013-02-11 10:22:20 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Returns true if the target of the textPath is the frame of a 'path' element.
|
|
|
|
*/
|
|
|
|
bool TargetIsValid();
|
|
|
|
|
|
|
|
bool mValid;
|
2008-10-11 15:29:35 +04:00
|
|
|
};
|
2014-08-01 04:37:35 +04:00
|
|
|
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGPaintingProperty final : public nsSVGRenderingObserverProperty
|
|
|
|
{
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2016-08-02 14:06:14 +03:00
|
|
|
nsSVGPaintingProperty(nsIURI* aURI, nsIFrame* aFrame, bool aReferenceImage)
|
2014-09-09 19:14:45 +04:00
|
|
|
: nsSVGRenderingObserverProperty(aURI, aFrame, aReferenceImage) {}
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
protected:
|
2017-09-15 12:01:34 +03:00
|
|
|
virtual void OnRenderingChange() override;
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 10:43:55 +03:00
|
|
|
class nsSVGMaskProperty final : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit nsSVGMaskProperty(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
const nsTArray<RefPtr<nsSVGPaintingProperty>>& GetProps() const
|
|
|
|
{
|
|
|
|
return mProperties;
|
|
|
|
}
|
|
|
|
|
2017-07-26 07:02:44 +03:00
|
|
|
void ResolveImage(uint32_t aIndex);
|
|
|
|
|
2016-05-19 10:43:55 +03:00
|
|
|
private:
|
|
|
|
virtual ~nsSVGMaskProperty() {}
|
|
|
|
nsTArray<RefPtr<nsSVGPaintingProperty>> mProperties;
|
2017-07-26 07:02:44 +03:00
|
|
|
nsIFrame* mFrame;
|
2016-05-19 10:43:55 +03:00
|
|
|
};
|
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
|
|
|
* A manager for one-shot nsSVGRenderingObserver tracking.
|
|
|
|
* nsSVGRenderingObservers can be added or removed. They are not strongly
|
2010-01-23 21:47:53 +03:00
|
|
|
* referenced so an observer must be removed before it dies.
|
2008-10-01 04:51:05 +04:00
|
|
|
* When InvalidateAll is called, all outstanding references get
|
2017-09-15 16:54:27 +03:00
|
|
|
* OnNonDOMMutationRenderingChange()
|
2008-10-01 04:51:05 +04: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 21:47:53 +03:00
|
|
|
* is needed, and then at paint time the observer will do a clean lookup
|
2010-08-13 17:31:31 +04:00
|
|
|
* of the referenced element and [re-]add itself to the element's observer list.
|
2014-08-01 04:37:35 +04:00
|
|
|
*
|
2008-10-01 04:51:05 +04: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.
|
|
|
|
*/
|
2016-05-19 10:44:42 +03:00
|
|
|
class nsSVGRenderingObserverList
|
|
|
|
{
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2013-09-02 12:41:57 +04:00
|
|
|
nsSVGRenderingObserverList()
|
2014-08-06 17:31:21 +04:00
|
|
|
: mObservers(4)
|
2013-09-02 12:41:57 +04:00
|
|
|
{
|
2009-06-25 01:19:02 +04:00
|
|
|
MOZ_COUNT_CTOR(nsSVGRenderingObserverList);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsSVGRenderingObserverList() {
|
|
|
|
InvalidateAll();
|
|
|
|
MOZ_COUNT_DTOR(nsSVGRenderingObserverList);
|
|
|
|
}
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
void Add(nsSVGRenderingObserver* aObserver)
|
|
|
|
{ mObservers.PutEntry(aObserver); }
|
|
|
|
void Remove(nsSVGRenderingObserver* aObserver)
|
|
|
|
{ mObservers.RemoveEntry(aObserver); }
|
2010-08-13 17:31:31 +04:00
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Contains(nsSVGRenderingObserver* aObserver)
|
2012-07-30 18:20:58 +04:00
|
|
|
{ return (mObservers.GetEntry(aObserver) != nullptr); }
|
2010-08-13 17:31:31 +04:00
|
|
|
#endif
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsEmpty()
|
2010-08-13 17:31:31 +04:00
|
|
|
{ return mObservers.Count() == 0; }
|
2010-01-23 21:47:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop all our observers, and notify them that we have changed and dropped
|
|
|
|
* our reference to them.
|
|
|
|
*/
|
2008-10-01 04:51:05 +04:00
|
|
|
void InvalidateAll();
|
2008-08-08 05:34:43 +04:00
|
|
|
|
2012-08-29 09:49:16 +04:00
|
|
|
/**
|
|
|
|
* Drop all observers that observe reflow, and notify them that we have changed and dropped
|
|
|
|
* our reference to them.
|
|
|
|
*/
|
|
|
|
void InvalidateAllForReflow();
|
|
|
|
|
2010-11-16 21:35:59 +03:00
|
|
|
/**
|
|
|
|
* Drop all our observers, and notify them that we have dropped our reference
|
|
|
|
* to them.
|
|
|
|
*/
|
|
|
|
void RemoveAll();
|
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
private:
|
2012-03-21 22:07:31 +04:00
|
|
|
nsTHashtable<nsPtrHashKey<nsSVGRenderingObserver> > mObservers;
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
2017-08-30 17:58:31 +03:00
|
|
|
class SVGObserverUtils
|
2016-05-19 10:44:42 +03:00
|
|
|
{
|
2008-08-08 05:34:43 +04:00
|
|
|
public:
|
2010-08-13 17:31:31 +04:00
|
|
|
typedef mozilla::dom::Element Element;
|
2010-08-13 17:30:45 +04:00
|
|
|
typedef nsInterfaceHashtable<nsURIHashKey, nsIMutationObserver>
|
|
|
|
URIObserverHashtable;
|
2010-03-29 05:46:55 +04:00
|
|
|
|
2016-06-21 23:17:11 +03:00
|
|
|
using PaintingPropertyDescriptor =
|
|
|
|
const mozilla::FramePropertyDescriptor<nsSVGPaintingProperty>*;
|
2016-01-28 06:23:59 +03:00
|
|
|
using URIObserverHashtablePropertyDescriptor =
|
|
|
|
const mozilla::FramePropertyDescriptor<URIObserverHashtable>*;
|
|
|
|
|
2016-01-28 06:23:59 +03:00
|
|
|
static void DestroyFilterProperty(nsSVGFilterProperty* aProp)
|
2014-09-09 19:14:46 +04:00
|
|
|
{
|
|
|
|
// nsSVGFilterProperty is cycle-collected, so dropping the last reference
|
|
|
|
// doesn't necessarily destroy it. We need to tell it that the frame
|
|
|
|
// has now become invalid.
|
2016-01-28 06:23:59 +03:00
|
|
|
aProp->DetachFromFrame();
|
2014-09-09 19:14:46 +04:00
|
|
|
|
2016-01-28 06:23:59 +03:00
|
|
|
aProp->Release();
|
2014-09-09 19:14:46 +04:00
|
|
|
}
|
|
|
|
|
2016-01-28 06:23:59 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(FilterProperty, nsSVGFilterProperty,
|
|
|
|
DestroyFilterProperty)
|
2016-05-19 10:43:55 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(MaskProperty, nsSVGMaskProperty)
|
2016-06-21 23:17:11 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(ClipPathProperty, nsSVGPaintingProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(MarkerBeginProperty, nsSVGMarkerProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(MarkerMiddleProperty, nsSVGMarkerProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(MarkerEndProperty, nsSVGMarkerProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(FillProperty, nsSVGPaintingProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(StrokeProperty, nsSVGPaintingProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(HrefAsTextPathProperty,
|
|
|
|
nsSVGTextPathProperty)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(HrefAsPaintingProperty,
|
|
|
|
nsSVGPaintingProperty)
|
2016-01-28 06:23:59 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_DELETABLE(BackgroundImageProperty,
|
|
|
|
URIObserverHashtable)
|
2010-03-29 05:46:55 +04:00
|
|
|
|
2012-08-05 23:10:21 +04:00
|
|
|
/**
|
|
|
|
* Get the paint server for a aTargetFrame.
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static nsSVGPaintServerFrame *GetPaintServer(nsIFrame* aTargetFrame,
|
2016-07-04 20:00:15 +03:00
|
|
|
nsStyleSVGPaint nsStyleSVG::* aPaint,
|
2016-06-21 23:17:11 +03:00
|
|
|
PaintingPropertyDescriptor aProperty);
|
2012-08-05 23:10:21 +04:00
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
struct EffectProperties {
|
|
|
|
nsSVGFilterProperty* mFilter;
|
2016-05-19 10:43:55 +03:00
|
|
|
nsSVGMaskProperty* mMask;
|
2008-10-01 04:51:05 +04:00
|
|
|
nsSVGPaintingProperty* mClipPath;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the clip-path frame, or null if there is no clip-path frame
|
|
|
|
*/
|
2016-12-07 10:28:47 +03:00
|
|
|
nsSVGClipPathFrame* GetClipPathFrame();
|
2016-05-19 10:43:55 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return an array which contains all SVG mask frames.
|
|
|
|
*/
|
|
|
|
nsTArray<nsSVGMaskFrame*> GetMaskFrames();
|
2014-02-24 19:22:58 +04:00
|
|
|
|
2016-12-07 05:12:36 +03:00
|
|
|
/*
|
|
|
|
* @return true if all effects we have are valid or we have no effect
|
|
|
|
* at all.
|
|
|
|
*/
|
|
|
|
bool HasNoOrValidEffects();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @return true if we have any invalid effect.
|
|
|
|
*/
|
|
|
|
bool HasInvalidEffects() {
|
|
|
|
return !HasNoOrValidEffects();
|
|
|
|
}
|
|
|
|
|
2016-12-07 10:28:47 +03:00
|
|
|
/*
|
|
|
|
* @return true if we either do not have clip-path or have a valid
|
|
|
|
* clip-path.
|
|
|
|
*/
|
|
|
|
bool HasNoOrValidClipPath();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @return true if we have an invalid clip-path.
|
|
|
|
*/
|
|
|
|
bool HasInvalidClipPath() {
|
|
|
|
return !HasNoOrValidClipPath();
|
|
|
|
}
|
|
|
|
|
2016-12-07 13:11:06 +03:00
|
|
|
/*
|
|
|
|
* @return true if we either do not have mask or all masks we have
|
|
|
|
* are valid.
|
|
|
|
*/
|
|
|
|
bool HasNoOrValidMask();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @return true if we have an invalid mask.
|
|
|
|
*/
|
|
|
|
bool HasInvalidMask() {
|
|
|
|
return !HasNoOrValidMask();
|
|
|
|
}
|
|
|
|
|
2014-02-24 19:22:58 +04:00
|
|
|
bool HasValidFilter() {
|
|
|
|
return mFilter && mFilter->ReferencesValidResources();
|
|
|
|
}
|
|
|
|
|
2016-12-13 14:40:27 +03:00
|
|
|
/*
|
|
|
|
* @return true if we either do not have filter or all filters we have
|
|
|
|
* are valid.
|
|
|
|
*/
|
|
|
|
bool HasNoOrValidFilter() {
|
2014-02-24 19:22:58 +04:00
|
|
|
return !mFilter || mFilter->ReferencesValidResources();
|
2008-10-01 04:51:05 +04:00
|
|
|
}
|
2016-12-13 14:40:27 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @return true if we have an invalid filter.
|
|
|
|
*/
|
|
|
|
bool HasInvalidFilter() {
|
|
|
|
return !HasNoOrValidFilter();
|
|
|
|
}
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static EffectProperties GetEffectProperties(nsIFrame* aFrame);
|
2012-11-07 17:54:55 +04:00
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
/**
|
2012-11-07 17:54:55 +04:00
|
|
|
* Called when changes to an element (e.g. CSS property changes) cause its
|
|
|
|
* frame to start/stop referencing (or reference different) SVG resource
|
|
|
|
* elements. (_Not_ called for changes to referenced resource elements.)
|
|
|
|
*
|
|
|
|
* This function handles such changes by discarding _all_ the frame's SVG
|
|
|
|
* effects frame properties (causing those properties to stop watching their
|
|
|
|
* target element). It also synchronously (re)creates the filter and marker
|
|
|
|
* frame properties (XXX why not the other properties?), which makes it
|
|
|
|
* useful for initializing those properties during first reflow.
|
|
|
|
*
|
|
|
|
* XXX rename to something more meaningful like RefreshResourceReferences?
|
2008-08-08 05:34:43 +04:00
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void UpdateEffects(nsIFrame* aFrame);
|
2012-11-07 17:54:55 +04:00
|
|
|
|
2008-08-08 05:34:43 +04:00
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static nsSVGFilterProperty *GetFilterProperty(nsIFrame* aFrame);
|
2008-10-01 04:51:05 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void AddRenderingObserver(Element* aElement, nsSVGRenderingObserver *aObserver);
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void RemoveRenderingObserver(Element* aElement, nsSVGRenderingObserver *aObserver);
|
2010-11-16 21:35:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all rendering observers from aElement.
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void RemoveAllRenderingObservers(Element* aElement);
|
2010-11-16 21:35:59 +03:00
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
2010-08-13 17:31:31 +04: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 21:47:53 +03:00
|
|
|
* frame with observers and invalidate them instead.
|
|
|
|
*
|
|
|
|
* Note that this method is very different to e.g.
|
2010-08-13 17:31:31 +04: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 16:19:50 +04:00
|
|
|
* things in parentheses in the preceding sentence, this method uses
|
2010-01-23 21:47:53 +03:00
|
|
|
* knowledge about our implementation and what can be affected by SVG effects
|
|
|
|
* to make invalidation relatively lightweight when an SVG effect changes.
|
2008-10-01 04:51:05 +04:00
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void InvalidateRenderingObservers(nsIFrame* aFrame);
|
2012-08-29 09:49:16 +04:00
|
|
|
|
|
|
|
enum {
|
|
|
|
INVALIDATE_REFLOW = 1
|
|
|
|
};
|
|
|
|
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
2010-08-13 17:31:31 +04:00
|
|
|
* This can be called on any element or frame. Only direct observers of this
|
|
|
|
* (frame's) element, if any, are invalidated.
|
2008-10-01 04:51:05 +04:00
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static void InvalidateDirectRenderingObservers(Element* aElement, uint32_t aFlags = 0);
|
|
|
|
static void InvalidateDirectRenderingObservers(nsIFrame* aFrame, uint32_t aFlags = 0);
|
2008-10-01 04:51:05 +04:00
|
|
|
|
2008-10-10 17:14:05 +04:00
|
|
|
/**
|
|
|
|
* Get an nsSVGMarkerProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGMarkerProperty *
|
2016-08-02 14:06:14 +03:00
|
|
|
GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
|
2016-06-21 23:17:11 +03:00
|
|
|
const mozilla::FramePropertyDescriptor<nsSVGMarkerProperty>* aProperty);
|
2008-10-11 15:29:35 +04:00
|
|
|
/**
|
|
|
|
* Get an nsSVGTextPathProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
|
|
|
static nsSVGTextPathProperty *
|
2016-08-02 14:06:14 +03:00
|
|
|
GetTextPathProperty(nsIURI* aURI, nsIFrame* aFrame,
|
2016-06-21 23:17:11 +03:00
|
|
|
const mozilla::FramePropertyDescriptor<nsSVGTextPathProperty>* aProperty);
|
2008-10-01 04:51:05 +04:00
|
|
|
/**
|
|
|
|
* Get an nsSVGPaintingProperty for the frame, creating a fresh one if necessary
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static nsSVGPaintingProperty*
|
|
|
|
GetPaintingProperty(nsIURI* aURI, nsIFrame* aFrame,
|
2016-06-21 23:17:11 +03:00
|
|
|
const mozilla::FramePropertyDescriptor<nsSVGPaintingProperty>* aProperty);
|
2010-08-13 17:30:45 +04:00
|
|
|
/**
|
|
|
|
* Get an nsSVGPaintingProperty for the frame for that URI, creating a fresh
|
|
|
|
* one if necessary
|
|
|
|
*/
|
2016-08-02 14:06:14 +03:00
|
|
|
static nsSVGPaintingProperty*
|
|
|
|
GetPaintingPropertyForURI(nsIURI* aURI, nsIFrame* aFrame,
|
2016-01-28 06:23:59 +03:00
|
|
|
URIObserverHashtablePropertyDescriptor aProp);
|
2016-06-23 21:11:51 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper function to resolve marker's URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
2016-10-11 09:56:11 +03:00
|
|
|
GetMarkerURI(nsIFrame* aFrame,
|
|
|
|
RefPtr<mozilla::css::URLValue> nsStyleSVG::* aMarker);
|
2016-07-04 19:59:57 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper function to resolve clip-path URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetClipPathURI(nsIFrame* aFrame);
|
2016-07-23 11:16:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper function to resolve filter URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetFilterURI(nsIFrame* aFrame, uint32_t aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper function to resolve filter URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetFilterURI(nsIFrame* aFrame, const nsStyleFilter& aFilter);
|
2016-07-04 20:00:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper function to resolve paint-server URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetPaintURI(nsIFrame* aFrame, nsStyleSVGPaint nsStyleSVG::* aPaint);
|
2016-08-06 01:38:44 +03:00
|
|
|
|
2017-04-20 10:58:19 +03:00
|
|
|
/**
|
2016-08-06 01:38:44 +03:00
|
|
|
* A helper function to resolve SVG mask URL.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetMaskURI(nsIFrame* aFrame, uint32_t aIndex);
|
2017-04-20 10:58:19 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a baseURL for resolving a local-ref URL.
|
|
|
|
*
|
|
|
|
* @param aContent an element which uses a local-ref property. Here are some
|
|
|
|
* examples:
|
|
|
|
* <rect fill=url(#foo)>
|
|
|
|
* <circle clip-path=url(#foo)>
|
|
|
|
* <use xlink:href="#foo">
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsIURI>
|
|
|
|
GetBaseURLForLocalRef(nsIContent* aContent, nsIURI* aDocURI);
|
2008-08-08 05:34:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*NSSVGEFFECTS_H_*/
|