本文整理汇总了C++中nsCOMPtr::First方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::First方法的具体用法?C++ nsCOMPtr::First怎么用?C++ nsCOMPtr::First使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::First方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formControl
void
nsFindContentIterator::MaybeSetupInnerIterator()
{
mInnerIterator = nsnull;
nsCOMPtr<nsIContent> content =
do_QueryInterface(mOuterIterator->GetCurrentNode());
if (!content || !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL))
return;
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(content));
if (!formControl->IsTextControl(true)) {
return;
}
SetupInnerIterator(content);
if (mInnerIterator) {
if (!mFindBackward) {
mInnerIterator->First();
// finish setup: position mOuterIterator on the actual "next"
// node (this completes its re-init, @see SetupInnerIterator)
if (!mOuterIterator->IsDone())
mOuterIterator->First();
}
else {
mInnerIterator->Last();
// finish setup: position mOuterIterator on the actual "previous"
// node (this completes its re-init, @see SetupInnerIterator)
if (!mOuterIterator->IsDone())
mOuterIterator->Last();
}
}
}
示例2: formControl
void
nsFindContentIterator::MaybeSetupInnerIterator()
{
mInnerIterator = nsnull;
nsIContent* content = mOuterIterator->GetCurrentNode();
if (!content || !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL))
return;
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(content));
PRInt32 controlType = formControl->GetType();
if (controlType != NS_FORM_TEXTAREA &&
controlType != NS_FORM_INPUT_TEXT)
return;
SetupInnerIterator(content);
if (mInnerIterator) {
if (!mFindBackward) {
mInnerIterator->First();
// finish setup: position mOuterIterator on the actual "next"
// node (this completes its re-init, @see SetupInnerIterator)
mOuterIterator->First();
}
else {
mInnerIterator->Last();
// finish setup: position mOuterIterator on the actual "previous"
// node (this completes its re-init, @see SetupInnerIterator)
mOuterIterator->Last();
}
}
}
示例3: startContent
void
nsFindContentIterator::Reset()
{
mInnerIterator = nsnull;
mStartOuterContent = nsnull;
mEndOuterContent = nsnull;
// As a consequence of searching through text controls, we may have been
// initialized with a selection inside a <textarea> or a text <input>.
// see if the start node is an anonymous text node inside a text control
nsCOMPtr<nsIContent> startContent(do_QueryInterface(mStartNode));
if (startContent) {
mStartOuterContent = startContent->FindFirstNonNativeAnonymous();
}
// see if the end node is an anonymous text node inside a text control
nsCOMPtr<nsIContent> endContent(do_QueryInterface(mEndNode));
if (endContent) {
mEndOuterContent = endContent->FindFirstNonNativeAnonymous();
}
// Note: OK to just set up the outer iterator here; if our range has a native
// anonymous endpoint we'll end up setting up an inner iterator, and
// reset the outer one in the process.
nsCOMPtr<nsIDOMRange> range = nsFind::CreateRange();
range->SetStart(mStartNode, mStartOffset);
range->SetEnd(mEndNode, mEndOffset);
mOuterIterator->Init(range);
if (!mFindBackward) {
if (mStartOuterContent != startContent) {
// the start node was an anonymous text node
SetupInnerIterator(mStartOuterContent);
if (mInnerIterator)
mInnerIterator->First();
}
if (!mOuterIterator->IsDone())
mOuterIterator->First();
}
else {
if (mEndOuterContent != endContent) {
// the end node was an anonymous text node
SetupInnerIterator(mEndOuterContent);
if (mInnerIterator)
mInnerIterator->Last();
}
if (!mOuterIterator->IsDone())
mOuterIterator->Last();
}
// if we didn't create an inner-iterator, the boundary node could still be
// a text control, in which case we also need an inner-iterator straightaway
if (!mInnerIterator) {
MaybeSetupInnerIterator();
}
}