mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 703333 - Remove pointless const_casts from SVG DOM list classes; r=roc
This commit is contained in:
parent
5eaaaa2fc8
commit
7440f2e640
@ -144,7 +144,7 @@ DOMSVGLengthList::InternalListLengthWillChange(PRUint32 aNewLength)
|
||||
}
|
||||
|
||||
SVGLengthList&
|
||||
DOMSVGLengthList::InternalList()
|
||||
DOMSVGLengthList::InternalList() const
|
||||
{
|
||||
SVGAnimatedLengthList *alist = Element()->GetAnimatedLengthList(AttrEnum());
|
||||
return IsAnimValList() && alist->mAnimVal ? *alist->mAnimVal : alist->mBaseVal;
|
||||
|
@ -103,8 +103,7 @@ public:
|
||||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGLengthList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
@ -116,7 +115,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
@ -143,7 +142,7 @@ private:
|
||||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGLengthList& InternalList();
|
||||
SVGLengthList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGLength for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
@ -144,7 +144,7 @@ DOMSVGNumberList::InternalListLengthWillChange(PRUint32 aNewLength)
|
||||
}
|
||||
|
||||
SVGNumberList&
|
||||
DOMSVGNumberList::InternalList()
|
||||
DOMSVGNumberList::InternalList() const
|
||||
{
|
||||
SVGAnimatedNumberList *alist = Element()->GetAnimatedNumberList(AttrEnum());
|
||||
return IsAnimValList() && alist->mAnimVal ? *alist->mAnimVal : alist->mBaseVal;
|
||||
|
@ -102,8 +102,7 @@ public:
|
||||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGNumberList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
@ -115,7 +114,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
@ -138,7 +137,7 @@ private:
|
||||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGNumberList& InternalList();
|
||||
SVGNumberList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGNumber for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
@ -230,18 +230,18 @@ DOMSVGPathSegList::InternalListWillChangeTo(const SVGPathData& aNewValue)
|
||||
bool
|
||||
DOMSVGPathSegList::AttrIsAnimating() const
|
||||
{
|
||||
return const_cast<DOMSVGPathSegList*>(this)->InternalAList().IsAnimating();
|
||||
return InternalAList().IsAnimating();
|
||||
}
|
||||
|
||||
SVGPathData&
|
||||
DOMSVGPathSegList::InternalList()
|
||||
DOMSVGPathSegList::InternalList() const
|
||||
{
|
||||
SVGAnimatedPathSegList *alist = mElement->GetAnimPathSegList();
|
||||
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
|
||||
}
|
||||
|
||||
SVGAnimatedPathSegList&
|
||||
DOMSVGPathSegList::InternalAList()
|
||||
DOMSVGPathSegList::InternalAList() const
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mElement->GetAnimPathSegList(), "Internal error");
|
||||
return *mElement->GetAnimPathSegList();
|
||||
|
@ -120,8 +120,7 @@ public:
|
||||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGPathSegList*>(this)->InternalList().CountItems(),
|
||||
mItems.Length() == InternalList().CountItems(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
@ -184,9 +183,9 @@ private:
|
||||
* get const protection, but our setter methods guard against changing
|
||||
* anim val lists.
|
||||
*/
|
||||
SVGPathData& InternalList();
|
||||
SVGPathData& InternalList() const;
|
||||
|
||||
SVGAnimatedPathSegList& InternalAList();
|
||||
SVGAnimatedPathSegList& InternalAList() const;
|
||||
|
||||
/// Creates an instance of the appropriate DOMSVGPathSeg sub-class for
|
||||
// aIndex, if it doesn't already exist.
|
||||
|
@ -175,18 +175,18 @@ DOMSVGPointList::InternalListWillChangeTo(const SVGPointList& aNewValue)
|
||||
bool
|
||||
DOMSVGPointList::AttrIsAnimating() const
|
||||
{
|
||||
return const_cast<DOMSVGPointList*>(this)->InternalAList().IsAnimating();
|
||||
return InternalAList().IsAnimating();
|
||||
}
|
||||
|
||||
SVGPointList&
|
||||
DOMSVGPointList::InternalList()
|
||||
DOMSVGPointList::InternalList() const
|
||||
{
|
||||
SVGAnimatedPointList *alist = mElement->GetAnimatedPointList();
|
||||
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
|
||||
}
|
||||
|
||||
SVGAnimatedPointList&
|
||||
DOMSVGPointList::InternalAList()
|
||||
DOMSVGPointList::InternalAList() const
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mElement->GetAnimatedPointList(), "Internal error");
|
||||
return *mElement->GetAnimatedPointList();
|
||||
|
@ -120,8 +120,7 @@ public:
|
||||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGPointList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
@ -184,9 +183,9 @@ private:
|
||||
* get const protection, but our setter methods guard against changing
|
||||
* anim val lists.
|
||||
*/
|
||||
SVGPointList& InternalList();
|
||||
SVGPointList& InternalList() const;
|
||||
|
||||
SVGAnimatedPointList& InternalAList();
|
||||
SVGAnimatedPointList& InternalAList() const;
|
||||
|
||||
/// Creates a DOMSVGPoint for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
@ -146,7 +146,7 @@ DOMSVGTransformList::InternalListLengthWillChange(PRUint32 aNewLength)
|
||||
}
|
||||
|
||||
SVGTransformList&
|
||||
DOMSVGTransformList::InternalList()
|
||||
DOMSVGTransformList::InternalList() const
|
||||
{
|
||||
SVGAnimatedTransformList *alist = Element()->GetAnimatedTransformList();
|
||||
return IsAnimValList() && alist->mAnimVal ?
|
||||
|
@ -97,8 +97,7 @@ public:
|
||||
*/
|
||||
PRUint32 Length() const {
|
||||
NS_ABORT_IF_FALSE(mItems.IsEmpty() ||
|
||||
mItems.Length() ==
|
||||
const_cast<DOMSVGTransformList*>(this)->InternalList().Length(),
|
||||
mItems.Length() == InternalList().Length(),
|
||||
"DOM wrapper's list length is out of sync");
|
||||
return mItems.Length();
|
||||
}
|
||||
@ -110,7 +109,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
nsSVGElement* Element() const {
|
||||
return mAList->mElement;
|
||||
}
|
||||
|
||||
@ -129,7 +128,7 @@ private:
|
||||
* get const protection, but our setter methods guard against changing
|
||||
* animVal lists.
|
||||
*/
|
||||
SVGTransformList& InternalList();
|
||||
SVGTransformList& InternalList() const;
|
||||
|
||||
/// Creates a DOMSVGTransform for aIndex, if it doesn't already exist.
|
||||
void EnsureItemAt(PRUint32 aIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user