本文整理汇总了C++中NodeVector::reserveInitialCapacity方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVector::reserveInitialCapacity方法的具体用法?C++ NodeVector::reserveInitialCapacity怎么用?C++ NodeVector::reserveInitialCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeVector
的用法示例。
在下文中一共展示了NodeVector::reserveInitialCapacity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeChildren
// this differs from other remove functions because it forcibly removes all the children,
// regardless of read-only status or event exceptions, e.g.
void ContainerNode::removeChildren()
{
if (!m_firstChild)
return;
// The container node can be removed from event handlers.
Ref<ContainerNode> protect(*this);
// exclude this node when looking for removed focusedNode since only children will be removed
document().removeFocusedNodeOfSubtree(this, true);
#if ENABLE(FULLSCREEN_API)
document().removeFullScreenElementOfSubtree(this, true);
#endif
// Do any prep work needed before actually starting to detach
// and remove... e.g. stop loading frames, fire unload events.
willRemoveChildren(*this);
NodeVector removedChildren;
{
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
{
NoEventDispatchAssertion assertNoEventDispatch;
removedChildren.reserveInitialCapacity(countChildNodes());
while (RefPtr<Node> n = m_firstChild) {
removedChildren.append(*m_firstChild);
removeBetween(0, m_firstChild->nextSibling(), *m_firstChild);
}
}
ChildChange change = { AllChildrenRemoved, nullptr, nullptr, ChildChangeSourceAPI };
childrenChanged(change);
for (size_t i = 0; i < removedChildren.size(); ++i)
ChildNodeRemovalNotifier(*this).notify(removedChildren[i].get());
}
if (document().svgExtensions()) {
Element* shadowHost = this->shadowHost();
if (!shadowHost || !shadowHost->hasTagName(SVGNames::useTag))
document().accessSVGExtensions()->rebuildElements();
}
dispatchSubtreeModifiedEvent();
}