本文整理汇总了C++中HeapVector::first方法的典型用法代码示例。如果您正苦于以下问题:C++ HeapVector::first方法的具体用法?C++ HeapVector::first怎么用?C++ HeapVector::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeapVector
的用法示例。
在下文中一共展示了HeapVector::first方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doApply
//.........这里部分代码省略.........
}
// Adjust the position so we don't split at the beginning of a quote.
while (isFirstVisiblePositionInNode(createVisiblePosition(pos),
toHTMLQuoteElement(enclosingNodeOfType(
pos, isMailHTMLBlockquoteElement)))) {
pos = previousPositionOf(pos, PositionMoveType::GraphemeCluster);
}
// startNode is the first node that we need to move to the new blockquote.
Node* startNode = pos.anchorNode();
DCHECK(startNode);
// Split at pos if in the middle of a text node.
if (startNode->isTextNode()) {
Text* textNode = toText(startNode);
int textOffset = pos.computeOffsetInContainerNode();
if ((unsigned)textOffset >= textNode->length()) {
startNode = NodeTraversal::next(*startNode);
DCHECK(startNode);
} else if (textOffset > 0) {
splitTextNode(textNode, textOffset);
}
} else if (pos.computeEditingOffset() > 0) {
Node* childAtOffset =
NodeTraversal::childAt(*startNode, pos.computeEditingOffset());
startNode = childAtOffset ? childAtOffset : NodeTraversal::next(*startNode);
DCHECK(startNode);
}
// If there's nothing inside topBlockquote to move, we're finished.
if (!startNode->isDescendantOf(topBlockquote)) {
setEndingSelection(SelectionInDOMTree::Builder()
.collapse(firstPositionInOrBeforeNode(startNode))
.setIsDirectional(endingSelection().isDirectional())
.build());
return;
}
// Build up list of ancestors in between the start node and the top
// blockquote.
HeapVector<Member<Element>> ancestors;
for (Element* node = startNode->parentElement();
node && node != topBlockquote; node = node->parentElement())
ancestors.append(node);
// Insert a clone of the top blockquote after the break.
Element* clonedBlockquote = topBlockquote->cloneElementWithoutChildren();
insertNodeAfter(clonedBlockquote, breakElement, editingState);
if (editingState->isAborted())
return;
// Clone startNode's ancestors into the cloned blockquote.
// On exiting this loop, clonedAncestor is the lowest ancestor
// that was cloned (i.e. the clone of either ancestors.last()
// or clonedBlockquote if ancestors is empty).
Element* clonedAncestor = clonedBlockquote;
for (size_t i = ancestors.size(); i != 0; --i) {
Element* clonedChild = ancestors[i - 1]->cloneElementWithoutChildren();
// Preserve list item numbering in cloned lists.
if (isHTMLOListElement(*clonedChild)) {
Node* listChildNode = i > 1 ? ancestors[i - 2].get() : startNode;
// The first child of the cloned list might not be a list item element,
// find the first one so that we know where to start numbering.
while (listChildNode && !isHTMLLIElement(*listChildNode))
listChildNode = listChildNode->nextSibling();