本文整理汇总了C++中SVGTransform::HasOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGTransform::HasOwner方法的具体用法?C++ SVGTransform::HasOwner怎么用?C++ SVGTransform::HasOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGTransform
的用法示例。
在下文中一共展示了SVGTransform::HasOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LengthNoFlush
already_AddRefed<SVGTransform>
DOMSVGTransformList::InsertItemBefore(SVGTransform& newItem,
uint32_t index, ErrorResult& error)
{
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
index = std::min(index, LengthNoFlush());
if (index >= SVGTransform::MaxListIndex()) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
nsRefPtr<SVGTransform> domItem = &newItem;
if (newItem.HasOwner()) {
domItem = newItem.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)) {
error.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
nsAttrValue emptyOrOldValue = Element()->WillChangeTransformList();
// Now that we know we're inserting, keep animVal list in sync as necessary.
MaybeInsertNullInAnimValListAt(index);
InternalList().InsertItem(index, domItem->ToSVGTransform());
mItems.InsertElementAt(index, 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, index, IsAnimValList());
UpdateListIndicesFromIndex(mItems, index + 1);
Element()->DidChangeTransformList(emptyOrOldValue);
if (mAList->IsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}
示例2: Element
already_AddRefed<SVGTransform>
DOMSVGTransformList::ReplaceItem(SVGTransform& newItem,
uint32_t index, ErrorResult& error)
{
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
if (index >= LengthNoFlush()) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
nsRefPtr<SVGTransform> domItem = &newItem;
if (newItem.HasOwner()) {
domItem = newItem.Clone(); // must do this before changing anything!
}
nsAttrValue emptyOrOldValue = Element()->WillChangeTransformList();
if (mItems[index]) {
// 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[index]->RemovingFromList();
}
InternalList()[index] = domItem->ToSVGTransform();
mItems[index] = domItem;
// This MUST come after the ToSVGPoint() call, otherwise that call
// would end up reading bad data from InternalList()!
domItem->InsertingIntoList(this, index, IsAnimValList());
Element()->DidChangeTransformList(emptyOrOldValue);
if (mAList->IsAnimating()) {
Element()->AnimationNeedsResample();
}
return domItem.forget();
}