Fix for bug 788532 (Add the new DOM bindings API to DOM lists) - Rename Length to LengthNoFlush in SVG DOM lists. r=bz.

--HG--
extra : rebase_source : 6db1028fe04d03286561ac13fe7ea818f54245bf
This commit is contained in:
Peter Van der Beken 2012-09-05 16:52:57 +02:00
Родитель f3ef69a188
Коммит 47679c3042
13 изменённых файлов: 49 добавлений и 49 удалений

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

@ -92,7 +92,7 @@ DOMSVGAnimatedLengthList::InternalBaseValListWillChangeTo(const SVGLengthList& a
nsRefPtr<DOMSVGAnimatedLengthList> kungFuDeathGrip;
if (mBaseVal) {
if (aNewValue.Length() < mBaseVal->Length()) {
if (aNewValue.Length() < mBaseVal->LengthNoFlush()) {
// InternalListLengthWillChange might clear last reference to |this|.
// Retain a temporary reference to keep from dying before returning.
kungFuDeathGrip = this;

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

@ -91,7 +91,7 @@ DOMSVGAnimatedNumberList::InternalBaseValListWillChangeTo(const SVGNumberList& a
nsRefPtr<DOMSVGAnimatedNumberList> kungFuDeathGrip;
if (mBaseVal) {
if (aNewValue.Length() < mBaseVal->Length()) {
if (aNewValue.Length() < mBaseVal->LengthNoFlush()) {
// InternalListLengthWillChange might clear last reference to |this|.
// Retain a temporary reference to keep from dying before returning.
kungFuDeathGrip = this;

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

@ -94,7 +94,7 @@ DOMSVGAnimatedTransformList::InternalBaseValListWillChangeLengthTo(
nsRefPtr<DOMSVGAnimatedTransformList> kungFuDeathGrip;
if (mBaseVal) {
if (aNewLength < mBaseVal->Length()) {
if (aNewLength < mBaseVal->LengthNoFlush()) {
// InternalListLengthWillChange might clear last reference to |this|.
// Retain a temporary reference to keep from dying before returning.
kungFuDeathGrip = this;

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

@ -86,7 +86,7 @@ DOMSVGLengthList::GetItemAt(uint32_t aIndex)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
EnsureItemAt(aIndex);
return mItems[aIndex];
}
@ -147,7 +147,7 @@ DOMSVGLengthList::GetNumberOfItems(uint32_t *aNumberOfItems)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
*aNumberOfItems = Length();
*aNumberOfItems = LengthNoFlush();
return NS_OK;
}
@ -158,7 +158,7 @@ DOMSVGLengthList::Clear()
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
if (LengthNoFlush() > 0) {
nsAttrValue emptyOrOldValue = Element()->WillChangeLengthList(AttrEnum());
// Notify any existing DOM items of removal *before* truncating the lists
// so that they can find their SVGLength internal counterparts and copy
@ -226,7 +226,7 @@ DOMSVGLengthList::InsertItemBefore(nsIDOMSVGLength *newItem,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
index = NS_MIN(index, Length());
index = NS_MIN(index, LengthNoFlush());
if (index >= DOMSVGLength::MaxListIndex()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -281,7 +281,7 @@ DOMSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem,
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner()) {
@ -319,7 +319,7 @@ DOMSVGLengthList::RemoveItem(uint32_t index,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -353,7 +353,7 @@ NS_IMETHODIMP
DOMSVGLengthList::AppendItem(nsIDOMSVGLength *newItem,
nsIDOMSVGLength **_retval)
{
return InsertItemBefore(newItem, Length(), _retval);
return InsertItemBefore(newItem, LengthNoFlush(), _retval);
}
NS_IMETHODIMP

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

@ -84,7 +84,7 @@ public:
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t Length() const {
uint32_t LengthNoFlush() const {
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
mItems.Length() == InternalList().Length(),
"DOM wrapper's list length is out of sync");

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

@ -87,7 +87,7 @@ DOMSVGNumberList::GetItemAt(uint32_t aIndex)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
EnsureItemAt(aIndex);
return mItems[aIndex];
}
@ -148,7 +148,7 @@ DOMSVGNumberList::GetNumberOfItems(uint32_t *aNumberOfItems)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
*aNumberOfItems = Length();
*aNumberOfItems = LengthNoFlush();
return NS_OK;
}
@ -159,7 +159,7 @@ DOMSVGNumberList::Clear()
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
if (LengthNoFlush() > 0) {
nsAttrValue emptyOrOldValue = Element()->WillChangeNumberList(AttrEnum());
// Notify any existing DOM items of removal *before* truncating the lists
// so that they can find their SVGNumber internal counterparts and copy
@ -227,7 +227,7 @@ DOMSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
index = NS_MIN(index, Length());
index = NS_MIN(index, LengthNoFlush());
if (index >= DOMSVGNumber::MaxListIndex()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -282,7 +282,7 @@ DOMSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner()) {
@ -320,7 +320,7 @@ DOMSVGNumberList::RemoveItem(uint32_t index,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -354,7 +354,7 @@ NS_IMETHODIMP
DOMSVGNumberList::AppendItem(nsIDOMSVGNumber *newItem,
nsIDOMSVGNumber **_retval)
{
return InsertItemBefore(newItem, Length(), _retval);
return InsertItemBefore(newItem, LengthNoFlush(), _retval);
}
NS_IMETHODIMP

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

@ -83,7 +83,7 @@ public:
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t Length() const {
uint32_t LengthNoFlush() const {
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
mItems.Length() == InternalList().Length(),
"DOM wrapper's list length is out of sync");

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

@ -93,7 +93,7 @@ DOMSVGPathSegList::GetItemAt(uint32_t aIndex)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
EnsureItemAt(aIndex);
return ItemAt(aIndex);
}
@ -247,7 +247,7 @@ DOMSVGPathSegList::GetNumberOfItems(uint32_t *aNumberOfItems)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
*aNumberOfItems = Length();
*aNumberOfItems = LengthNoFlush();
return NS_OK;
}
@ -258,7 +258,7 @@ DOMSVGPathSegList::Clear()
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
if (LengthNoFlush() > 0) {
nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList();
// DOM list items that are to be removed must be removed before we change
// the internal list, otherwise they wouldn't be able to copy their
@ -336,10 +336,10 @@ DOMSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *aNewItem,
}
uint32_t internalIndex;
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
internalIndex = mItems[aIndex].mInternalDataIndex;
} else {
aIndex = Length();
aIndex = LengthNoFlush();
internalIndex = InternalList().mData.Length();
}
if (aIndex >= DOMSVGPathSeg::MaxListIndex()) {
@ -401,7 +401,7 @@ DOMSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *aNewItem,
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (aIndex >= Length()) {
if (aIndex >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner()) {
@ -439,7 +439,7 @@ DOMSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *aNewItem,
uint32_t delta = newArgCount - oldArgCount;
if (delta != 0) {
for (uint32_t i = aIndex + 1; i < Length(); ++i) {
for (uint32_t i = aIndex + 1; i < LengthNoFlush(); ++i) {
mItems[i].mInternalDataIndex += delta;
}
}
@ -461,7 +461,7 @@ DOMSVGPathSegList::RemoveItem(uint32_t aIndex,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (aIndex >= Length()) {
if (aIndex >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
// We have to return the removed item, so make sure it exists:
@ -498,7 +498,7 @@ NS_IMETHODIMP
DOMSVGPathSegList::AppendItem(nsIDOMSVGPathSeg *aNewItem,
nsIDOMSVGPathSeg **_retval)
{
return InsertItemBefore(aNewItem, Length(), _retval);
return InsertItemBefore(aNewItem, LengthNoFlush(), _retval);
}
NS_IMETHODIMP

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

@ -100,7 +100,7 @@ public:
* This will normally be the same as InternalList().CountItems(), except if
* we've hit OOM, in which case our length will be zero.
*/
uint32_t Length() const {
uint32_t LengthNoFlush() const {
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
mItems.Length() == InternalList().CountItems(),
"DOM wrapper's list length is out of sync");

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

@ -112,7 +112,7 @@ DOMSVGPointList::GetItemAt(uint32_t aIndex)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
EnsureItemAt(aIndex);
return mItems[aIndex];
}
@ -191,7 +191,7 @@ DOMSVGPointList::GetNumberOfItems(uint32_t *aNumberOfItems)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
*aNumberOfItems = Length();
*aNumberOfItems = LengthNoFlush();
return NS_OK;
}
@ -202,7 +202,7 @@ DOMSVGPointList::Clear()
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
if (LengthNoFlush() > 0) {
nsAttrValue emptyOrOldValue = Element()->WillChangePointList();
// DOM list items that are to be removed must be removed before we change
// the internal list, otherwise they wouldn't be able to copy their
@ -279,7 +279,7 @@ DOMSVGPointList::InsertItemBefore(nsIDOMSVGPoint *aNewItem,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
aIndex = NS_MIN(aIndex, Length());
aIndex = NS_MIN(aIndex, LengthNoFlush());
if (aIndex >= DOMSVGPoint::MaxListIndex()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -334,7 +334,7 @@ DOMSVGPointList::ReplaceItem(nsIDOMSVGPoint *aNewItem,
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (aIndex >= Length()) {
if (aIndex >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner() || domItem->IsReadonly()) {
@ -372,7 +372,7 @@ DOMSVGPointList::RemoveItem(uint32_t aIndex,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (aIndex >= Length()) {
if (aIndex >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -406,7 +406,7 @@ NS_IMETHODIMP
DOMSVGPointList::AppendItem(nsIDOMSVGPoint *aNewItem,
nsIDOMSVGPoint **_retval)
{
return InsertItemBefore(aNewItem, Length(), _retval);
return InsertItemBefore(aNewItem, LengthNoFlush(), _retval);
}
NS_IMETHODIMP

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

@ -100,7 +100,7 @@ public:
* This will normally be the same as InternalList().Length(), except if
* we've hit OOM, in which case our length will be zero.
*/
uint32_t Length() const {
uint32_t LengthNoFlush() const {
NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
mItems.Length() == InternalList().Length(),
"DOM wrapper's list length is out of sync");

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

@ -87,7 +87,7 @@ DOMSVGTransformList::GetItemAt(uint32_t aIndex)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
if (aIndex < Length()) {
if (aIndex < LengthNoFlush()) {
EnsureItemAt(aIndex);
return mItems[aIndex];
}
@ -151,7 +151,7 @@ DOMSVGTransformList::GetNumberOfItems(uint32_t *aNumberOfItems)
if (IsAnimValList()) {
Element()->FlushAnimations();
}
*aNumberOfItems = Length();
*aNumberOfItems = LengthNoFlush();
return NS_OK;
}
@ -170,7 +170,7 @@ DOMSVGTransformList::Clear()
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
if (LengthNoFlush() > 0) {
nsAttrValue emptyOrOldValue = Element()->WillChangeTransformList();
// Notify any existing DOM items of removal *before* truncating the lists
// so that they can find their SVGTransform internal counterparts and copy
@ -241,7 +241,7 @@ DOMSVGTransformList::InsertItemBefore(nsIDOMSVGTransform *newItem,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
index = NS_MIN(index, Length());
index = NS_MIN(index, LengthNoFlush());
if (index >= DOMSVGTransform::MaxListIndex()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -298,7 +298,7 @@ DOMSVGTransformList::ReplaceItem(nsIDOMSVGTransform *newItem,
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner()) {
@ -336,7 +336,7 @@ DOMSVGTransformList::RemoveItem(uint32_t index, nsIDOMSVGTransform **_retval)
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (index >= Length()) {
if (index >= LengthNoFlush()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -371,7 +371,7 @@ NS_IMETHODIMP
DOMSVGTransformList::AppendItem(nsIDOMSVGTransform *newItem,
nsIDOMSVGTransform **_retval)
{
return InsertItemBefore(newItem, Length(), _retval);
return InsertItemBefore(newItem, LengthNoFlush(), _retval);
}
/* nsIDOMSVGTransform createSVGTransformFromMatrix (in nsIDOMSVGMatrix matrix);
@ -398,13 +398,13 @@ DOMSVGTransformList::Consolidate(nsIDOMSVGTransform **_retval)
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() == 0)
if (LengthNoFlush() == 0)
return NS_OK;
// Note that SVG 1.1 says, "The consolidation operation creates new
// SVGTransform object as the first and only item in the list" hence, even if
// Length() == 1 we can't return that one item (after making it a matrix
// type). We must orphan the existing item and then make a new one.
// LengthNoFlush() == 1 we can't return that one item (after making it a
// matrix type). We must orphan the existing item and then make a new one.
// First calculate our matrix
gfxMatrix mx = InternalList().GetConsolidationMatrix();
@ -414,7 +414,7 @@ DOMSVGTransformList::Consolidate(nsIDOMSVGTransform **_retval)
// And append the new transform
nsRefPtr<DOMSVGTransform> transform = new DOMSVGTransform(mx);
return InsertItemBefore(transform, Length(), _retval);
return InsertItemBefore(transform, LengthNoFlush(), _retval);
}
//----------------------------------------------------------------------

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

@ -76,7 +76,7 @@ public:
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t Length() const {
uint32_t LengthNoFlush() const {
NS_ABORT_IF_FALSE(mItems.IsEmpty() ||
mItems.Length() == InternalList().Length(),
"DOM wrapper's list length is out of sync");