本文整理汇总了C++中VisiblePosition::honorEditableBoundaryAtOrBefore方法的典型用法代码示例。如果您正苦于以下问题:C++ VisiblePosition::honorEditableBoundaryAtOrBefore方法的具体用法?C++ VisiblePosition::honorEditableBoundaryAtOrBefore怎么用?C++ VisiblePosition::honorEditableBoundaryAtOrBefore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisiblePosition
的用法示例。
在下文中一共展示了VisiblePosition::honorEditableBoundaryAtOrBefore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logicalEndOfLine
VisiblePosition logicalEndOfLine(const VisiblePosition& c)
{
VisiblePosition visPos = logicalEndPositionForLine(c);
// Make sure the end of line is at the same line as the given input position. For a wrapping line, the logical end
// position for the not-last-2-lines might incorrectly hand back the logical beginning of the next line.
// For example, <div contenteditable dir="rtl" style="line-break:before-white-space">abcdefg abcdefg abcdefg
// a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg </div>
// In this case, use the previous position of the computed logical end position.
if (!inSameLogicalLine(c, visPos))
visPos = visPos.previous();
return c.honorEditableBoundaryAtOrBefore(visPos);
}
示例2: endOfLine
VisiblePosition endOfLine(const VisiblePosition& c)
{
VisiblePosition visPos = endPositionForLine(c);
// Make sure the end of line is at the same line as the given input position. Else use the previous position to
// obtain end of line. This condition happens when the input position is before the space character at the end
// of a soft-wrapped non-editable line. In this scenario, endPositionForLine would incorrectly hand back a position
// in the next line instead. This fix is to account for the discrepancy between lines with webkit-line-break:after-white-space style
// versus lines without that style, which would break before a space by default.
if (!inSameLine(c, visPos)) {
visPos = c.previous();
if (visPos.isNull())
return VisiblePosition();
visPos = endPositionForLine(visPos);
}
return c.honorEditableBoundaryAtOrBefore(visPos);
}
示例3: nextSentencePosition
VisiblePosition nextSentencePosition(const VisiblePosition &c)
{
VisiblePosition next = nextBoundary(c, nextSentencePositionBoundary);
return c.honorEditableBoundaryAtOrBefore(next);
}