diff options
Diffstat (limited to 'dom/svg')
-rw-r--r-- | dom/svg/DOMSVGPathSegList.cpp | 21 | ||||
-rw-r--r-- | dom/svg/SVGGradientElement.cpp | 9 | ||||
-rw-r--r-- | dom/svg/SVGGradientElement.h | 7 |
3 files changed, 31 insertions, 6 deletions
diff --git a/dom/svg/DOMSVGPathSegList.cpp b/dom/svg/DOMSVGPathSegList.cpp index edacdfc93..0b811cdb1 100644 --- a/dom/svg/DOMSVGPathSegList.cpp +++ b/dom/svg/DOMSVGPathSegList.cpp @@ -460,6 +460,18 @@ DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem, float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS]; domItem->ToSVGPathSegEncodedData(segAsRaw); + if (AnimListMirrorsBaseList()) { + // The anim val list is in sync with the base val list - remove mirroring + // animVal item if necessary. We do this *before* touching InternalList() + // so the removed item can correctly store its internal value. + DOMSVGPathSegList* animVal = + GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); + if (animVal->ItemAt(aIndex)) { + animVal->ItemAt(aIndex)->RemovingFromList(); + animVal->ItemAt(aIndex) = nullptr; + } + } + if (!InternalList().mData.ReplaceElementsAt(internalIndex, 1 + oldArgCount, segAsRaw, 1 + newArgCount, fallible)) { @@ -474,8 +486,13 @@ DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem, int32_t delta = newArgCount - oldArgCount; if (delta != 0) { - for (uint32_t i = aIndex + 1; i < LengthNoFlush(); ++i) { - mItems[i].mInternalDataIndex += delta; + // Sync up the internal indexes of all ItemProxys that come after aIndex: + UpdateListIndicesFromIndex(aIndex + 1, delta); + if (AnimListMirrorsBaseList()) { + // The anim val list is in sync with the base val list + DOMSVGPathSegList* animVal = + GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); + animVal->UpdateListIndicesFromIndex(aIndex + 1, delta); } } diff --git a/dom/svg/SVGGradientElement.cpp b/dom/svg/SVGGradientElement.cpp index 1bcac67e6..93767c934 100644 --- a/dom/svg/SVGGradientElement.cpp +++ b/dom/svg/SVGGradientElement.cpp @@ -198,13 +198,14 @@ SVGRadialGradientElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenP return SVGRadialGradientElementBinding::Wrap(aCx, this, aGivenProto); } -nsSVGElement::LengthInfo SVGRadialGradientElement::sLengthInfo[5] = +nsSVGElement::LengthInfo SVGRadialGradientElement::sLengthInfo[6] = { { &nsGkAtoms::cx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X }, { &nsGkAtoms::cy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y }, { &nsGkAtoms::r, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY }, { &nsGkAtoms::fx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X }, { &nsGkAtoms::fy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y }, + { &nsGkAtoms::fr, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY }, }; //---------------------------------------------------------------------- @@ -252,6 +253,12 @@ SVGRadialGradientElement::Fy() return mLengthAttributes[ATTR_FY].ToDOMAnimatedLength(this); } +already_AddRefed<SVGAnimatedLength> +SVGRadialGradientElement::Fr() +{ + return mLengthAttributes[ATTR_FR].ToDOMAnimatedLength(this); +} + //---------------------------------------------------------------------- // nsSVGElement methods diff --git a/dom/svg/SVGGradientElement.h b/dom/svg/SVGGradientElement.h index 7b2c6b220..ce9f3b4b1 100644 --- a/dom/svg/SVGGradientElement.h +++ b/dom/svg/SVGGradientElement.h @@ -139,13 +139,14 @@ public: already_AddRefed<SVGAnimatedLength> R(); already_AddRefed<SVGAnimatedLength> Fx(); already_AddRefed<SVGAnimatedLength> Fy(); + already_AddRefed<SVGAnimatedLength> Fr(); protected: virtual LengthAttributesInfo GetLengthInfo() override; - enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY }; - nsSVGLength2 mLengthAttributes[5]; - static LengthInfo sLengthInfo[5]; + enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY, ATTR_FR }; + nsSVGLength2 mLengthAttributes[6]; + static LengthInfo sLengthInfo[6]; }; } // namespace dom |