Bug 1515607 - Move nsSVGFE into the mozilla::dom namespace r=dholbert

This commit is contained in:
longsonr 2018-12-21 12:32:35 +00:00
Родитель f68bd8c718
Коммит e160f38d5f
22 изменённых файлов: 73 добавлений и 74 удалений

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

@ -15,7 +15,7 @@ nsresult NS_NewSVGFEBlendElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEBlendElementBase;
typedef SVGFE SVGFEBlendElementBase;
class SVGFEBlendElement : public SVGFEBlendElementBase {
friend nsresult(::NS_NewSVGFEBlendElement(

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

@ -17,7 +17,7 @@ nsresult NS_NewSVGFEColorMatrixElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEColorMatrixElementBase;
typedef SVGFE SVGFEColorMatrixElementBase;
class SVGFEColorMatrixElement : public SVGFEColorMatrixElementBase {
friend nsresult(::NS_NewSVGFEColorMatrixElement(

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

@ -9,14 +9,14 @@
#include "nsSVGFilters.h"
typedef nsSVGFE SVGFEComponentTransferElementBase;
nsresult NS_NewSVGFEComponentTransferElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
namespace dom {
typedef SVGFE SVGFEComponentTransferElementBase;
class SVGFEComponentTransferElement : public SVGFEComponentTransferElementBase {
friend nsresult(::NS_NewSVGFEComponentTransferElement(
nsIContent** aResult,

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

@ -17,7 +17,7 @@ nsresult NS_NewSVGFECompositeElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFECompositeElementBase;
typedef SVGFE SVGFECompositeElementBase;
class SVGFECompositeElement : public SVGFECompositeElementBase {
friend nsresult(::NS_NewSVGFECompositeElement(

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

@ -25,7 +25,7 @@ class DOMSVGAnimatedNumberList;
namespace dom {
class SVGAnimatedBoolean;
typedef nsSVGFE SVGFEConvolveMatrixElementBase;
typedef SVGFE SVGFEConvolveMatrixElementBase;
class SVGFEConvolveMatrixElement : public SVGFEConvolveMatrixElementBase {
friend nsresult(::NS_NewSVGFEConvolveMatrixElement(

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

@ -16,7 +16,7 @@ nsresult NS_NewSVGFEDisplacementMapElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEDisplacementMapElementBase;
typedef SVGFE SVGFEDisplacementMapElementBase;
class SVGFEDisplacementMapElement : public SVGFEDisplacementMapElementBase {
protected:

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

@ -18,7 +18,7 @@ nsresult NS_NewSVGFEDropShadowElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEDropShadowElementBase;
typedef SVGFE SVGFEDropShadowElementBase;
class SVGFEDropShadowElement : public SVGFEDropShadowElementBase {
friend nsresult(::NS_NewSVGFEDropShadowElement(

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

@ -15,7 +15,7 @@ nsresult NS_NewSVGFEFloodElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEFloodElementBase;
typedef SVGFE SVGFEFloodElementBase;
class SVGFEFloodElement : public SVGFEFloodElementBase {
friend nsresult(::NS_NewSVGFEFloodElement(

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

@ -17,7 +17,7 @@ nsresult NS_NewSVGFEGaussianBlurElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEGaussianBlurElementBase;
typedef SVGFE SVGFEGaussianBlurElementBase;
class SVGFEGaussianBlurElement : public SVGFEGaussianBlurElementBase {
friend nsresult(::NS_NewSVGFEGaussianBlurElement(

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

@ -18,7 +18,7 @@ nsresult NS_NewSVGFEImageElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEImageElementBase;
typedef SVGFE SVGFEImageElementBase;
class SVGFEImageElement final : public SVGFEImageElementBase,
public nsImageLoadingContent {

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

@ -15,7 +15,7 @@ nsresult NS_NewSVGFEMergeElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEMergeElementBase;
typedef SVGFE SVGFEMergeElementBase;
class SVGFEMergeElement : public SVGFEMergeElementBase {
friend nsresult(::NS_NewSVGFEMergeElement(

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

@ -18,7 +18,7 @@ nsresult NS_NewSVGFEMorphologyElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEMorphologyElementBase;
typedef SVGFE SVGFEMorphologyElementBase;
class SVGFEMorphologyElement : public SVGFEMorphologyElementBase {
friend nsresult(::NS_NewSVGFEMorphologyElement(

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

@ -17,7 +17,7 @@ nsresult NS_NewSVGFEOffsetElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFEOffsetElementBase;
typedef SVGFE SVGFEOffsetElementBase;
class SVGFEOffsetElement : public SVGFEOffsetElementBase {
friend nsresult(::NS_NewSVGFEOffsetElement(

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

@ -15,7 +15,7 @@ nsresult NS_NewSVGFETileElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFETileElementBase;
typedef SVGFE SVGFETileElementBase;
class SVGFETileElement : public SVGFETileElementBase {
friend nsresult(::NS_NewSVGFETileElement(

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

@ -19,7 +19,7 @@ nsresult NS_NewSVGFETurbulenceElement(
namespace mozilla {
namespace dom {
typedef nsSVGFE SVGFETurbulenceElementBase;
typedef SVGFE SVGFETurbulenceElementBase;
class SVGFETurbulenceElement : public SVGFETurbulenceElementBase {
friend nsresult(::NS_NewSVGFETurbulenceElement(

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

@ -45,13 +45,14 @@
#undef LoadImage
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
namespace mozilla {
namespace dom {
//--------------------Filter Element Base Class-----------------------
SVGElement::LengthInfo nsSVGFE::sLengthInfo[4] = {
SVGElement::LengthInfo SVGFE::sLengthInfo[4] = {
{nsGkAtoms::x, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE,
SVGContentUtils::X},
{nsGkAtoms::y, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE,
@ -64,19 +65,19 @@ SVGElement::LengthInfo nsSVGFE::sLengthInfo[4] = {
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFE, nsSVGFEBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFE, nsSVGFEBase)
NS_IMPL_ADDREF_INHERITED(SVGFE, SVGFEBase)
NS_IMPL_RELEASE_INHERITED(SVGFE, SVGFEBase)
NS_INTERFACE_MAP_BEGIN(nsSVGFE)
NS_INTERFACE_MAP_ENTRY_CONCRETE(nsSVGFE)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEBase)
NS_INTERFACE_MAP_BEGIN(SVGFE)
NS_INTERFACE_MAP_ENTRY_CONCRETE(SVGFE)
NS_INTERFACE_MAP_END_INHERITING(SVGFEBase)
//----------------------------------------------------------------------
// Implementation
void nsSVGFE::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) {}
void SVGFE::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) {}
bool nsSVGFE::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
bool SVGFE::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.
@ -88,7 +89,7 @@ bool nsSVGFE::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
return false;
}
bool nsSVGFE::AttributeAffectsRendering(int32_t aNameSpaceID,
bool SVGFE::AttributeAffectsRendering(int32_t aNameSpaceID,
nsAtom* aAttribute) const {
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y ||
@ -96,23 +97,23 @@ bool nsSVGFE::AttributeAffectsRendering(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::result);
}
already_AddRefed<SVGAnimatedLength> nsSVGFE::X() {
already_AddRefed<SVGAnimatedLength> SVGFE::X() {
return mLengthAttributes[ATTR_X].ToDOMAnimatedLength(this);
}
already_AddRefed<SVGAnimatedLength> nsSVGFE::Y() {
already_AddRefed<SVGAnimatedLength> SVGFE::Y() {
return mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(this);
}
already_AddRefed<SVGAnimatedLength> nsSVGFE::Width() {
already_AddRefed<SVGAnimatedLength> SVGFE::Width() {
return mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(this);
}
already_AddRefed<SVGAnimatedLength> nsSVGFE::Height() {
already_AddRefed<SVGAnimatedLength> SVGFE::Height() {
return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this);
}
already_AddRefed<SVGAnimatedString> nsSVGFE::Result() {
already_AddRefed<SVGAnimatedString> SVGFE::Result() {
return GetResultImageName().ToDOMAnimatedString(this);
}
@ -120,17 +121,17 @@ already_AddRefed<SVGAnimatedString> nsSVGFE::Result() {
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGFE::IsAttributeMapped(const nsAtom* name) const {
SVGFE::IsAttributeMapped(const nsAtom* name) const {
static const MappedAttributeEntry* const map[] = {sFiltersMap};
return FindAttributeDependence(name, map) ||
nsSVGFEBase::IsAttributeMapped(name);
SVGFEBase::IsAttributeMapped(name);
}
//----------------------------------------------------------------------
// SVGElement methods
bool nsSVGFE::StyleIsSetToSRGB() {
bool SVGFE::StyleIsSetToSRGB() {
nsIFrame* frame = GetPrimaryFrame();
if (!frame) return false;
@ -139,14 +140,14 @@ bool nsSVGFE::StyleIsSetToSRGB() {
NS_STYLE_COLOR_INTERPOLATION_SRGB;
}
/* virtual */ bool nsSVGFE::HasValidDimensions() const {
/* virtual */ bool SVGFE::HasValidDimensions() const {
return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
Size nsSVGFE::GetKernelUnitLength(nsSVGFilterInstance* aInstance,
Size SVGFE::GetKernelUnitLength(nsSVGFilterInstance* aInstance,
nsSVGNumberPair* aKernelUnitLength) {
if (!aKernelUnitLength->IsExplicitlySet()) {
return Size(1, 1);
@ -159,14 +160,11 @@ Size nsSVGFE::GetKernelUnitLength(nsSVGFilterInstance* aInstance,
return Size(kernelX, kernelY);
}
SVGElement::LengthAttributesInfo nsSVGFE::GetLengthInfo() {
SVGElement::LengthAttributesInfo SVGFE::GetLengthInfo() {
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
ArrayLength(sLengthInfo));
}
namespace mozilla {
namespace dom {
SVGElement::NumberListInfo
SVGComponentTransferFunctionElement::sNumberListInfo[1] = {
{nsGkAtoms::tableValues}};

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

@ -28,7 +28,10 @@ struct nsSVGStringInfo {
mozilla::dom::SVGElement* mElement;
};
typedef mozilla::dom::SVGElement nsSVGFEBase;
namespace mozilla {
namespace dom {
typedef SVGElement SVGFEBase;
#define NS_SVG_FE_CID \
{ \
@ -42,8 +45,8 @@ typedef mozilla::dom::SVGElement nsSVGFEBase;
* Children of those elements e.g. feMergeNode
* derive from SVGFEUnstyledElement instead
*/
class nsSVGFE : public nsSVGFEBase {
friend class nsSVGFilterInstance;
class SVGFE : public SVGFEBase {
friend class ::nsSVGFilterInstance;
protected:
typedef mozilla::gfx::SourceSurface SourceSurface;
@ -52,9 +55,9 @@ class nsSVGFE : public nsSVGFEBase {
typedef mozilla::gfx::ColorSpace ColorSpace;
typedef mozilla::gfx::FilterPrimitiveDescription FilterPrimitiveDescription;
explicit nsSVGFE(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: nsSVGFEBase(std::move(aNodeInfo)) {}
virtual ~nsSVGFE() {}
explicit SVGFE(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGFEBase(std::move(aNodeInfo)) {}
virtual ~SVGFE() {}
public:
typedef mozilla::gfx::PrimitiveAttributes PrimitiveAttributes;
@ -152,9 +155,9 @@ class nsSVGFE : public nsSVGFEBase {
static LengthInfo sLengthInfo[4];
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGFE, NS_SVG_FE_CID)
NS_DEFINE_STATIC_IID_ACCESSOR(SVGFE, NS_SVG_FE_CID)
typedef mozilla::dom::SVGElement SVGFEUnstyledElementBase;
typedef SVGElement SVGFEUnstyledElementBase;
class SVGFEUnstyledElement : public SVGFEUnstyledElementBase {
protected:
@ -172,12 +175,9 @@ class SVGFEUnstyledElement : public SVGFEUnstyledElementBase {
nsAtom* aAttribute) const = 0;
};
namespace mozilla {
namespace dom {
//------------------------------------------------------------
typedef nsSVGFE SVGFELightingElementBase;
typedef SVGFE SVGFELightingElementBase;
class SVGFELightingElement : public SVGFELightingElementBase {
protected:

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

@ -81,7 +81,7 @@ void SVGFEContainerFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsresult SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
nsSVGFE* element = static_cast<nsSVGFE*>(GetContent());
dom::SVGFE* element = static_cast<dom::SVGFE*>(GetContent());
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(
GetParent()->IsSVGFilterFrame(),

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

@ -79,7 +79,7 @@ void SVGFELeafFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsresult SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
nsSVGFE* element = static_cast<nsSVGFE*>(GetContent());
SVGFE* element = static_cast<SVGFE*>(GetContent());
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(
GetParent()->IsSVGFilterFrame(),

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

@ -87,8 +87,8 @@ const SVGFilterElement* nsSVGFilterFrame::GetFilterContent(
nsIContent* aDefault) {
for (nsIContent* child = mContent->GetFirstChild(); child;
child = child->GetNextSibling()) {
RefPtr<nsSVGFE> primitive;
CallQueryInterface(child, (nsSVGFE**)getter_AddRefs(primitive));
RefPtr<SVGFE> primitive;
CallQueryInterface(child, (SVGFE**)getter_AddRefs(primitive));
if (primitive) {
return static_cast<SVGFilterElement*>(GetContent());
}

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

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

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

@ -69,6 +69,7 @@ class nsSVGFilterInstance {
typedef mozilla::gfx::IntRect IntRect;
typedef mozilla::gfx::SourceSurface SourceSurface;
typedef mozilla::gfx::FilterPrimitiveDescription FilterPrimitiveDescription;
typedef mozilla::dom::SVGFE SVGFE;
typedef mozilla::dom::UserSpaceMetrics UserSpaceMetrics;
public:
@ -139,7 +140,7 @@ class nsSVGFilterInstance {
* Computes the filter primitive subregion for the given primitive.
*/
IntRect ComputeFilterPrimitiveSubregion(
nsSVGFE* aFilterElement,
SVGFE* aFilterElement,
const nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsTArray<int32_t>& aInputIndices);
@ -184,7 +185,7 @@ class nsSVGFilterInstance {
* FilterPrimitiveDescription representing "another-primitive".
*/
nsresult GetSourceIndices(
nsSVGFE* aPrimitiveElement,
SVGFE* aPrimitiveElement,
nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
const nsDataHashtable<nsStringHashKey, int32_t>& aImageTable,
nsTArray<int32_t>& aSourceIndices);