本文整理汇总了C++中InlineTextBox::nextOnLineExists方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineTextBox::nextOnLineExists方法的具体用法?C++ InlineTextBox::nextOnLineExists怎么用?C++ InlineTextBox::nextOnLineExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineTextBox
的用法示例。
在下文中一共展示了InlineTextBox::nextOnLineExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: textForRenderer
static gchar* textForRenderer(RenderObject* renderer)
{
GString* resultText = g_string_new(0);
if (!renderer)
return g_string_free(resultText, FALSE);
// For RenderBlocks, piece together the text from the RenderText objects they contain.
for (RenderObject* object = renderer->firstChild(); object; object = object->nextSibling()) {
if (object->isBR()) {
g_string_append(resultText, "\n");
continue;
}
RenderText* renderText;
if (object->isText())
renderText = toRenderText(object);
else {
// List item's markers will be treated in an special way
// later on this function, so ignore them here.
if (object->isReplaced() && !renderer->isListItem())
g_string_append_unichar(resultText, objectReplacementCharacter);
// We need to check children, if any, to consider when
// current object is not a text object but some of its
// children are, in order not to miss those portions of
// text by not properly handling those situations
if (object->firstChild())
g_string_append(resultText, textForRenderer(object));
continue;
}
InlineTextBox* box = renderText ? renderText->firstTextBox() : 0;
while (box) {
// WebCore introduces line breaks in the text that do not reflect
// the layout you see on the screen, replace them with spaces.
String text = String(renderText->characters(), renderText->textLength()).replace("\n", " ");
g_string_append(resultText, text.substring(box->start(), box->end() - box->start() + 1).utf8().data());
// Newline chars in the source result in separate text boxes, so check
// before adding a newline in the layout. See bug 25415 comment #78.
// If the next sibling is a BR, we'll add the newline when we examine that child.
if (!box->nextOnLineExists() && !(object->nextSibling() && object->nextSibling()->isBR())) {
// If there was a '\n' in the last position of the
// current text box, it would have been converted to a
// space in String::replace(), so remove it first.
if (renderText->characters()[box->end()] == '\n')
g_string_erase(resultText, resultText->len - 1, -1);
g_string_append(resultText, "\n");
}
box = box->nextTextBox();
}
}
// Insert the text of the marker for list item in the right place, if present
if (renderer->isListItem()) {
String markerText = toRenderListItem(renderer)->markerTextWithSuffix();
if (renderer->style()->direction() == LTR)
g_string_prepend(resultText, markerText.utf8().data());
else
g_string_append(resultText, markerText.utf8().data());
}
return g_string_free(resultText, FALSE);
}