Bug 1383650 - Map SVG geometry attributes to CSS r=longsonr

This patch maps SVG geometry attributes to CSS property, so that the
values set via SVG attribute will be known by CSS.

It doesn't deal with how the value is used.

Differential Revision: https://phabricator.services.mozilla.com/D29960

--HG--
extra : moz-landing-system : lando
This commit is contained in:
violet 2019-05-16 00:47:24 +00:00
Родитель 2dad80d965
Коммит f8d0458408
9 изменённых файлов: 35 добавлений и 2 удалений

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

@ -37,6 +37,11 @@ SVGCircleElement::SVGCircleElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGCircleElementBase(std::move(aNodeInfo)) {}
bool SVGCircleElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGCircleElementBase::IsAttributeMapped(aAttribute);
}
//----------------------------------------------------------------------
// nsINode methods

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

@ -29,6 +29,8 @@ class SVGCircleElement final : public SVGCircleElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;

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

@ -41,6 +41,11 @@ SVGEllipseElement::SVGEllipseElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGEllipseElementBase(std::move(aNodeInfo)) {}
bool SVGEllipseElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGEllipseElementBase::IsAttributeMapped(aAttribute);
}
//----------------------------------------------------------------------
// nsINode methods

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

@ -29,6 +29,8 @@ class SVGEllipseElement final : public SVGEllipseElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;

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

@ -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);
}

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

@ -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 <typename T>
bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const {
for (auto const& e : aLengthInfos) {
if (e.mName == aAttribute) {
return true;
}
}
return false;
}
};
} // namespace dom

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

@ -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);
}

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

@ -49,6 +49,11 @@ SVGRectElement::SVGRectElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGRectElementBase(std::move(aNodeInfo)) {}
bool SVGRectElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGRectElementBase::IsAttributeMapped(aAttribute);
}
//----------------------------------------------------------------------
// nsINode methods

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

@ -28,6 +28,8 @@ class SVGRectElement final : public SVGRectElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;