本文整理汇总了C++中DocAccessible::UnbindFromDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ DocAccessible::UnbindFromDocument方法的具体用法?C++ DocAccessible::UnbindFromDocument怎么用?C++ DocAccessible::UnbindFromDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocAccessible
的用法示例。
在下文中一共展示了DocAccessible::UnbindFromDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AccEvent
void
XULTreeAccessible::InvalidateCache(int32_t aRow, int32_t aCount)
{
if (IsDefunct())
return;
if (!mTreeView) {
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>,
nullptr);
return;
}
// Do not invalidate the cache if rows have been inserted.
if (aCount > 0)
return;
DocAccessible* document = Document();
// Fire destroy event for removed tree items and delete them from caches.
for (int32_t rowIdx = aRow; rowIdx < aRow - aCount; rowIdx++) {
void* key = reinterpret_cast<void*>(rowIdx);
Accessible* treeItem = mAccessibleCache.GetWeak(key);
if (treeItem) {
nsRefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_HIDE, treeItem);
nsEventShell::FireEvent(event);
// Unbind from document, shutdown and remove from tree cache.
document->UnbindFromDocument(treeItem);
mAccessibleCache.Remove(key);
}
}
// We dealt with removed tree items already however we may keep tree items
// having row indexes greater than row count. We should remove these dead tree
// items silently from caches.
int32_t newRowCount = 0;
nsresult rv = mTreeView->GetRowCount(&newRowCount);
if (NS_FAILED(rv))
return;
int32_t oldRowCount = newRowCount - aCount;
for (int32_t rowIdx = newRowCount; rowIdx < oldRowCount; ++rowIdx) {
void *key = reinterpret_cast<void*>(rowIdx);
Accessible* treeItem = mAccessibleCache.GetWeak(key);
if (treeItem) {
// Unbind from document, shutdown and remove from tree cache.
document->UnbindFromDocument(treeItem);
mAccessibleCache.Remove(key);
}
}
}
示例2: Document
void
HTMLLIAccessible::UpdateBullet(bool aHasBullet)
{
if (aHasBullet == !!mBullet) {
NS_NOTREACHED("Bullet and accessible are in sync already!");
return;
}
DocAccessible* document = Document();
if (aHasBullet) {
mBullet = new HTMLListBulletAccessible(mContent, mDoc);
document->BindToDocument(mBullet, nullptr);
InsertChildAt(0, mBullet);
} else {
RemoveChild(mBullet);
document->UnbindFromDocument(mBullet);
mBullet = nullptr;
}
// XXXtodo: fire show/hide and reorder events. That's hard to make it
// right now because coalescence happens by DOM node.
}