Bug 1280425 part 2: Remove code associated with now-unsupported "defer" in SVG. r?dholbert
MozReview-Commit-ID: 8Naxc84aAES
--- a/dom/svg/SVGAnimatedPreserveAspectRatio.cpp
+++ b/dom/svg/SVGAnimatedPreserveAspectRatio.cpp
@@ -240,30 +240,28 @@ SVGAnimatedPreserveAspectRatio::SetBaseV
}
static uint64_t
PackPreserveAspectRatio(const SVGPreserveAspectRatio& par)
{
// All preserveAspectRatio values are enum values (do not interpolate), so we
// can safely collate them and treat them as a single enum as for SMIL.
uint64_t packed = 0;
- packed |= uint64_t(par.GetDefer() ? 1 : 0) << 16;
packed |= uint64_t(par.GetAlign()) << 8;
packed |= uint64_t(par.GetMeetOrSlice());
return packed;
}
void
SVGAnimatedPreserveAspectRatio::SetAnimValue(uint64_t aPackedValue,
nsSVGElement *aSVGElement)
{
if (mIsAnimated && PackPreserveAspectRatio(mAnimVal) == aPackedValue) {
return;
}
- mAnimVal.SetDefer(((aPackedValue & 0xff0000) >> 16) ? true : false);
mAnimVal.SetAlign(uint16_t((aPackedValue & 0xff00) >> 8));
mAnimVal.SetMeetOrSlice(uint16_t(aPackedValue & 0xff));
mIsAnimated = true;
aSVGElement->DidAnimatePreserveAspectRatio();
}
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
SVGAnimatedPreserveAspectRatio::ToDOMAnimatedPreserveAspectRatio(
--- a/dom/svg/SVGAnimatedPreserveAspectRatio.h
+++ b/dom/svg/SVGAnimatedPreserveAspectRatio.h
@@ -23,17 +23,16 @@ class SVGAnimationElement;
} // namespace dom
class SVGAnimatedPreserveAspectRatio final
{
public:
void Init() {
mBaseVal.mAlign = SVG_PRESERVEASPECTRATIO_XMIDYMID;
mBaseVal.mMeetOrSlice = SVG_MEETORSLICE_MEET;
- mBaseVal.mDefer = false;
mAnimVal = mBaseVal;
mIsAnimated = false;
mIsBaseSet = false;
}
nsresult SetBaseValueString(const nsAString& aValue,
nsSVGElement *aSVGElement,
bool aDoSetAttr);
@@ -41,29 +40,27 @@ public:
void SetBaseValue(const SVGPreserveAspectRatio &aValue,
nsSVGElement *aSVGElement);
nsresult SetBaseAlign(uint16_t aAlign, nsSVGElement *aSVGElement) {
if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) {
return NS_ERROR_FAILURE;
}
SetBaseValue(SVGPreserveAspectRatio(
- static_cast<SVGAlign>(aAlign), mBaseVal.GetMeetOrSlice(),
- mBaseVal.GetDefer()),
+ static_cast<SVGAlign>(aAlign), mBaseVal.GetMeetOrSlice()),
aSVGElement);
return NS_OK;
}
nsresult SetBaseMeetOrSlice(uint16_t aMeetOrSlice, nsSVGElement *aSVGElement) {
if (aMeetOrSlice < SVG_MEETORSLICE_MIN_VALID ||
aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) {
return NS_ERROR_FAILURE;
}
SetBaseValue(SVGPreserveAspectRatio(
- mBaseVal.GetAlign(), static_cast<SVGMeetOrSlice>(aMeetOrSlice),
- mBaseVal.GetDefer()),
+ mBaseVal.GetAlign(), static_cast<SVGMeetOrSlice>(aMeetOrSlice)),
aSVGElement);
return NS_OK;
}
void SetAnimValue(uint64_t aPackedValue, nsSVGElement *aSVGElement);
const SVGPreserveAspectRatio &GetBaseValue() const
{ return mBaseVal; }
const SVGPreserveAspectRatio &GetAnimValue() const
--- a/dom/svg/SVGPreserveAspectRatio.cpp
+++ b/dom/svg/SVGPreserveAspectRatio.cpp
@@ -20,18 +20,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
bool
SVGPreserveAspectRatio::operator==(const SVGPreserveAspectRatio& aOther) const
{
return mAlign == aOther.mAlign &&
- mMeetOrSlice == aOther.mMeetOrSlice &&
- mDefer == aOther.mDefer;
+ mMeetOrSlice == aOther.mMeetOrSlice;
}
JSObject*
DOMSVGPreserveAspectRatio::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return mozilla::dom::SVGPreserveAspectRatioBinding::Wrap(aCx, this, aGivenProto);
}
--- a/dom/svg/SVGPreserveAspectRatio.h
+++ b/dom/svg/SVGPreserveAspectRatio.h
@@ -48,29 +48,26 @@ const uint16_t SVG_MEETORSLICE_MIN_VALID
const uint16_t SVG_MEETORSLICE_MAX_VALID = SVG_MEETORSLICE_SLICE;
class SVGAnimatedPreserveAspectRatio;
class SVGPreserveAspectRatio final
{
friend class SVGAnimatedPreserveAspectRatio;
public:
- SVGPreserveAspectRatio(SVGAlign aAlign, SVGMeetOrSlice aMeetOrSlice,
- bool aDefer = false)
+ SVGPreserveAspectRatio(SVGAlign aAlign, SVGMeetOrSlice aMeetOrSlice)
: mAlign(aAlign)
, mMeetOrSlice(aMeetOrSlice)
- , mDefer(aDefer)
{}
bool operator==(const SVGPreserveAspectRatio& aOther) const;
explicit SVGPreserveAspectRatio()
: mAlign(SVG_PRESERVEASPECTRATIO_UNKNOWN)
, mMeetOrSlice(SVG_MEETORSLICE_UNKNOWN)
- , mDefer(false)
{}
nsresult SetAlign(uint16_t aAlign) {
if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID)
return NS_ERROR_FAILURE;
mAlign = static_cast<uint8_t>(aAlign);
return NS_OK;
}
@@ -86,33 +83,24 @@ public:
mMeetOrSlice = static_cast<uint8_t>(aMeetOrSlice);
return NS_OK;
}
SVGMeetOrSlice GetMeetOrSlice() const {
return static_cast<SVGMeetOrSlice>(mMeetOrSlice);
}
- void SetDefer(bool aDefer) {
- mDefer = aDefer;
- }
-
- bool GetDefer() const {
- return mDefer;
- }
-
uint32_t Hash() const {
- return HashGeneric(mAlign, mMeetOrSlice, mDefer);
+ return HashGeneric(mAlign, mMeetOrSlice);
}
private:
// We can't use enum types here because some compilers fail to pack them.
uint8_t mAlign;
uint8_t mMeetOrSlice;
- bool mDefer;
};
namespace dom {
class DOMSVGPreserveAspectRatio final : public nsISupports,
public nsWrapperCache
{
public:
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -1112,20 +1112,16 @@ SVGSVGElement::
mImageNeedsTransformInvalidation = true;
}
mIsPaintingSVGImageElement = true;
if (!hasViewBoxRect) {
return; // preserveAspectRatio irrelevant (only matters if we have viewBox)
}
- if (aPAR.GetDefer() && HasPreserveAspectRatio()) {
- return; // Referring element defers to my own preserveAspectRatio value.
- }
-
if (SetPreserveAspectRatioProperty(aPAR)) {
mImageNeedsTransformInvalidation = true;
}
}
void
SVGSVGElement::ClearImageOverridePreserveAspectRatio()
{