2017-10-27 17:33:53 +00: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 11:12:37 +00: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 01:34:43 +00:00
|
|
|
|
|
|
|
#ifndef NSSVGEFFECTS_H_
|
|
|
|
#define NSSVGEFFECTS_H_
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-09-08 09:02:05 +00:00
|
|
|
#include "mozilla/dom/IDTracker.h"
|
2017-05-27 11:36:00 +00:00
|
|
|
#include "FrameProperties.h"
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsID.h"
|
2008-08-08 01:34:43 +00:00
|
|
|
#include "nsIFrame.h"
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "nsIMutationObserver.h"
|
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
#include "nsISupportsBase.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2018-08-21 13:54:26 +00:00
|
|
|
#include "nsStringFwd.h"
|
2008-08-08 01:34:43 +00:00
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "nsTHashtable.h"
|
2010-08-13 13:30:45 +00:00
|
|
|
#include "nsURIHashKey.h"
|
2014-09-09 15:14:46 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-08-08 01:34:43 +00:00
|
|
|
|
2017-10-02 22:05:19 +00:00
|
|
|
class nsAtom;
|
2012-03-20 12:15:55 +00:00
|
|
|
class nsIURI;
|
2008-10-01 00:51:05 +00:00
|
|
|
class nsSVGClipPathFrame;
|
2018-08-16 17:08:21 +00:00
|
|
|
class nsSVGMarkerFrame;
|
2012-08-05 19:10:21 +00:00
|
|
|
class nsSVGPaintServerFrame;
|
2008-10-01 00:51:05 +00:00
|
|
|
class nsSVGFilterFrame;
|
|
|
|
class nsSVGMaskFrame;
|
2018-08-09 09:04:36 +00:00
|
|
|
namespace mozilla {
|
2018-08-15 20:32:04 +00:00
|
|
|
namespace dom {
|
2018-09-03 10:24:27 +00:00
|
|
|
class CanvasRenderingContext2D;
|
2018-08-15 20:32:04 +00:00
|
|
|
class SVGGeometryElement;
|
|
|
|
}
|
2018-08-09 09:04:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace mozilla {
|
2008-10-01 00:51:05 +00:00
|
|
|
|
2018-09-17 05:37:01 +00:00
|
|
|
/*
|
|
|
|
* This class contains URL and referrer information (referrer and referrer
|
|
|
|
* policy).
|
|
|
|
* We use it to pass to svg system instead of nsIURI. The object brings referrer
|
|
|
|
* and referrer policy so we can send correct Referer headers.
|
|
|
|
*/
|
|
|
|
class URLAndReferrerInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
URLAndReferrerInfo(nsIURI* aURI, nsIURI* aReferrer,
|
|
|
|
mozilla::net::ReferrerPolicy aReferrerPolicy)
|
|
|
|
: mURI(aURI)
|
|
|
|
, mReferrer(aReferrer)
|
|
|
|
, mReferrerPolicy(aReferrerPolicy)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(URLAndReferrerInfo)
|
|
|
|
|
|
|
|
nsIURI* GetURI() { return mURI; }
|
|
|
|
nsIURI* GetReferrer() { return mReferrer; }
|
|
|
|
mozilla::net::ReferrerPolicy GetReferrerPolicy() { return mReferrerPolicy; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
~URLAndReferrerInfo() = default;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
nsCOMPtr<nsIURI> mReferrer;
|
|
|
|
mozilla::net::ReferrerPolicy mReferrerPolicy;
|
|
|
|
};
|
|
|
|
|
2018-09-04 09:04:07 +00:00
|
|
|
/**
|
2010-09-08 20:40:39 +00:00
|
|
|
* This interface allows us to be notified when a piece of SVG content is
|
|
|
|
* re-rendered.
|
|
|
|
*
|
2018-09-04 09:04:07 +00:00
|
|
|
* Concrete implementations of this base class need to implement
|
|
|
|
* GetReferencedElementWithoutObserving to specify the SVG element that
|
|
|
|
* they'd like to monitor for rendering changes, 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 StopObserving, respectively.
|
|
|
|
*
|
|
|
|
* The referenced element is generally looked up and stored during
|
|
|
|
* construction. If the referenced element is in an extenal SVG resource
|
|
|
|
* document, the lookup code will initiate loading of the external resource and
|
|
|
|
* OnRenderingChange will be called once the element in the external resource
|
|
|
|
* is available.
|
|
|
|
*
|
|
|
|
* Although the referenced element may be found and stored during construction,
|
|
|
|
* observing for rendering changes does not start until requested.
|
2008-10-01 00:51:05 +00:00
|
|
|
*/
|
2018-08-09 09:29:01 +00:00
|
|
|
class SVGRenderingObserver : public nsStubMutationObserver
|
2016-05-19 07:44:42 +00:00
|
|
|
{
|
2018-10-01 23:58:09 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~SVGRenderingObserver() = default;
|
|
|
|
|
2008-08-08 01:34:43 +00:00
|
|
|
public:
|
2010-08-13 13:31:31 +00:00
|
|
|
typedef mozilla::dom::Element Element;
|
2018-08-09 09:29:01 +00:00
|
|
|
|
|
|
|
SVGRenderingObserver()
|
2011-10-17 14:59:28 +00:00
|
|
|
: mInObserverList(false)
|
2018-08-09 09:29:01 +00:00
|
|
|
{}
|
2008-08-08 01:34:43 +00:00
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2017-09-15 13:54:27 +00: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 18:35:59 +00:00
|
|
|
|
2018-08-09 09:29:01 +00:00
|
|
|
// When a SVGRenderingObserver list gets forcibly cleared, it uses this
|
2010-11-16 18:35:59 +00:00
|
|
|
// callback to notify every observer that's cleared from it, so they can
|
|
|
|
// react.
|
2018-09-24 10:45:17 +00:00
|
|
|
void NotifyEvictedFromRenderingObserverSet();
|
2010-11-16 18:35:59 +00:00
|
|
|
|
2018-09-04 09:04:07 +00:00
|
|
|
nsIFrame* GetAndObserveReferencedFrame();
|
2008-10-01 00:51:05 +00:00
|
|
|
/**
|
|
|
|
* @param aOK this is only for the convenience of callers. We set *aOK to false
|
2010-12-19 17:47:01 +00:00
|
|
|
* if the frame is the wrong type
|
2008-10-01 00:51:05 +00:00
|
|
|
*/
|
2018-09-04 09:04:07 +00:00
|
|
|
nsIFrame* GetAndObserveReferencedFrame(mozilla::LayoutFrameType aFrameType,
|
|
|
|
bool* aOK);
|
2008-10-01 00:51:05 +00:00
|
|
|
|
2018-09-04 09:04:07 +00:00
|
|
|
Element* GetAndObserveReferencedElement();
|
2010-09-08 20:40:39 +00:00
|
|
|
|
2012-08-29 05:49:16 +00:00
|
|
|
virtual bool ObservesReflow() { return true; }
|
|
|
|
|
2008-08-08 01:34:43 +00:00
|
|
|
protected:
|
2017-09-14 08:47:19 +00:00
|
|
|
void StartObserving();
|
|
|
|
void StopObserving();
|
2008-08-08 01:34:43 +00:00
|
|
|
|
2017-09-15 09:01:34 +00: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-08 20:40:39 +00:00
|
|
|
|
2018-09-04 09:04:07 +00:00
|
|
|
virtual Element* GetReferencedElementWithoutObserving() = 0;
|
2010-09-08 20:40:39 +00:00
|
|
|
|
2010-08-13 13:31:31 +00:00
|
|
|
#ifdef DEBUG
|
2018-09-21 18:09:41 +00:00
|
|
|
void DebugObserverSet();
|
2010-08-13 13:31:31 +00:00
|
|
|
#endif
|
2008-08-08 01:34:43 +00:00
|
|
|
|
2018-09-21 18:09:41 +00:00
|
|
|
// Whether we're in our referenced element's observer list at this time.
|
|
|
|
bool mInObserverList;
|
2008-08-08 01:34:43 +00:00
|
|
|
};
|
|
|
|
|
2018-09-21 18:09:41 +00:00
|
|
|
|
2017-08-30 14:58:31 +00:00
|
|
|
class SVGObserverUtils
|
2016-05-19 07:44:42 +00:00
|
|
|
{
|
2008-08-08 01:34:43 +00:00
|
|
|
public:
|
2018-09-03 10:24:27 +00:00
|
|
|
typedef mozilla::dom::CanvasRenderingContext2D CanvasRenderingContext2D;
|
2010-08-13 13:31:31 +00:00
|
|
|
typedef mozilla::dom::Element Element;
|
2018-08-15 20:32:04 +00:00
|
|
|
typedef dom::SVGGeometryElement SVGGeometryElement;
|
2018-09-21 18:09:41 +00:00
|
|
|
using HrefToTemplateCallback = const std::function<void(nsAString&)>&;
|
2010-03-29 01:46:55 +00:00
|
|
|
|
2018-09-04 12:50:22 +00:00
|
|
|
/**
|
|
|
|
* Ensures that that if the given frame requires any resources that are in
|
|
|
|
* SVG resource documents that the loading of those documents is initiated.
|
|
|
|
* This does not make aFrame start to observe any elements that it
|
|
|
|
* references.
|
|
|
|
*/
|
|
|
|
static void InitiateResourceDocLoads(nsIFrame* aFrame);
|
|
|
|
|
2008-08-08 01:34:43 +00:00
|
|
|
/**
|
2012-11-07 13:54:55 +00: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 01:34:43 +00:00
|
|
|
*/
|
2016-08-02 11:06:14 +00:00
|
|
|
static void UpdateEffects(nsIFrame* aFrame);
|
2012-11-07 13:54:55 +00:00
|
|
|
|
2008-10-01 00:51:05 +00:00
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2018-08-09 09:29:01 +00:00
|
|
|
static void AddRenderingObserver(Element* aElement,
|
|
|
|
SVGRenderingObserver *aObserver);
|
2008-10-01 00:51:05 +00:00
|
|
|
/**
|
|
|
|
* @param aFrame must be a first-continuation.
|
|
|
|
*/
|
2018-08-09 09:29:01 +00:00
|
|
|
static void RemoveRenderingObserver(Element* aElement,
|
|
|
|
SVGRenderingObserver *aObserver);
|
2010-11-16 18:35:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all rendering observers from aElement.
|
|
|
|
*/
|
2016-08-02 11:06:14 +00:00
|
|
|
static void RemoveAllRenderingObservers(Element* aElement);
|
2010-11-16 18:35:59 +00:00
|
|
|
|
2008-10-01 00:51:05 +00:00
|
|
|
/**
|
2010-08-13 13:31:31 +00: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 18:47:53 +00:00
|
|
|
* frame with observers and invalidate them instead.
|
|
|
|
*
|
|
|
|
* Note that this method is very different to e.g.
|
2010-08-13 13:31:31 +00: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 12:19:50 +00:00
|
|
|
* things in parentheses in the preceding sentence, this method uses
|
2010-01-23 18:47:53 +00: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 00:51:05 +00:00
|
|
|
*/
|
2016-08-02 11:06:14 +00:00
|
|
|
static void InvalidateRenderingObservers(nsIFrame* aFrame);
|
2012-08-29 05:49:16 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
INVALIDATE_REFLOW = 1
|
|
|
|
};
|
|
|
|
|
2018-08-29 18:11:43 +00:00
|
|
|
enum ReferenceState {
|
|
|
|
/// Has no references to SVG filters (may still have CSS filter functions!)
|
|
|
|
eHasNoRefs,
|
|
|
|
eHasRefsAllValid,
|
|
|
|
eHasRefsSomeInvalid,
|
|
|
|
};
|
|
|
|
|
2008-10-01 00:51:05 +00:00
|
|
|
/**
|
2010-08-13 13:31:31 +00: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 00:51:05 +00:00
|
|
|
*/
|
2016-08-02 11:06:14 +00:00
|
|
|
static void InvalidateDirectRenderingObservers(Element* aElement, uint32_t aFlags = 0);
|
|
|
|
static void InvalidateDirectRenderingObservers(nsIFrame* aFrame, uint32_t aFlags = 0);
|
2008-10-01 00:51:05 +00:00
|
|
|
|
2018-08-15 10:54:27 +00:00
|
|
|
/**
|
2018-09-25 20:16:49 +00:00
|
|
|
* Get the paint server for aPaintedFrame.
|
2018-08-15 10:54:27 +00:00
|
|
|
*/
|
2018-09-25 20:16:49 +00:00
|
|
|
static nsSVGPaintServerFrame*
|
|
|
|
GetAndObservePaintServer(nsIFrame* aPaintedFrame,
|
|
|
|
nsStyleSVGPaint nsStyleSVG::* aPaint);
|
2018-08-15 10:54:27 +00:00
|
|
|
|
2008-10-10 13:14:05 +00:00
|
|
|
/**
|
2018-08-16 17:08:21 +00:00
|
|
|
* Get the start/mid/end-markers for the given frame, and add the frame as
|
|
|
|
* an observer to those markers. Returns true if at least one marker type is
|
|
|
|
* found, false otherwise.
|
2008-10-10 13:14:05 +00:00
|
|
|
*/
|
2018-08-16 17:08:21 +00:00
|
|
|
static bool
|
2018-09-25 20:16:49 +00:00
|
|
|
GetAndObserveMarkers(nsIFrame* aMarkedFrame, nsSVGMarkerFrame*(*aFrames)[3]);
|
2018-08-15 20:32:04 +00:00
|
|
|
|
2018-08-29 18:11:43 +00:00
|
|
|
/**
|
|
|
|
* Get the frames of the SVG filters applied to the given frame, and add the
|
|
|
|
* frame as an observer to those filter frames.
|
|
|
|
*
|
|
|
|
* NOTE! A return value of eHasNoRefs does NOT mean that there are no filters
|
|
|
|
* to be applied, only that there are no references to SVG filter elements.
|
|
|
|
*
|
|
|
|
* XXX Callers other than ComputePostEffectsVisualOverflowRect and
|
|
|
|
* nsSVGUtils::GetPostFilterVisualOverflowRect should not need to initiate
|
|
|
|
* observing. If we have a bug that causes invalidation (which would remove
|
|
|
|
* observers) between reflow and painting, then we don't really want to
|
|
|
|
* re-add abservers during painting. That has the potential to hide logic
|
|
|
|
* bugs, or cause later invalidation problems. However, let's not change
|
|
|
|
* that behavior just yet due to the regression potential.
|
|
|
|
*/
|
|
|
|
static ReferenceState
|
|
|
|
GetAndObserveFilters(nsIFrame* aFilteredFrame,
|
|
|
|
nsTArray<nsSVGFilterFrame*>* aFilterFrames);
|
|
|
|
|
2018-09-03 17:09:41 +00:00
|
|
|
/**
|
|
|
|
* If the given frame is already observing SVG filters, this function gets
|
|
|
|
* those filters. If the frame is not already observing filters this
|
|
|
|
* function assumes that it doesn't have anything to observe.
|
|
|
|
*/
|
|
|
|
static ReferenceState
|
|
|
|
GetFiltersIfObserving(nsIFrame* aFilteredFrame,
|
|
|
|
nsTArray<nsSVGFilterFrame*>* aFilterFrames);
|
|
|
|
|
2018-09-03 10:24:27 +00:00
|
|
|
/**
|
|
|
|
* Starts observing filters for a <canvas> element's CanvasRenderingContext2D.
|
|
|
|
*
|
|
|
|
* Returns a RAII object that the caller should make sure is released once
|
|
|
|
* the CanvasRenderingContext2D is no longer using them (that is, when the
|
|
|
|
* CanvasRenderingContext2D "drawing style state" on which the filters were
|
|
|
|
* set is destroyed or has its filter style reset).
|
|
|
|
*
|
|
|
|
* XXXjwatt: It's a bit unfortunate that both we and
|
|
|
|
* CanvasRenderingContext2D::UpdateFilter process the list of nsStyleFilter
|
|
|
|
* objects separately. It would be better to refactor things so that we only
|
|
|
|
* do that work once.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<nsISupports>
|
|
|
|
ObserveFiltersForCanvasContext(CanvasRenderingContext2D* aContext,
|
|
|
|
Element* aCanvasElement,
|
|
|
|
nsTArray<nsStyleFilter>& aFilters);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when cycle collecting CanvasRenderingContext2D, and requires the
|
|
|
|
* RAII object returned from ObserveFiltersForCanvasContext to be passed in.
|
|
|
|
*
|
|
|
|
* XXXjwatt: I don't think this is doing anything useful. All we do under
|
|
|
|
* this function is clear a raw C-style (i.e. not strong) pointer. That's
|
|
|
|
* clearly not helping in breaking any cycles. The fact that we MOZ_CRASH
|
|
|
|
* in OnRenderingChange if that pointer is null indicates that this isn't
|
|
|
|
* even doing anything useful in terms of preventing further invalidation
|
|
|
|
* from any observed filters.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
DetachFromCanvasContext(nsISupports* aAutoObserver);
|
|
|
|
|
2018-09-05 17:12:44 +00:00
|
|
|
/**
|
|
|
|
* Get the frame of the SVG clipPath applied to aClippedFrame, if any, and
|
|
|
|
* set up aClippedFrame as a rendering observer of the clipPath's frame, to
|
|
|
|
* be invalidated if it changes.
|
|
|
|
*
|
|
|
|
* Currently we only have support for 'clip-path' with a single item, but the
|
|
|
|
* spec. now says 'clip-path' can be set to an arbitrary number of items.
|
|
|
|
* Once we support that, aClipPathFrame will need to be an nsTArray as it
|
|
|
|
* is for 'filter' and 'mask'. Currently a return value of eHasNoRefs means
|
|
|
|
* that there is no clipping at all, but once we support more than one item
|
|
|
|
* then - as for filter and mask - we could still have basic shape clipping
|
|
|
|
* to apply even if there are no references to SVG clipPath elements.
|
|
|
|
*
|
|
|
|
* Note that, unlike for filters, a reference to an ID that doesn't exist
|
|
|
|
* is not invalid for clip-path or mask. We will return eHasNoRefs in that
|
|
|
|
* case.
|
|
|
|
*/
|
|
|
|
static ReferenceState
|
|
|
|
GetAndObserveClipPath(nsIFrame* aClippedFrame,
|
|
|
|
nsSVGClipPathFrame** aClipPathFrame);
|
|
|
|
|
2018-09-19 14:54:27 +00:00
|
|
|
/**
|
|
|
|
* If masking is applied to aMaskedFrame, gets an array of any SVG masks
|
|
|
|
* that are referenced, setting up aMaskFrames as a rendering observer of
|
|
|
|
* those masks (if any).
|
|
|
|
*
|
|
|
|
* NOTE! A return value of eHasNoRefs does NOT mean that there are no masks
|
|
|
|
* to be applied, only that there are no references to SVG mask elements.
|
|
|
|
*
|
|
|
|
* Note that, unlike for filters, a reference to an ID that doesn't exist
|
|
|
|
* is not invalid for clip-path or mask. We will return eHasNoRefs in that
|
|
|
|
* case.
|
|
|
|
*/
|
|
|
|
static ReferenceState
|
|
|
|
GetAndObserveMasks(nsIFrame* aMaskedFrame,
|
|
|
|
nsTArray<nsSVGMaskFrame*>* aMaskFrames);
|
|
|
|
|
2018-08-15 20:32:04 +00:00
|
|
|
/**
|
|
|
|
* Get the SVGGeometryElement that is referenced by aTextPathFrame, and make
|
|
|
|
* aTextPathFrame start observing rendering changes to that element.
|
|
|
|
*/
|
|
|
|
static SVGGeometryElement*
|
2018-09-25 20:16:49 +00:00
|
|
|
GetAndObserveTextPathsPath(nsIFrame* aTextPathFrame);
|
2018-08-15 20:32:04 +00:00
|
|
|
|
2008-10-11 11:29:35 +00:00
|
|
|
/**
|
2018-08-15 20:32:04 +00:00
|
|
|
* Make aTextPathFrame stop observing rendering changes to the
|
|
|
|
* SVGGeometryElement that it references, if any.
|
2008-10-11 11:29:35 +00:00
|
|
|
*/
|
2018-08-15 20:32:04 +00:00
|
|
|
static void
|
|
|
|
RemoveTextPathObserver(nsIFrame* aTextPathFrame);
|
|
|
|
|
2018-08-21 13:54:26 +00:00
|
|
|
/**
|
|
|
|
* Gets the nsIFrame of a referenced SVG "template" element, if any, and
|
|
|
|
* makes aFrame start observing rendering changes to the template element.
|
|
|
|
*
|
|
|
|
* Template elements: some elements like gradients, pattern or filter can
|
|
|
|
* reference another element of the same type using their 'href' attribute,
|
|
|
|
* and use that element as a template that provides attributes or content
|
|
|
|
* that is missing from the referring element.
|
|
|
|
*
|
|
|
|
* The frames that this function is called for do not have a common base
|
|
|
|
* class, which is why it is necessary to pass in a function that can be
|
|
|
|
* used as a callback to lazily get the href value, if necessary.
|
|
|
|
*/
|
|
|
|
static nsIFrame*
|
2018-09-25 20:16:49 +00:00
|
|
|
GetAndObserveTemplate(nsIFrame* aFrame, HrefToTemplateCallback aGetHref);
|
2018-08-21 13:54:26 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
RemoveTemplateObserver(nsIFrame* aFrame);
|
2018-08-17 15:57:30 +00:00
|
|
|
|
2018-09-20 12:50:23 +00:00
|
|
|
static Element*
|
|
|
|
GetAndObserveBackgroundImage(nsIFrame* aFrame,
|
|
|
|
const nsAtom* aHref);
|
2016-06-23 18:11:51 +00:00
|
|
|
|
2016-07-23 08:16:59 +00:00
|
|
|
/**
|
|
|
|
* A helper function to resolve filter URL.
|
|
|
|
*/
|
2018-09-17 05:37:01 +00:00
|
|
|
static already_AddRefed<URLAndReferrerInfo>
|
2016-07-23 08:16:59 +00:00
|
|
|
GetFilterURI(nsIFrame* aFrame, const nsStyleFilter& aFilter);
|
2016-07-04 17:00:15 +00:00
|
|
|
|
2017-04-20 07:58:19 +00: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 01:34:43 +00:00
|
|
|
};
|
|
|
|
|
2018-08-09 09:04:36 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2008-08-08 01:34:43 +00:00
|
|
|
#endif /*NSSVGEFFECTS_H_*/
|