Bug 1871347 - Don't pass a boolean aIsAnimValList to GetDOMWrapper when we can derive it r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D197070
This commit is contained in:
Robert Longson 2023-12-22 18:10:46 +00:00
Родитель 132a2e534a
Коммит 40a3e5ab0f
6 изменённых файлов: 16 добавлений и 10 удалений

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

@ -12,6 +12,7 @@
#include "SVGAttrTearoffTable.h"
#include "SVGPathSegUtils.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGPathElement.h"
#include "mozilla/dom/SVGPathSegListBinding.h"
#include "mozilla/RefPtr.h"
@ -51,11 +52,12 @@ NS_INTERFACE_MAP_END
/* static */
already_AddRefed<DOMSVGPathSegList> DOMSVGPathSegList::GetDOMWrapper(
void* aList, SVGElement* aElement, bool aIsAnimValList) {
void* aList, SVGPathElement* aElement) {
RefPtr<DOMSVGPathSegList> wrapper =
SVGPathSegListTearoffTable().GetTearoff(aList);
if (!wrapper) {
wrapper = new DOMSVGPathSegList(aElement, aIsAnimValList);
wrapper = new DOMSVGPathSegList(
aElement, aElement->GetAnimPathSegList()->GetAnimValKey() == aList);
SVGPathSegListTearoffTable().AddTearoff(aList, wrapper);
}
return wrapper.forget();

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

@ -24,6 +24,7 @@ class SVGAnimatedPathSegList;
namespace dom {
class DOMSVGPathSeg;
class SVGPathElement;
//----------------------------------------------------------------------
// Helper class: AutoChangePathSegListNotifier
@ -108,7 +109,7 @@ class DOMSVGPathSegList final : public nsISupports, public nsWrapperCache {
* clearly SVGPathData* and a SVGPathData** are not the same type.
*/
static already_AddRefed<DOMSVGPathSegList> GetDOMWrapper(
void* aList, dom::SVGElement* aElement, bool aIsAnimValList);
void* aList, dom::SVGPathElement* aElement);
/**
* This method returns the DOMSVGPathSegList wrapper for an internal

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

@ -11,6 +11,7 @@
#include "nsError.h"
#include "SVGAnimatedPointList.h"
#include "SVGAttrTearoffTable.h"
#include "SVGPolyElement.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGPointListBinding.h"
#include <algorithm>
@ -68,11 +69,12 @@ NS_INTERFACE_MAP_END
/* static */
already_AddRefed<DOMSVGPointList> DOMSVGPointList::GetDOMWrapper(
void* aList, SVGElement* aElement, bool aIsAnimValList) {
void* aList, SVGPolyElement* aElement) {
RefPtr<DOMSVGPointList> wrapper =
SVGPointListTearoffTable().GetTearoff(aList);
if (!wrapper) {
wrapper = new DOMSVGPointList(aElement, aIsAnimValList);
wrapper = new DOMSVGPointList(
aElement, aElement->GetAnimatedPointList()->GetAnimValKey() == aList);
SVGPointListTearoffTable().AddTearoff(aList, wrapper);
}
return wrapper.forget();

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

@ -32,6 +32,7 @@ namespace dom {
class DOMSVGPoint;
class SVGElement;
class SVGPolyElement;
//----------------------------------------------------------------------
// Helper class: AutoChangePointListNotifier
@ -123,7 +124,7 @@ class DOMSVGPointList final : public nsISupports, public nsWrapperCache {
* clearly SVGPointList* and a SVGPointList** are not the same type.
*/
static already_AddRefed<DOMSVGPointList> GetDOMWrapper(
void* aList, dom::SVGElement* aElement, bool aIsAnimValList);
void* aList, dom::SVGPolyElement* aElement);
/**
* This method returns the DOMSVGPointList wrapper for an internal

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

@ -192,14 +192,14 @@ SVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) {
// preference is off by default in Bug 1388931, and will be dropped later.
// So we are not planning to map d property for this API.
already_AddRefed<DOMSVGPathSegList> SVGPathElement::PathSegList() {
return DOMSVGPathSegList::GetDOMWrapper(mD.GetBaseValKey(), this, false);
return DOMSVGPathSegList::GetDOMWrapper(mD.GetBaseValKey(), this);
}
// FIXME: This API is enabled only if dom.svg.pathSeg.enabled is true. This
// preference is off by default in Bug 1388931, and will be dropped later.
// So we are not planning to map d property for this API.
already_AddRefed<DOMSVGPathSegList> SVGPathElement::AnimatedPathSegList() {
return DOMSVGPathSegList::GetDOMWrapper(mD.GetAnimValKey(), this, true);
return DOMSVGPathSegList::GetDOMWrapper(mD.GetAnimValKey(), this);
}
//----------------------------------------------------------------------

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

@ -21,11 +21,11 @@ SVGPolyElement::SVGPolyElement(
: SVGPolyElementBase(std::move(aNodeInfo)) {}
already_AddRefed<DOMSVGPointList> SVGPolyElement::Points() {
return DOMSVGPointList::GetDOMWrapper(mPoints.GetBaseValKey(), this, false);
return DOMSVGPointList::GetDOMWrapper(mPoints.GetBaseValKey(), this);
}
already_AddRefed<DOMSVGPointList> SVGPolyElement::AnimatedPoints() {
return DOMSVGPointList::GetDOMWrapper(mPoints.GetAnimValKey(), this, true);
return DOMSVGPointList::GetDOMWrapper(mPoints.GetAnimValKey(), this);
}
//----------------------------------------------------------------------