зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614546 part 1. Get rid of SVG uses of NS_ERROR_DOM_TYPE_ERR. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D62399 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b7f5c4a0d2
Коммит
bb356d988d
|
@ -31,8 +31,8 @@ const SVGEnumMapping* SVGAnimatedEnumeration::GetMapping(
|
|||
return info.mEnumInfo[mAttrEnum].mMapping;
|
||||
}
|
||||
|
||||
nsresult SVGAnimatedEnumeration::SetBaseValueAtom(const nsAtom* aValue,
|
||||
SVGElement* aSVGElement) {
|
||||
bool SVGAnimatedEnumeration::SetBaseValueAtom(const nsAtom* aValue,
|
||||
SVGElement* aSVGElement) {
|
||||
const SVGEnumMapping* mapping = GetMapping(aSVGElement);
|
||||
|
||||
while (mapping && mapping->mKey) {
|
||||
|
@ -49,12 +49,12 @@ nsresult SVGAnimatedEnumeration::SetBaseValueAtom(const nsAtom* aValue,
|
|||
// SVGElement::ParseAttribute under Element::SetAttr,
|
||||
// which takes care of notifying.
|
||||
}
|
||||
return NS_OK;
|
||||
return true;
|
||||
}
|
||||
mapping++;
|
||||
}
|
||||
|
||||
return NS_ERROR_DOM_TYPE_ERR;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAtom* SVGAnimatedEnumeration::GetBaseValueAtom(SVGElement* aSVGElement) {
|
||||
|
|
|
@ -43,7 +43,9 @@ class SVGAnimatedEnumeration {
|
|||
mIsBaseSet = false;
|
||||
}
|
||||
|
||||
nsresult SetBaseValueAtom(const nsAtom* aValue, SVGElement* aSVGElement);
|
||||
// Returns whether aValue corresponded to a key in our mapping (in which case
|
||||
// we actually set the base value) or not (in which case we did not).
|
||||
bool SetBaseValueAtom(const nsAtom* aValue, SVGElement* aSVGElement);
|
||||
nsAtom* GetBaseValueAtom(SVGElement* aSVGElement);
|
||||
void SetBaseValue(uint16_t aValue, SVGElement* aSVGElement, ErrorResult& aRv);
|
||||
uint16_t GetBaseValue() const { return mBaseVal; }
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::SVGAngle_Binding;
|
||||
|
@ -340,13 +341,12 @@ void SVGAnimatedOrient::SetBaseValue(float aValue, uint8_t aUnit,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult SVGAnimatedOrient::SetBaseType(SVGEnumValue aValue,
|
||||
SVGElement* aSVGElement) {
|
||||
void SVGAnimatedOrient::SetBaseType(SVGEnumValue aValue,
|
||||
SVGElement* aSVGElement, ErrorResult& aRv) {
|
||||
if (mBaseType == aValue) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
if (aValue == SVG_MARKER_ORIENT_AUTO || aValue == SVG_MARKER_ORIENT_ANGLE ||
|
||||
aValue == SVG_MARKER_ORIENT_AUTO_START_REVERSE) {
|
||||
if (aValue == SVG_MARKER_ORIENT_AUTO || aValue == SVG_MARKER_ORIENT_ANGLE) {
|
||||
AutoChangeOrientNotifier notifier(this, aSVGElement);
|
||||
|
||||
mBaseVal = .0f;
|
||||
|
@ -357,9 +357,10 @@ nsresult SVGAnimatedOrient::SetBaseType(SVGEnumValue aValue,
|
|||
mAnimValUnit = mBaseValUnit;
|
||||
mAnimType = mBaseType;
|
||||
}
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
return NS_ERROR_DOM_TYPE_ERR;
|
||||
nsPrintfCString err("Invalid base value %u for marker orient", aValue);
|
||||
aRv.ThrowTypeError(NS_ConvertUTF8toUTF16(err));
|
||||
}
|
||||
|
||||
void SVGAnimatedOrient::SetAnimValue(float aValue, uint8_t aUnit,
|
||||
|
|
|
@ -62,7 +62,8 @@ class SVGAnimatedOrient {
|
|||
|
||||
void SetBaseValue(float aValue, uint8_t aUnit, SVGElement* aSVGElement,
|
||||
bool aDoSetAttr);
|
||||
nsresult SetBaseType(SVGEnumValue aValue, SVGElement* aSVGElement);
|
||||
void SetBaseType(SVGEnumValue aValue, SVGElement* aSVGElement,
|
||||
ErrorResult& aRv);
|
||||
void SetAnimValue(float aValue, uint8_t aUnit, SVGElement* aSVGElement);
|
||||
void SetAnimType(SVGEnumValue aValue, SVGElement* aSVGElement);
|
||||
|
||||
|
@ -112,7 +113,7 @@ class SVGAnimatedOrient {
|
|||
using mozilla::dom::DOMSVGAnimatedEnumeration::SetBaseVal;
|
||||
uint16_t BaseVal() override { return Sanitize(mVal->mBaseType); }
|
||||
void SetBaseVal(uint16_t aBaseVal, ErrorResult& aRv) override {
|
||||
aRv = mVal->SetBaseType(aBaseVal, mSVGElement);
|
||||
mVal->SetBaseType(aBaseVal, mSVGElement, aRv);
|
||||
}
|
||||
uint16_t AnimVal() override {
|
||||
// Script may have modified animation parameters or timeline -- DOM
|
||||
|
|
|
@ -490,8 +490,10 @@ bool SVGElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|||
for (i = 0; i < enumInfo.mEnumCount; i++) {
|
||||
if (aAttribute == enumInfo.mEnumInfo[i].mName) {
|
||||
RefPtr<nsAtom> valAtom = NS_Atomize(aValue);
|
||||
rv = enumInfo.mEnums[i].SetBaseValueAtom(valAtom, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (!enumInfo.mEnums[i].SetBaseValueAtom(valAtom, this)) {
|
||||
// Exact error value does not matter; we just need to mark the
|
||||
// parse as failed.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
enumInfo.SetUnknownValue(i);
|
||||
} else {
|
||||
aResult.SetTo(valAtom);
|
||||
|
|
|
@ -98,8 +98,7 @@ class MOZ_RAII AutoSVGViewHandler {
|
|||
return false;
|
||||
}
|
||||
nsAtom* valAtom = NS_GetStaticAtom(aParams);
|
||||
if (!valAtom ||
|
||||
NS_FAILED(mSVGView->mZoomAndPan.SetBaseValueAtom(valAtom, mRoot))) {
|
||||
if (!valAtom || !mSVGView->mZoomAndPan.SetBaseValueAtom(valAtom, mRoot)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -107,7 +107,7 @@ already_AddRefed<DOMSVGAnimatedAngle> SVGMarkerElement::OrientAngle() {
|
|||
}
|
||||
|
||||
void SVGMarkerElement::SetOrientToAuto() {
|
||||
mOrient.SetBaseType(SVG_MARKER_ORIENT_AUTO, this);
|
||||
mOrient.SetBaseType(SVG_MARKER_ORIENT_AUTO, this, IgnoreErrors());
|
||||
}
|
||||
|
||||
void SVGMarkerElement::SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv) {
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[SVGAnimatedEnumeration-SVGMarkerElement.html]
|
||||
[Use of SVGAnimatedEnumeration within SVGMarkerElement]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче