Bug 1856362 part 1 - rename SVGFE to SVGFilterPrimitiveelement and SVGFEUnstyledElement to SVGFilterPrimitiveChildElement r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D189857
This commit is contained in:
Robert Longson 2023-10-03 10:40:45 +00:00
Родитель 4cb1ea6609
Коммит d2dacc2146
41 изменённых файлов: 106 добавлений и 89 удалений

Просмотреть файл

@ -23,7 +23,7 @@ namespace mozilla::dom {
class DOMSVGAnimatedNumberList;
using SVGComponentTransferFunctionElementBase = SVGFEUnstyledElement;
using SVGComponentTransferFunctionElementBase = SVGFilterPrimitiveChildElement;
class SVGComponentTransferFunctionElement
: public SVGComponentTransferFunctionElementBase {

Просмотреть файл

@ -96,7 +96,7 @@ nsresult SVGFEBlendElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feBlend);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEBlendElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFEBlendElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla::dom {
using SVGFEBlendElementBase = SVGFE;
using SVGFEBlendElementBase = SVGFilterPrimitiveElement;
class SVGFEBlendElement final : public SVGFEBlendElementBase {
friend nsresult(::NS_NewSVGFEBlendElement(

Просмотреть файл

@ -113,7 +113,7 @@ nsresult SVGFEColorMatrixElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feColorMatrix);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEColorMatrixElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -18,7 +18,7 @@ namespace mozilla::dom {
class DOMSVGAnimatedNumberList;
using SVGFEColorMatrixElementBase = SVGFE;
using SVGFEColorMatrixElementBase = SVGFilterPrimitiveElement;
class SVGFEColorMatrixElement final : public SVGFEColorMatrixElementBase {
friend nsresult(::NS_NewSVGFEColorMatrixElement(

Просмотреть файл

@ -95,7 +95,7 @@ nsresult SVGFEComponentTransferElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feComponentTransfer);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEComponentTransferElementBase::BindToTree(aCtx, aParent);
}
} // namespace mozilla::dom

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFEComponentTransferElement(
namespace mozilla::dom {
using SVGFEComponentTransferElementBase = SVGFE;
using SVGFEComponentTransferElementBase = SVGFilterPrimitiveElement;
class SVGFEComponentTransferElement final
: public SVGFEComponentTransferElementBase {

Просмотреть файл

@ -124,7 +124,7 @@ nsresult SVGFECompositeElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feComposite);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFECompositeElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -16,7 +16,7 @@ nsresult NS_NewSVGFECompositeElement(
namespace mozilla::dom {
using SVGFECompositeElementBase = SVGFE;
using SVGFECompositeElementBase = SVGFilterPrimitiveElement;
class SVGFECompositeElement final : public SVGFECompositeElementBase {
friend nsresult(::NS_NewSVGFECompositeElement(

Просмотреть файл

@ -227,7 +227,7 @@ nsresult SVGFEConvolveMatrixElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feConvolveMatrix);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEConvolveMatrixElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -23,7 +23,7 @@ namespace mozilla::dom {
class DOMSVGAnimatedNumberList;
class DOMSVGAnimatedBoolean;
using SVGFEConvolveMatrixElementBase = SVGFE;
using SVGFEConvolveMatrixElementBase = SVGFilterPrimitiveElement;
class SVGFEConvolveMatrixElement final : public SVGFEConvolveMatrixElementBase {
friend nsresult(::NS_NewSVGFEConvolveMatrixElement(

Просмотреть файл

@ -83,7 +83,7 @@ nsresult SVGFEDiffuseLightingElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feDiffuseLighting);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEDiffuseLightingElementBase::BindToTree(aCtx, aParent);
}
} // namespace mozilla::dom

Просмотреть файл

@ -116,7 +116,7 @@ nsresult SVGFEDisplacementMapElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feDisplacementMap);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEDisplacementMapElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -15,7 +15,7 @@ nsresult NS_NewSVGFEDisplacementMapElement(
namespace mozilla::dom {
using SVGFEDisplacementMapElementBase = SVGFE;
using SVGFEDisplacementMapElementBase = SVGFilterPrimitiveElement;
class SVGFEDisplacementMapElement final
: public SVGFEDisplacementMapElementBase {

Просмотреть файл

@ -17,7 +17,7 @@ nsresult NS_NewSVGFEDropShadowElement(
namespace mozilla::dom {
using SVGFEDropShadowElementBase = SVGFE;
using SVGFEDropShadowElementBase = SVGFilterPrimitiveElement;
class SVGFEDropShadowElement final : public SVGFEDropShadowElementBase {
friend nsresult(::NS_NewSVGFEDropShadowElement(

Просмотреть файл

@ -58,7 +58,7 @@ nsresult SVGFEFloodElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feFlood);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEFloodElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFEFloodElement(
namespace mozilla::dom {
using SVGFEFloodElementBase = SVGFE;
using SVGFEFloodElementBase = SVGFilterPrimitiveElement;
class SVGFEFloodElement final : public SVGFEFloodElementBase {
friend nsresult(::NS_NewSVGFEFloodElement(

Просмотреть файл

@ -96,7 +96,7 @@ nsresult SVGFEGaussianBlurElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feGaussianBlur);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEGaussianBlurElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -16,7 +16,7 @@ nsresult NS_NewSVGFEGaussianBlurElement(
namespace mozilla::dom {
using SVGFEGaussianBlurElementBase = SVGFE;
using SVGFEGaussianBlurElementBase = SVGFilterPrimitiveElement;
class SVGFEGaussianBlurElement final : public SVGFEGaussianBlurElementBase {
friend nsresult(::NS_NewSVGFEGaussianBlurElement(

Просмотреть файл

@ -18,7 +18,7 @@ class SVGFEImageFrame;
namespace dom {
using SVGFEImageElementBase = SVGFE;
using SVGFEImageElementBase = SVGFilterPrimitiveElement;
class SVGFEImageElement final : public SVGFEImageElementBase,
public nsImageLoadingContent {

Просмотреть файл

@ -47,7 +47,7 @@ nsresult SVGFEMergeElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feMerge);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEMergeElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFEMergeElement(
namespace mozilla::dom {
using SVGFEMergeElementBase = SVGFE;
using SVGFEMergeElementBase = SVGFilterPrimitiveElement;
class SVGFEMergeElement final : public SVGFEMergeElementBase {
friend nsresult(::NS_NewSVGFEMergeElement(

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFEMergeNodeElement(
namespace mozilla::dom {
using SVGFEMergeNodeElementBase = SVGFEUnstyledElement;
using SVGFEMergeNodeElementBase = SVGFilterPrimitiveChildElement;
class SVGFEMergeNodeElement final : public SVGFEMergeNodeElementBase {
friend nsresult(::NS_NewSVGFEMergeNodeElement(

Просмотреть файл

@ -116,7 +116,7 @@ nsresult SVGFEMorphologyElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feMorphology);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEMorphologyElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -17,7 +17,7 @@ nsresult NS_NewSVGFEMorphologyElement(
namespace mozilla::dom {
using SVGFEMorphologyElementBase = SVGFE;
using SVGFEMorphologyElementBase = SVGFilterPrimitiveElement;
class SVGFEMorphologyElement final : public SVGFEMorphologyElementBase {
friend nsresult(::NS_NewSVGFEMorphologyElement(

Просмотреть файл

@ -79,7 +79,7 @@ nsresult SVGFEOffsetElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feOffset);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFEOffsetElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -16,7 +16,7 @@ nsresult NS_NewSVGFEOffsetElement(
namespace mozilla::dom {
using SVGFEOffsetElementBase = SVGFE;
using SVGFEOffsetElementBase = SVGFilterPrimitiveElement;
class SVGFEOffsetElement final : public SVGFEOffsetElementBase {
friend nsresult(::NS_NewSVGFEOffsetElement(

Просмотреть файл

@ -99,7 +99,7 @@ nsresult SVGFESpecularLightingElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feSpecularLighting);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFESpecularLightingElementBase::BindToTree(aCtx, aParent);
}
} // namespace mozilla::dom

Просмотреть файл

@ -68,7 +68,7 @@ nsresult SVGFETileElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feTile);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFETileElementBase::BindToTree(aCtx, aParent);
}
} // namespace mozilla::dom

Просмотреть файл

@ -14,7 +14,7 @@ nsresult NS_NewSVGFETileElement(
namespace mozilla::dom {
using SVGFETileElementBase = SVGFE;
using SVGFETileElementBase = SVGFilterPrimitiveElement;
class SVGFETileElement final : public SVGFETileElementBase {
friend nsresult(::NS_NewSVGFETileElement(

Просмотреть файл

@ -160,7 +160,7 @@ nsresult SVGFETurbulenceElement::BindToTree(BindContext& aCtx,
aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feTurbulence);
}
return SVGFE::BindToTree(aCtx, aParent);
return SVGFETurbulenceElementBase::BindToTree(aCtx, aParent);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -18,7 +18,7 @@ nsresult NS_NewSVGFETurbulenceElement(
namespace mozilla::dom {
using SVGFETurbulenceElementBase = SVGFE;
using SVGFETurbulenceElementBase = SVGFilterPrimitiveElement;
class SVGFETurbulenceElement final : public SVGFETurbulenceElementBase {
friend nsresult(::NS_NewSVGFETurbulenceElement(

Просмотреть файл

@ -44,7 +44,7 @@ namespace mozilla::dom {
//--------------------Filter Element Base Class-----------------------
SVGElement::LengthInfo SVGFE::sLengthInfo[4] = {
SVGElement::LengthInfo SVGFilterPrimitiveElement::sLengthInfo[4] = {
{nsGkAtoms::x, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE,
SVGContentUtils::X},
{nsGkAtoms::y, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE,
@ -57,20 +57,24 @@ SVGElement::LengthInfo SVGFE::sLengthInfo[4] = {
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGFE, SVGFEBase)
NS_IMPL_RELEASE_INHERITED(SVGFE, SVGFEBase)
NS_IMPL_ADDREF_INHERITED(SVGFilterPrimitiveElement,
SVGFilterPrimitiveElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFilterPrimitiveElement,
SVGFilterPrimitiveElementBase)
NS_INTERFACE_MAP_BEGIN(SVGFE)
NS_INTERFACE_MAP_ENTRY_CONCRETE(SVGFE)
NS_INTERFACE_MAP_END_INHERITING(SVGFEBase)
NS_INTERFACE_MAP_BEGIN(SVGFilterPrimitiveElement)
NS_INTERFACE_MAP_ENTRY_CONCRETE(SVGFilterPrimitiveElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFilterPrimitiveElementBase)
//----------------------------------------------------------------------
// Implementation
void SVGFE::GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) {}
void SVGFilterPrimitiveElement::GetSourceImageNames(
nsTArray<SVGStringInfo>& aSources) {}
bool SVGFE::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal) {
bool SVGFilterPrimitiveElement::OutputIsTainted(
const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal) {
// This is the default implementation for OutputIsTainted.
// Our output is tainted if we have at least one tainted input.
for (uint32_t i = 0; i < aInputsAreTainted.Length(); i++) {
@ -81,38 +85,38 @@ bool SVGFE::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
return false;
}
bool SVGFE::AttributeAffectsRendering(int32_t aNameSpaceID,
nsAtom* aAttribute) const {
bool SVGFilterPrimitiveElement::AttributeAffectsRendering(
int32_t aNameSpaceID, nsAtom* aAttribute) const {
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::result);
}
already_AddRefed<DOMSVGAnimatedLength> SVGFE::X() {
already_AddRefed<DOMSVGAnimatedLength> SVGFilterPrimitiveElement::X() {
return mLengthAttributes[ATTR_X].ToDOMAnimatedLength(this);
}
already_AddRefed<DOMSVGAnimatedLength> SVGFE::Y() {
already_AddRefed<DOMSVGAnimatedLength> SVGFilterPrimitiveElement::Y() {
return mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(this);
}
already_AddRefed<DOMSVGAnimatedLength> SVGFE::Width() {
already_AddRefed<DOMSVGAnimatedLength> SVGFilterPrimitiveElement::Width() {
return mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(this);
}
already_AddRefed<DOMSVGAnimatedLength> SVGFE::Height() {
already_AddRefed<DOMSVGAnimatedLength> SVGFilterPrimitiveElement::Height() {
return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this);
}
already_AddRefed<DOMSVGAnimatedString> SVGFE::Result() {
already_AddRefed<DOMSVGAnimatedString> SVGFilterPrimitiveElement::Result() {
return GetResultImageName().ToDOMAnimatedString(this);
}
//----------------------------------------------------------------------
// SVGElement methods
bool SVGFE::StyleIsSetToSRGB() {
bool SVGFilterPrimitiveElement::StyleIsSetToSRGB() {
nsIFrame* frame = GetPrimaryFrame();
if (!frame) return false;
@ -122,15 +126,15 @@ bool SVGFE::StyleIsSetToSRGB() {
}
/* virtual */
bool SVGFE::HasValidDimensions() const {
bool SVGFilterPrimitiveElement::HasValidDimensions() const {
return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
Size SVGFE::GetKernelUnitLength(SVGFilterInstance* aInstance,
SVGAnimatedNumberPair* aKernelUnitLength) {
Size SVGFilterPrimitiveElement::GetKernelUnitLength(
SVGFilterInstance* aInstance, SVGAnimatedNumberPair* aKernelUnitLength) {
if (!aKernelUnitLength->IsExplicitlySet()) {
return Size(1, 1);
}
@ -142,7 +146,7 @@ Size SVGFE::GetKernelUnitLength(SVGFilterInstance* aInstance,
return Size(kernelX, kernelY);
}
SVGElement::LengthAttributesInfo SVGFE::GetLengthInfo() {
SVGElement::LengthAttributesInfo SVGFilterPrimitiveElement::GetLengthInfo() {
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
ArrayLength(sLengthInfo));
}

Просмотреть файл

@ -29,7 +29,7 @@ struct SVGStringInfo {
SVGElement* mElement;
};
using SVGFEBase = SVGElement;
using SVGFilterPrimitiveElementBase = SVGElement;
#define NS_SVG_FE_CID \
{ \
@ -41,9 +41,9 @@ using SVGFEBase = SVGElement;
/**
* Base class for filter primitive elements
* Children of those elements e.g. feMergeNode
* derive from SVGFEUnstyledElement instead
* derive from SVGFilterPrimitiveChildElement instead
*/
class SVGFE : public SVGFEBase {
class SVGFilterPrimitiveElement : public SVGFilterPrimitiveElementBase {
friend class mozilla::SVGFilterInstance;
protected:
@ -53,9 +53,10 @@ class SVGFE : public SVGFEBase {
using ColorSpace = mozilla::gfx::ColorSpace;
using FilterPrimitiveDescription = mozilla::gfx::FilterPrimitiveDescription;
explicit SVGFE(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGFEBase(std::move(aNodeInfo)) {}
virtual ~SVGFE() = default;
explicit SVGFilterPrimitiveElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGFilterPrimitiveElementBase(std::move(aNodeInfo)) {}
virtual ~SVGFilterPrimitiveElement() = default;
public:
using PrimitiveAttributes = mozilla::gfx::PrimitiveAttributes;
@ -145,15 +146,16 @@ class SVGFE : public SVGFEBase {
static LengthInfo sLengthInfo[4];
};
NS_DEFINE_STATIC_IID_ACCESSOR(SVGFE, NS_SVG_FE_CID)
NS_DEFINE_STATIC_IID_ACCESSOR(SVGFilterPrimitiveElement, NS_SVG_FE_CID)
using SVGFEUnstyledElementBase = SVGElement;
using SVGFilterPrimitiveChildElementBase = SVGElement;
class SVGFEUnstyledElement : public SVGFEUnstyledElementBase {
class SVGFilterPrimitiveChildElement
: public SVGFilterPrimitiveChildElementBase {
protected:
explicit SVGFEUnstyledElement(
explicit SVGFilterPrimitiveChildElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGFEUnstyledElementBase(std::move(aNodeInfo)) {}
: SVGFilterPrimitiveChildElementBase(std::move(aNodeInfo)) {}
public:
nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const override = 0;
@ -166,7 +168,7 @@ class SVGFEUnstyledElement : public SVGFEUnstyledElementBase {
//------------------------------------------------------------
using SVGFELightingElementBase = SVGFE;
using SVGFELightingElementBase = SVGFilterPrimitiveElement;
class SVGFELightingElement : public SVGFELightingElementBase {
protected:
@ -222,7 +224,7 @@ class SVGFELightingElement : public SVGFELightingElementBase {
static StringInfo sStringInfo[2];
};
using SVGFELightElementBase = SVGFEUnstyledElement;
using SVGFELightElementBase = SVGFilterPrimitiveChildElement;
class SVGFELightElement : public SVGFELightElementBase {
protected:

Просмотреть файл

@ -4956,7 +4956,7 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
// primitives. If aParentFrame is null, we know that the frame that will
// be created will be an nsInlineFrame, so it can never be a filter.
bool parentIsFilter = aParentFrame && aParentFrame->IsSVGFilterFrame();
nsCOMPtr<SVGFE> filterPrimitive =
nsCOMPtr<SVGFilterPrimitiveElement> filterPrimitive =
do_QueryInterface(const_cast<Element*>(&aElement));
if ((parentIsFilter && !filterPrimitive) ||
(!parentIsFilter && filterPrimitive)) {

Просмотреть файл

@ -81,7 +81,8 @@ NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
#ifdef DEBUG
void SVGFEContainerFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
nsCOMPtr<SVGFE> filterPrimitive = do_QueryInterface(aContent);
nsCOMPtr<SVGFilterPrimitiveElement> filterPrimitive =
do_QueryInterface(aContent);
NS_ASSERTION(filterPrimitive,
"Trying to construct an SVGFEContainerFrame for a "
"content element that doesn't support the right interfaces");
@ -93,7 +94,8 @@ void SVGFEContainerFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsresult SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
dom::SVGFE* element = static_cast<dom::SVGFE*>(GetContent());
dom::SVGFilterPrimitiveElement* element =
static_cast<dom::SVGFilterPrimitiveElement*>(GetContent());
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(
GetParent()->IsSVGFilterFrame(),

Просмотреть файл

@ -79,7 +79,8 @@ NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
#ifdef DEBUG
void SVGFELeafFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
nsCOMPtr<SVGFE> filterPrimitive = do_QueryInterface(aContent);
nsCOMPtr<SVGFilterPrimitiveElement> filterPrimitive =
do_QueryInterface(aContent);
NS_ASSERTION(filterPrimitive,
"Trying to construct an SVGFELeafFrame for a "
"content element that doesn't support the right interfaces");
@ -91,7 +92,8 @@ void SVGFELeafFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsresult SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
auto* element = static_cast<mozilla::dom::SVGFE*>(GetContent());
auto* element =
static_cast<mozilla::dom::SVGFilterPrimitiveElement*>(GetContent());
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(
GetParent()->IsSVGFilterFrame(),

Просмотреть файл

@ -73,7 +73,7 @@ nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
auto* element =
static_cast<mozilla::dom::SVGFEUnstyledElement*>(GetContent());
static_cast<mozilla::dom::SVGFilterPrimitiveChildElement*>(GetContent());
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(
GetParent()->GetParent()->IsSVGFilterFrame(),

Просмотреть файл

@ -88,8 +88,9 @@ const SVGAnimatedLength* SVGFilterFrame::GetLengthValue(uint32_t aIndex,
const SVGFilterElement* SVGFilterFrame::GetFilterContent(nsIContent* aDefault) {
for (nsIContent* child = mContent->GetFirstChild(); child;
child = child->GetNextSibling()) {
RefPtr<SVGFE> primitive;
CallQueryInterface(child, (SVGFE**)getter_AddRefs(primitive));
RefPtr<SVGFilterPrimitiveElement> primitive;
CallQueryInterface(child,
(SVGFilterPrimitiveElement**)getter_AddRefs(primitive));
if (primitive) {
return static_cast<SVGFilterElement*>(GetContent());
}

Просмотреть файл

@ -216,10 +216,10 @@ gfxRect SVGFilterInstance::UserSpaceToFilterSpace(
}
IntRect SVGFilterInstance::ComputeFilterPrimitiveSubregion(
SVGFE* aFilterElement,
SVGFilterPrimitiveElement* aFilterElement,
const nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsTArray<int32_t>& aInputIndices) {
SVGFE* fE = aFilterElement;
SVGFilterPrimitiveElement* fE = aFilterElement;
IntRect defaultFilterSubregion(0, 0, 0, 0);
if (fE->SubregionIsUnionOfRegions()) {
@ -238,17 +238,22 @@ IntRect SVGFilterInstance::ComputeFilterPrimitiveSubregion(
}
gfxRect feArea = SVGUtils::GetRelativeRect(
mPrimitiveUnits, &fE->mLengthAttributes[SVGFE::ATTR_X], mTargetBBox,
mPrimitiveUnits,
&fE->mLengthAttributes[SVGFilterPrimitiveElement::ATTR_X], mTargetBBox,
mMetrics);
Rect region = ToRect(UserSpaceToFilterSpace(feArea));
if (!fE->mLengthAttributes[SVGFE::ATTR_X].IsExplicitlySet())
if (!fE->mLengthAttributes[SVGFilterPrimitiveElement::ATTR_X]
.IsExplicitlySet())
region.x = defaultFilterSubregion.X();
if (!fE->mLengthAttributes[SVGFE::ATTR_Y].IsExplicitlySet())
if (!fE->mLengthAttributes[SVGFilterPrimitiveElement::ATTR_Y]
.IsExplicitlySet())
region.y = defaultFilterSubregion.Y();
if (!fE->mLengthAttributes[SVGFE::ATTR_WIDTH].IsExplicitlySet())
if (!fE->mLengthAttributes[SVGFilterPrimitiveElement::ATTR_WIDTH]
.IsExplicitlySet())
region.width = defaultFilterSubregion.Width();
if (!fE->mLengthAttributes[SVGFE::ATTR_HEIGHT].IsExplicitlySet())
if (!fE->mLengthAttributes[SVGFilterPrimitiveElement::ATTR_HEIGHT]
.IsExplicitlySet())
region.height = defaultFilterSubregion.Height();
// We currently require filter primitive subregions to be pixel-aligned.
@ -319,7 +324,7 @@ int32_t SVGFilterInstance::GetOrCreateSourceAlphaIndex(
}
nsresult SVGFilterInstance::GetSourceIndices(
SVGFE* aPrimitiveElement,
SVGFilterPrimitiveElement* aPrimitiveElement,
nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsTHashMap<nsStringHashKey, int32_t>& aImageTable,
nsTArray<int32_t>& aSourceIndices) {
@ -370,11 +375,12 @@ nsresult SVGFilterInstance::BuildPrimitives(
}
// Get the filter primitive elements.
AutoTArray<RefPtr<SVGFE>, 8> primitives;
AutoTArray<RefPtr<SVGFilterPrimitiveElement>, 8> primitives;
for (nsIContent* child = mFilterElement->nsINode::GetFirstChild(); child;
child = child->GetNextSibling()) {
RefPtr<SVGFE> primitive;
CallQueryInterface(child, (SVGFE**)getter_AddRefs(primitive));
RefPtr<SVGFilterPrimitiveElement> primitive;
CallQueryInterface(child,
(SVGFilterPrimitiveElement**)getter_AddRefs(primitive));
if (primitive) {
primitives.AppendElement(primitive);
}
@ -388,7 +394,7 @@ nsresult SVGFilterInstance::BuildPrimitives(
for (uint32_t primitiveElementIndex = 0;
primitiveElementIndex < primitives.Length(); ++primitiveElementIndex) {
SVGFE* filter = primitives[primitiveElementIndex];
SVGFilterPrimitiveElement* filter = primitives[primitiveElementIndex];
AutoTArray<int32_t, 2> sourceIndices;
nsresult rv =

Просмотреть файл

@ -67,7 +67,7 @@ class SVGFilterInstance {
using IntRect = gfx::IntRect;
using SourceSurface = gfx::SourceSurface;
using FilterPrimitiveDescription = gfx::FilterPrimitiveDescription;
using SVGFE = dom::SVGFE;
using SVGFilterPrimitiveElement = dom::SVGFilterPrimitiveElement;
using UserSpaceMetrics = dom::UserSpaceMetrics;
public:
@ -139,7 +139,7 @@ class SVGFilterInstance {
* Computes the filter primitive subregion for the given primitive.
*/
IntRect ComputeFilterPrimitiveSubregion(
SVGFE* aFilterElement,
SVGFilterPrimitiveElement* aFilterElement,
const nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsTArray<int32_t>& aInputIndices);
@ -184,7 +184,7 @@ class SVGFilterInstance {
* FilterPrimitiveDescription representing "another-primitive".
*/
nsresult GetSourceIndices(
SVGFE* aPrimitiveElement,
SVGFilterPrimitiveElement* aPrimitiveElement,
nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsTHashMap<nsStringHashKey, int32_t>& aImageTable,
nsTArray<int32_t>& aSourceIndices);