mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1488700 p7. Rename nsSVGFilterChainObserver to SVGFilterObserverList. r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D5619 --HG-- extra : rebase_source : 57f4bf14b801b4d723969843e7d54a86f97917ab
This commit is contained in:
parent
e729179571
commit
0d7aef1b78
@ -958,13 +958,13 @@ private:
|
||||
CanvasRenderingContext2D* mContext;
|
||||
};
|
||||
|
||||
class CanvasFilterChainObserver : public nsSVGFilterChainObserver
|
||||
class CanvasFilterChainObserver : public SVGFilterObserverList
|
||||
{
|
||||
public:
|
||||
CanvasFilterChainObserver(nsTArray<nsStyleFilter>& aFilters,
|
||||
Element* aCanvasElement,
|
||||
CanvasRenderingContext2D* aContext)
|
||||
: nsSVGFilterChainObserver(aFilters, aCanvasElement)
|
||||
: SVGFilterObserverList(aFilters, aCanvasElement)
|
||||
, mContext(aContext)
|
||||
{
|
||||
}
|
||||
@ -1004,12 +1004,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CanvasRenderingContext2D)
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].patternStyles[Style::FILL]);
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].gradientStyles[Style::STROKE]);
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].gradientStyles[Style::FILL]);
|
||||
auto filterChainObserver =
|
||||
static_cast<CanvasFilterChainObserver*>(tmp->mStyleStack[i].filterChainObserver.get());
|
||||
if (filterChainObserver) {
|
||||
filterChainObserver->DetachFromContext();
|
||||
auto filterObserverList =
|
||||
static_cast<CanvasFilterChainObserver*>(tmp->mStyleStack[i].filterObserverList.get());
|
||||
if (filterObserverList) {
|
||||
filterObserverList->DetachFromContext();
|
||||
}
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].filterChainObserver);
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].filterObserverList);
|
||||
}
|
||||
for (size_t x = 0 ; x < tmp->mHitRegionsOptions.Length(); x++) {
|
||||
RegionInfo& info = tmp->mHitRegionsOptions[x];
|
||||
@ -1028,7 +1028,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CanvasRenderingContext2D)
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].patternStyles[Style::FILL], "Fill CanvasPattern");
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].gradientStyles[Style::STROKE], "Stroke CanvasGradient");
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].gradientStyles[Style::FILL], "Fill CanvasGradient");
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].filterChainObserver, "Filter Chain Observer");
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].filterObserverList, "Filter Observer List");
|
||||
}
|
||||
for (size_t x = 0 ; x < tmp->mHitRegionsOptions.Length(); x++) {
|
||||
RegionInfo& info = tmp->mHitRegionsOptions[x];
|
||||
@ -2825,7 +2825,7 @@ CanvasRenderingContext2D::SetFilter(const nsAString& aFilter, ErrorResult& aErro
|
||||
CurrentState().filterString = aFilter;
|
||||
filterChain.SwapElements(CurrentState().filterChain);
|
||||
if (mCanvasElement) {
|
||||
CurrentState().filterChainObserver =
|
||||
CurrentState().filterObserverList =
|
||||
new CanvasFilterChainObserver(CurrentState().filterChain,
|
||||
mCanvasElement, this);
|
||||
UpdateFilter();
|
||||
|
@ -1052,7 +1052,7 @@ protected:
|
||||
lineJoin(aOther.lineJoin),
|
||||
filterString(aOther.filterString),
|
||||
filterChain(aOther.filterChain),
|
||||
filterChainObserver(aOther.filterChainObserver),
|
||||
filterObserverList(aOther.filterObserverList),
|
||||
filter(aOther.filter),
|
||||
filterAdditionalImages(aOther.filterAdditionalImages),
|
||||
filterSourceGraphicTainted(aOther.filterSourceGraphicTainted),
|
||||
@ -1130,7 +1130,7 @@ protected:
|
||||
|
||||
nsString filterString;
|
||||
nsTArray<nsStyleFilter> filterChain;
|
||||
RefPtr<nsSVGFilterChainObserver> filterChainObserver;
|
||||
RefPtr<SVGFilterObserverList> filterObserverList;
|
||||
mozilla::gfx::FilterDescription filter;
|
||||
nsTArray<RefPtr<mozilla::gfx::SourceSurface>> filterAdditionalImages;
|
||||
|
||||
|
@ -263,30 +263,30 @@ SVGFilterObserver::OnRenderingChange()
|
||||
{
|
||||
SVGIDRenderingObserver::OnRenderingChange();
|
||||
|
||||
if (mFilterChainObserver) {
|
||||
mFilterChainObserver->Invalidate();
|
||||
if (mFilterObserverList) {
|
||||
mFilterObserverList->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGFilterChainObserver)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGFilterChainObserver)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(SVGFilterObserverList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGFilterObserverList)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsSVGFilterChainObserver)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGFilterObserverList)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsSVGFilterChainObserver)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(SVGFilterObserverList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObservers)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsSVGFilterChainObserver)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(SVGFilterObserverList)
|
||||
tmp->DetachObservers();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mObservers);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGFilterChainObserver)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGFilterObserverList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsSVGFilterChainObserver::nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters,
|
||||
SVGFilterObserverList::SVGFilterObserverList(const nsTArray<nsStyleFilter>& aFilters,
|
||||
nsIContent* aFilteredElement,
|
||||
nsIFrame* aFilteredFrame)
|
||||
{
|
||||
@ -306,13 +306,13 @@ nsSVGFilterChainObserver::nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>
|
||||
}
|
||||
}
|
||||
|
||||
nsSVGFilterChainObserver::~nsSVGFilterChainObserver()
|
||||
SVGFilterObserverList::~SVGFilterObserverList()
|
||||
{
|
||||
DetachObservers();
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFilterChainObserver::ReferencesValidResources()
|
||||
SVGFilterObserverList::ReferencesValidResources()
|
||||
{
|
||||
for (uint32_t i = 0; i < mObservers.Length(); i++) {
|
||||
if (!mObservers[i]->ReferencesValidResource()) {
|
||||
@ -323,7 +323,7 @@ nsSVGFilterChainObserver::ReferencesValidResources()
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFilterChainObserver::IsInObserverLists() const
|
||||
SVGFilterObserverList::IsInObserverLists() const
|
||||
{
|
||||
for (uint32_t i = 0; i < mObservers.Length(); i++) {
|
||||
if (!mObservers[i]->IsInObserverList()) {
|
||||
|
@ -32,7 +32,7 @@ class nsSVGPaintServerFrame;
|
||||
class nsSVGFilterFrame;
|
||||
class nsSVGMaskFrame;
|
||||
namespace mozilla {
|
||||
class nsSVGFilterChainObserver;
|
||||
class SVGFilterObserverList;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
@ -236,22 +236,22 @@ protected:
|
||||
* 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 SVGFilterObservers.
|
||||
* The SVGFilterObserverList class manages a list of SVGFilterObservers.
|
||||
*/
|
||||
class SVGFilterObserver final : public SVGIDRenderingObserver
|
||||
{
|
||||
public:
|
||||
SVGFilterObserver(nsIURI* aURI,
|
||||
nsIContent* aObservingContent,
|
||||
nsSVGFilterChainObserver* aFilterChainObserver)
|
||||
SVGFilterObserverList* aFilterChainObserver)
|
||||
: SVGIDRenderingObserver(aURI, aObservingContent, false)
|
||||
, mFilterChainObserver(aFilterChainObserver)
|
||||
, mFilterObserverList(aFilterChainObserver)
|
||||
{
|
||||
}
|
||||
|
||||
bool ReferencesValidResource() { return GetFilterFrame(); }
|
||||
|
||||
void DetachFromChainObserver() { mFilterChainObserver = nullptr; }
|
||||
void DetachFromChainObserver() { mFilterObserverList = nullptr; }
|
||||
|
||||
/**
|
||||
* @return the filter frame, or null if there is no filter frame
|
||||
@ -272,7 +272,7 @@ protected:
|
||||
virtual void OnRenderingChange() override;
|
||||
|
||||
private:
|
||||
nsSVGFilterChainObserver* mFilterChainObserver;
|
||||
SVGFilterObserverList* mFilterObserverList;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(SVGFilterObserver, NS_SVGFILTEROBSERVER_IID)
|
||||
@ -282,16 +282,16 @@ NS_DEFINE_STATIC_IID_ACCESSOR(SVGFilterObserver, NS_SVGFILTEROBSERVER_IID)
|
||||
* reference to SVG filters in a list of filters in a given 'filter' property.
|
||||
* e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);
|
||||
*
|
||||
* In the above example, the nsSVGFilterChainObserver will manage two
|
||||
* In the above example, the SVGFilterObserverList will manage two
|
||||
* SVGFilterObservers, one for each of the references to SVG filters. CSS
|
||||
* filters like "blur(10px)" don't reference filter elements, so they don't
|
||||
* need an SVGFilterObserver. The style system invalidates changes to CSS
|
||||
* filters.
|
||||
*/
|
||||
class nsSVGFilterChainObserver : public nsISupports
|
||||
class SVGFilterObserverList : public nsISupports
|
||||
{
|
||||
public:
|
||||
nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>& aFilters,
|
||||
SVGFilterObserverList(const nsTArray<nsStyleFilter>& aFilters,
|
||||
nsIContent* aFilteredElement,
|
||||
nsIFrame* aFiltedFrame = nullptr);
|
||||
|
||||
@ -301,10 +301,10 @@ public:
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsSVGFilterChainObserver)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(SVGFilterObserverList)
|
||||
|
||||
protected:
|
||||
virtual ~nsSVGFilterChainObserver();
|
||||
virtual ~SVGFilterObserverList();
|
||||
|
||||
virtual void OnRenderingChange() = 0;
|
||||
|
||||
@ -320,12 +320,12 @@ private:
|
||||
nsTArray<RefPtr<SVGFilterObserver>> mObservers;
|
||||
};
|
||||
|
||||
class nsSVGFilterProperty : public nsSVGFilterChainObserver
|
||||
class nsSVGFilterProperty : public SVGFilterObserverList
|
||||
{
|
||||
public:
|
||||
nsSVGFilterProperty(const nsTArray<nsStyleFilter>& aFilters,
|
||||
nsIFrame* aFilteredFrame)
|
||||
: nsSVGFilterChainObserver(aFilters, aFilteredFrame->GetContent(),
|
||||
: SVGFilterObserverList(aFilters, aFilteredFrame->GetContent(),
|
||||
aFilteredFrame)
|
||||
, mFrameReference(aFilteredFrame)
|
||||
{}
|
||||
|
Loading…
Reference in New Issue
Block a user