本文整理汇总了C++中TrackExceptionState::had_exception方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackExceptionState::had_exception方法的具体用法?C++ TrackExceptionState::had_exception怎么用?C++ TrackExceptionState::had_exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackExceptionState
的用法示例。
在下文中一共展示了TrackExceptionState::had_exception方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: containsNode
bool DOMSelection::containsNode(const Node* n, bool allowPartial) const
{
if (!m_frame)
return false;
FrameSelection& selection = m_frame->selection();
if (!n || m_frame->document() != n->document() || selection.isNone())
return false;
unsigned nodeIndex = n->nodeIndex();
RefPtr<Range> selectedRange = selection.selection().toNormalizedRange();
ContainerNode* parentNode = n->parentNode();
if (!parentNode)
return false;
TrackExceptionState exceptionState;
bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) >= 0 && !exceptionState.had_exception()
&& Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) <= 0 && !exceptionState.had_exception();
if (exceptionState.had_exception())
return false;
if (nodeFullySelected)
return true;
bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) > 0 && !exceptionState.had_exception())
|| (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !exceptionState.had_exception());
ASSERT(!exceptionState.had_exception());
if (nodeFullyUnselected)
return false;
return allowPartial || n->isTextNode();
}
示例2: frameContentAsPlainText
static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBuilder& output)
{
Document* document = frame->document();
if (!document)
return;
if (!frame->view())
return;
// Select the document body.
RefPtr<Range> range(document->createRange());
TrackExceptionState exceptionState;
range->selectNodeContents(document, exceptionState);
if (!exceptionState.had_exception()) {
// The text iterator will walk nodes giving us text. This is similar to
// the plainText() function in core/editing/TextIterator.h, but we implement the maximum
// size and also copy the results directly into a wstring, avoiding the
// string conversion.
for (TextIterator it(range.get()); !it.atEnd(); it.advance()) {
it.appendTextToStringBuilder(output, 0, maxChars - output.length());
if (output.length() >= maxChars)
return; // Filled up the buffer.
}
}
}
示例3:
void SplitTextNodeCommand::insertText1AndTrimText2()
{
TrackExceptionState exceptionState;
m_text2->parentNode()->insertBefore(m_text1.get(), m_text2.get(), exceptionState);
if (exceptionState.had_exception())
return;
m_text2->deleteData(0, m_offset, exceptionState, CharacterData::DeprecatedRecalcStyleImmediatlelyForEditing);
}