diff --git a/dom/svg/SVGCircleElement.cpp b/dom/svg/SVGCircleElement.cpp index 014de7545b6f..b16d74231e17 100644 --- a/dom/svg/SVGCircleElement.cpp +++ b/dom/svg/SVGCircleElement.cpp @@ -37,6 +37,11 @@ SVGCircleElement::SVGCircleElement( already_AddRefed&& aNodeInfo) : SVGCircleElementBase(std::move(aNodeInfo)) {} +bool SVGCircleElement::IsAttributeMapped(const nsAtom* aAttribute) const { + return IsInLengthInfo(aAttribute, sLengthInfo) || + SVGCircleElementBase::IsAttributeMapped(aAttribute); +} + //---------------------------------------------------------------------- // nsINode methods diff --git a/dom/svg/SVGCircleElement.h b/dom/svg/SVGCircleElement.h index b0be1f8e021d..066dede13679 100644 --- a/dom/svg/SVGCircleElement.h +++ b/dom/svg/SVGCircleElement.h @@ -29,6 +29,8 @@ class SVGCircleElement final : public SVGCircleElementBase { already_AddRefed&& aNodeInfo)); public: + NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; + // nsSVGSVGElement methods: virtual bool HasValidDimensions() const override; diff --git a/dom/svg/SVGEllipseElement.cpp b/dom/svg/SVGEllipseElement.cpp index ef88e78566c0..dee02797c169 100644 --- a/dom/svg/SVGEllipseElement.cpp +++ b/dom/svg/SVGEllipseElement.cpp @@ -41,6 +41,11 @@ SVGEllipseElement::SVGEllipseElement( already_AddRefed&& aNodeInfo) : SVGEllipseElementBase(std::move(aNodeInfo)) {} +bool SVGEllipseElement::IsAttributeMapped(const nsAtom* aAttribute) const { + return IsInLengthInfo(aAttribute, sLengthInfo) || + SVGEllipseElementBase::IsAttributeMapped(aAttribute); +} + //---------------------------------------------------------------------- // nsINode methods diff --git a/dom/svg/SVGEllipseElement.h b/dom/svg/SVGEllipseElement.h index 26601919c29b..f58e4f09f082 100644 --- a/dom/svg/SVGEllipseElement.h +++ b/dom/svg/SVGEllipseElement.h @@ -29,6 +29,8 @@ class SVGEllipseElement final : public SVGEllipseElementBase { already_AddRefed&& aNodeInfo)); public: + NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; + // nsSVGSVGElement methods: virtual bool HasValidDimensions() const override; diff --git a/dom/svg/SVGForeignObjectElement.cpp b/dom/svg/SVGForeignObjectElement.cpp index d52fb5f318da..399179871452 100644 --- a/dom/svg/SVGForeignObjectElement.cpp +++ b/dom/svg/SVGForeignObjectElement.cpp @@ -109,7 +109,8 @@ SVGForeignObjectElement::IsAttributeMapped(const nsAtom* name) const { sTextContentElementsMap, sViewportsMap}; - return FindAttributeDependence(name, map) || + return IsInLengthInfo(name, sLengthInfo) || + FindAttributeDependence(name, map) || SVGGraphicsElement::IsAttributeMapped(name); } diff --git a/dom/svg/SVGGraphicsElement.h b/dom/svg/SVGGraphicsElement.h index 19399e8ef6a6..4ff220a702a3 100644 --- a/dom/svg/SVGGraphicsElement.h +++ b/dom/svg/SVGGraphicsElement.h @@ -32,6 +32,16 @@ class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests { // returns true if focusability has been definitively determined otherwise // false bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex); + + template + bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const { + for (auto const& e : aLengthInfos) { + if (e.mName == aAttribute) { + return true; + } + } + return false; + } }; } // namespace dom diff --git a/dom/svg/SVGImageElement.cpp b/dom/svg/SVGImageElement.cpp index 0bbab6cb3049..9c939c337e1f 100644 --- a/dom/svg/SVGImageElement.cpp +++ b/dom/svg/SVGImageElement.cpp @@ -218,7 +218,8 @@ SVGImageElement::IsAttributeMapped(const nsAtom* name) const { sViewportsMap, }; - return FindAttributeDependence(name, map) || + return IsInLengthInfo(name, sLengthInfo) || + FindAttributeDependence(name, map) || SVGImageElementBase::IsAttributeMapped(name); } diff --git a/dom/svg/SVGRectElement.cpp b/dom/svg/SVGRectElement.cpp index 3f1da44b66df..c4b26bff1311 100644 --- a/dom/svg/SVGRectElement.cpp +++ b/dom/svg/SVGRectElement.cpp @@ -49,6 +49,11 @@ SVGRectElement::SVGRectElement( already_AddRefed&& aNodeInfo) : SVGRectElementBase(std::move(aNodeInfo)) {} +bool SVGRectElement::IsAttributeMapped(const nsAtom* aAttribute) const { + return IsInLengthInfo(aAttribute, sLengthInfo) || + SVGRectElementBase::IsAttributeMapped(aAttribute); +} + //---------------------------------------------------------------------- // nsINode methods diff --git a/dom/svg/SVGRectElement.h b/dom/svg/SVGRectElement.h index 0a395f69c8fd..a22caac7fd53 100644 --- a/dom/svg/SVGRectElement.h +++ b/dom/svg/SVGRectElement.h @@ -28,6 +28,8 @@ class SVGRectElement final : public SVGRectElementBase { already_AddRefed&& aNodeInfo)); public: + NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; + // nsSVGSVGElement methods: virtual bool HasValidDimensions() const override;