本文整理汇总了C++中AttrIsAnimating函数的典型用法代码示例。如果您正苦于以下问题:C++ AttrIsAnimating函数的具体用法?C++ AttrIsAnimating怎么用?C++ AttrIsAnimating使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AttrIsAnimating函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Element
void
DOMSVGPointList::Clear(ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
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
// internal counterparts' values!
InternalListWillChangeTo(SVGPointList()); // clears mItems
if (!AttrIsAnimating()) {
// The anim val list is in sync with the base val list
DOMSVGPointList *animList =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (animList) {
animList->InternalListWillChangeTo(SVGPointList()); // clears its mItems
}
}
InternalList().Clear();
Element()->DidChangePointList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
}
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:32,代码来源:DOMSVGPointList.cpp
示例2: InternalListWillChangeTo
NS_IMETHODIMP
DOMSVGPathSegList::Clear()
{
if (IsAnimValList()) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (Length() > 0) {
// 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
// internal counterparts' values!
InternalListWillChangeTo(SVGPathData()); // clears mItems
if (!AttrIsAnimating()) {
// The anim val list is in sync with the base val list
DOMSVGPathSegList *animList =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (animList) {
animList->InternalListWillChangeTo(SVGPathData()); // clears its mItems
}
}
InternalList().Clear();
Element()->DidChangePathSegList(true);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
}
return NS_OK;
}
开发者ID:rfk,项目名称:services-central,代码行数:31,代码来源:DOMSVGPathSegList.cpp
示例3: MaybeInsertNullInAnimValListAt
void
DOMSVGPathSegList::
MaybeInsertNullInAnimValListAt(uint32_t aIndex,
uint32_t aInternalIndex,
uint32_t aArgCountForItem)
{
NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// The anim val list is in sync with the base val list
DOMSVGPathSegList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
"animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, ItemProxy(nullptr, aInternalIndex));
animVal->UpdateListIndicesFromIndex(aIndex + 1, 1 + aArgCountForItem);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:28,代码来源:DOMSVGPathSegList.cpp
示例4: MaybeRemoveItemFromAnimValListAt
void
DOMSVGPathSegList::
MaybeRemoveItemFromAnimValListAt(uint32_t aIndex,
int32_t aArgCountForItem)
{
MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGPathSegList> animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
"animVal list not in sync!");
if (animVal->ItemAt(aIndex)) {
animVal->ItemAt(aIndex)->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
animVal->UpdateListIndicesFromIndex(aIndex, -(1 + aArgCountForItem));
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:31,代码来源:DOMSVGPathSegList.cpp
示例5: notifier
void
DOMSVGPathSegList::Clear(ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (LengthNoFlush() > 0) {
AutoChangePathSegListNotifier notifier(this);
// 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
// internal counterparts' values!
InternalListWillChangeTo(SVGPathData()); // clears mItems
if (!AttrIsAnimating()) {
// The anim val list is in sync with the base val list
DOMSVGPathSegList *animList =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (animList) {
animList->InternalListWillChangeTo(SVGPathData()); // clears its mItems
}
}
InternalList().Clear();
}
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:28,代码来源:DOMSVGPathSegList.cpp
示例6: MOZ_ASSERT
void
DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// The anim val list is in sync with the base val list
DOMSVGPointList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
"animVal list not in sync!");
MOZ_ALWAYS_TRUE(animVal->mItems.InsertElementAt(aIndex, nullptr, fallible));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:25,代码来源:DOMSVGPointList.cpp
示例7: Length
NS_IMETHODIMP
DOMSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *aNewItem,
PRUint32 aIndex,
nsIDOMSVGPathSeg **_retval)
{
*_retval = nsnull;
if (IsAnimValList()) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
PRUint32 internalIndex;
if (aIndex < Length()) {
internalIndex = mItems[aIndex].mInternalDataIndex;
} else {
aIndex = Length();
internalIndex = InternalList().mData.Length();
}
if (aIndex >= DOMSVGPathSeg::MaxListIndex()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
nsCOMPtr<DOMSVGPathSeg> domItem = do_QueryInterface(aNewItem);
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (domItem->HasOwner()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
PRUint32 argCount = SVGPathSegUtils::ArgCountForType(domItem->Type());
// Ensure we have enough memory so we can avoid complex error handling below:
if (!mItems.SetCapacity(mItems.Length() + 1) ||
!InternalList().mData.SetCapacity(InternalList().mData.Length() + 1 + argCount)) {
return NS_ERROR_OUT_OF_MEMORY;
}
// Now that we know we're inserting, keep animVal list in sync as necessary.
MaybeInsertNullInAnimValListAt(aIndex, internalIndex, argCount);
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
domItem->ToSVGPathSegEncodedData(segAsRaw);
InternalList().mData.InsertElementsAt(internalIndex, segAsRaw, 1 + argCount);
mItems.InsertElementAt(aIndex, ItemProxy(domItem.get(), internalIndex));
// This MUST come after the insertion into InternalList(), or else under the
// insertion into InternalList() the values read from domItem would be bad
// data from InternalList() itself!:
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
UpdateListIndicesFromIndex(aIndex + 1, argCount + 1);
Element()->DidChangePathSegList(true);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
*_retval = domItem.forget().get();
return NS_OK;
}
开发者ID:rfk,项目名称:services-central,代码行数:60,代码来源:DOMSVGPathSegList.cpp
示例8: NS_ABORT_IF_FALSE
void
DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// The anim val list is in sync with the base val list
DOMSVGPointList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
"animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, static_cast<nsISVGPoint*>(nullptr));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:25,代码来源:DOMSVGPointList.cpp
示例9: MaybeRemoveItemFromAnimValListAt
void
DOMSVGPathSegList::
MaybeRemoveItemFromAnimValListAt(PRUint32 aIndex,
PRUint32 aArgCountForItem)
{
NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
DOMSVGPathSegList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
"animVal list not in sync!");
if (animVal->ItemAt(aIndex)) {
animVal->ItemAt(aIndex)->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
animVal->UpdateListIndicesFromIndex(aIndex, -(1 + aArgCountForItem));
}
开发者ID:h4ck3rm1k3,项目名称:v8monkey,代码行数:29,代码来源:DOMSVGPathSegList.cpp
示例10: LengthNoFlush
already_AddRefed<DOMSVGPathSeg>
DOMSVGPathSegList::InsertItemBefore(DOMSVGPathSeg& aNewItem,
uint32_t aIndex,
ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
uint32_t internalIndex;
if (aIndex < LengthNoFlush()) {
internalIndex = mItems[aIndex].mInternalDataIndex;
} else {
aIndex = LengthNoFlush();
internalIndex = InternalList().mData.Length();
}
if (aIndex >= DOMSVGPathSeg::MaxListIndex()) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
nsRefPtr<DOMSVGPathSeg> domItem = &aNewItem;
if (domItem->HasOwner()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
uint32_t argCount = SVGPathSegUtils::ArgCountForType(domItem->Type());
// Ensure we have enough memory so we can avoid complex error handling below:
if (!mItems.SetCapacity(mItems.Length() + 1) ||
!InternalList().mData.SetCapacity(InternalList().mData.Length() + 1 + argCount)) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList();
// Now that we know we're inserting, keep animVal list in sync as necessary.
MaybeInsertNullInAnimValListAt(aIndex, internalIndex, argCount);
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
domItem->ToSVGPathSegEncodedData(segAsRaw);
InternalList().mData.InsertElementsAt(internalIndex, segAsRaw, 1 + argCount);
mItems.InsertElementAt(aIndex, ItemProxy(domItem.get(), internalIndex));
// This MUST come after the insertion into InternalList(), or else under the
// insertion into InternalList() the values read from domItem would be bad
// data from InternalList() itself!:
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
UpdateListIndicesFromIndex(aIndex + 1, argCount + 1);
Element()->DidChangePathSegList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:59,代码来源:DOMSVGPathSegList.cpp
示例11: NS_MIN
already_AddRefed<nsIDOMSVGPoint>
DOMSVGPointList::InsertItemBefore(nsIDOMSVGPoint *aNewItem, uint32_t aIndex,
ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
aIndex = NS_MIN(aIndex, LengthNoFlush());
if (aIndex >= DOMSVGPoint::MaxListIndex()) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
nsCOMPtr<DOMSVGPoint> domItem = do_QueryInterface(aNewItem);
if (!domItem) {
aError.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
return nullptr;
}
if (domItem->HasOwner() || domItem->IsReadonly()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
// Ensure we have enough memory so we can avoid complex error handling below:
if (!mItems.SetCapacity(mItems.Length() + 1) ||
!InternalList().SetCapacity(InternalList().Length() + 1)) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
nsAttrValue emptyOrOldValue = Element()->WillChangePointList();
// Now that we know we're inserting, keep animVal list in sync as necessary.
MaybeInsertNullInAnimValListAt(aIndex);
InternalList().InsertItem(aIndex, domItem->ToSVGPoint());
mItems.InsertElementAt(aIndex, domItem.get());
// This MUST come after the insertion into InternalList(), or else under the
// insertion into InternalList() the values read from domItem would be bad
// data from InternalList() itself!:
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
UpdateListIndicesFromIndex(mItems, aIndex + 1);
Element()->DidChangePointList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}
开发者ID:PinZhang,项目名称:releases-mozilla-central,代码行数:51,代码来源:DOMSVGPointList.cpp
示例12: EnsureItemAt
already_AddRefed<DOMSVGPathSeg>
DOMSVGPathSegList::RemoveItem(uint32_t aIndex,
ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
if (aIndex >= LengthNoFlush()) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
// We have to return the removed item, so make sure it exists:
EnsureItemAt(aIndex);
nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList();
// Notify the DOM item of removal *before* modifying the lists so that the
// DOM item can copy its *old* value:
ItemAt(aIndex)->RemovingFromList();
nsRefPtr<DOMSVGPathSeg> result = ItemAt(aIndex);
uint32_t internalIndex = mItems[aIndex].mInternalDataIndex;
uint32_t segType = SVGPathSegUtils::DecodeType(InternalList().mData[internalIndex]);
// NOTE: ArgCountForType returns a (small) unsigned value, but we're
// intentionally putting it in a signed value, because we're going to
// negate it, and you can't negate an unsigned value.
int32_t argCount = SVGPathSegUtils::ArgCountForType(segType);
// Now that we know we're removing, keep animVal list in sync as necessary.
// Do this *before* touching InternalList() so the removed item can get its
// internal value.
MaybeRemoveItemFromAnimValListAt(aIndex, argCount);
InternalList().mData.RemoveElementsAt(internalIndex, 1 + argCount);
mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(aIndex, -(argCount + 1));
Element()->DidChangePathSegList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
return result.forget();
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:45,代码来源:DOMSVGPathSegList.cpp
示例13: EnsureItemAt
NS_IMETHODIMP
DOMSVGPathSegList::RemoveItem(PRUint32 aIndex,
nsIDOMSVGPathSeg **_retval)
{
*_retval = nsnull;
if (IsAnimValList()) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (aIndex >= Length()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
// We have to return the removed item, so make sure it exists:
EnsureItemAt(aIndex);
// Notify the DOM item of removal *before* modifying the lists so that the
// DOM item can copy its *old* value:
ItemAt(aIndex)->RemovingFromList();
NS_ADDREF(*_retval = ItemAt(aIndex));
PRUint32 internalIndex = mItems[aIndex].mInternalDataIndex;
PRUint32 segType = SVGPathSegUtils::DecodeType(InternalList().mData[internalIndex]);
PRUint32 argCount = SVGPathSegUtils::ArgCountForType(segType);
// Now that we know we're removing, keep animVal list in sync as necessary.
// Do this *before* touching InternalList() so the removed item can get its
// internal value.
MaybeRemoveItemFromAnimValListAt(aIndex, argCount);
InternalList().mData.RemoveElementsAt(internalIndex, 1 + argCount);
mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(aIndex, -(argCount + 1));
Element()->DidChangePathSegList(PR_TRUE);
#ifdef MOZ_SMIL
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
#endif
return NS_OK;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:42,代码来源:DOMSVGPathSegList.cpp
示例14: do_QueryInterface
already_AddRefed<nsIDOMSVGPoint>
DOMSVGPointList::ReplaceItem(nsIDOMSVGPoint *aNewItem, uint32_t aIndex,
ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
nsCOMPtr<DOMSVGPoint> domItem = do_QueryInterface(aNewItem);
if (!domItem) {
aError.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
return nullptr;
}
if (aIndex >= LengthNoFlush()) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
if (domItem->HasOwner() || domItem->IsReadonly()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
nsAttrValue emptyOrOldValue = Element()->WillChangePointList();
if (mItems[aIndex]) {
// Notify any existing DOM item of removal *before* modifying the lists so
// that the DOM item can copy the *old* value at its index:
mItems[aIndex]->RemovingFromList();
}
InternalList()[aIndex] = domItem->ToSVGPoint();
mItems[aIndex] = domItem;
// This MUST come after the ToSVGPoint() call, otherwise that call
// would end up reading bad data from InternalList()!
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
Element()->DidChangePointList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}
开发者ID:PinZhang,项目名称:releases-mozilla-central,代码行数:42,代码来源:DOMSVGPointList.cpp
示例15: GetDOMWrapperIfExists
bool
DOMSVGPointList::AnimListMirrorsBaseList() const
{
return GetDOMWrapperIfExists(InternalAList().GetAnimValKey()) &&
!AttrIsAnimating();
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:6,代码来源:DOMSVGPointList.cpp
示例16: do_QueryInterface
NS_IMETHODIMP
DOMSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *aNewItem,
PRUint32 aIndex,
nsIDOMSVGPathSeg **_retval)
{
*_retval = nsnull;
if (IsAnimValList()) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
nsCOMPtr<DOMSVGPathSeg> domItem = do_QueryInterface(aNewItem);
if (!domItem) {
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
if (aIndex >= Length()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (domItem->HasOwner()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
if (ItemAt(aIndex)) {
// Notify any existing DOM item of removal *before* modifying the lists so
// that the DOM item can copy the *old* value at its index:
ItemAt(aIndex)->RemovingFromList();
}
PRUint32 internalIndex = mItems[aIndex].mInternalDataIndex;
// We use InternalList() to get oldArgCount since we may not have a DOM
// wrapper at the index being replaced.
PRUint32 oldType = SVGPathSegUtils::DecodeType(InternalList().mData[internalIndex]);
PRUint32 oldArgCount = SVGPathSegUtils::ArgCountForType(oldType);
PRUint32 newArgCount = SVGPathSegUtils::ArgCountForType(domItem->Type());
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
domItem->ToSVGPathSegEncodedData(segAsRaw);
bool ok = !!InternalList().mData.ReplaceElementsAt(
internalIndex, 1 + oldArgCount,
segAsRaw, 1 + newArgCount);
if (!ok) {
return NS_ERROR_OUT_OF_MEMORY;
}
ItemAt(aIndex) = domItem;
// This MUST come after the ToSVGPathSegEncodedData call, otherwise that call
// would end up reading bad data from InternalList()!
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
PRUint32 delta = newArgCount - oldArgCount;
if (delta != 0) {
for (PRUint32 i = aIndex + 1; i < Length(); ++i) {
mItems[i].mInternalDataIndex += delta;
}
}
Element()->DidChangePathSegList(true);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
NS_ADDREF(*_retval = domItem.get());
return NS_OK;
}
开发者ID:rfk,项目名称:services-central,代码行数:63,代码来源:DOMSVGPathSegList.cpp
示例17: Element
already_AddRefed<DOMSVGPathSeg>
DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem,
uint32_t aIndex,
ErrorResult& aError)
{
if (IsAnimValList()) {
aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
if (aIndex >= LengthNoFlush()) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
nsRefPtr<DOMSVGPathSeg> domItem = &aNewItem;
if (domItem->HasOwner()) {
domItem = domItem->Clone(); // must do this before changing anything!
}
nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList();
if (ItemAt(aIndex)) {
// Notify any existing DOM item of removal *before* modifying the lists so
// that the DOM item can copy the *old* value at its index:
ItemAt(aIndex)->RemovingFromList();
}
uint32_t internalIndex = mItems[aIndex].mInternalDataIndex;
// We use InternalList() to get oldArgCount since we may not have a DOM
// wrapper at the index being replaced.
uint32_t oldType = SVGPathSegUtils::DecodeType(InternalList().mData[internalIndex]);
// NOTE: ArgCountForType returns a (small) unsigned value, but we're
// intentionally putting it in a signed variable, because we're going to
// subtract these values and might produce something negative.
int32_t oldArgCount = SVGPathSegUtils::ArgCountForType(oldType);
int32_t newArgCount = SVGPathSegUtils::ArgCountForType(domItem->Type());
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
domItem->ToSVGPathSegEncodedData(segAsRaw);
bool ok = !!InternalList().mData.ReplaceElementsAt(
internalIndex, 1 + oldArgCount,
segAsRaw, 1 + newArgCount);
if (!ok) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
ItemAt(aIndex) = domItem;
// This MUST come after the ToSVGPathSegEncodedData call, otherwise that call
// would end up reading bad data from InternalList()!
domItem->InsertingIntoList(this, aIndex, IsAnimValList());
int32_t delta = newArgCount - oldArgCount;
if (delta != 0) {
for (uint32_t i = aIndex + 1; i < LengthNoFlush(); ++i) {
mItems[i].mInternalDataIndex += delta;
}
}
Element()->DidChangePathSegList(emptyOrOldValue);
if (AttrIsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:67,代码来源:DOMSVGPathSegList.cpp
注:本文中的AttrIsAnimating函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论