本文整理汇总了C++中FontCascade::adjustSelectionRectForText方法的典型用法代码示例。如果您正苦于以下问题:C++ FontCascade::adjustSelectionRectForText方法的具体用法?C++ FontCascade::adjustSelectionRectForText怎么用?C++ FontCascade::adjustSelectionRectForText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontCascade
的用法示例。
在下文中一共展示了FontCascade::adjustSelectionRectForText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintSelection
void EllipsisBox::paintSelection(GraphicsContext& context, const LayoutPoint& paintOffset, const RenderStyle& style, const FontCascade& font)
{
Color textColor = style.visitedDependentColor(CSSPropertyColor);
Color c = blockFlow().selectionBackgroundColor();
if (!c.isValid() || !c.alpha())
return;
// If the text color ends up being the same as the selection background, invert the selection
// background.
if (textColor == c)
c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue());
const RootInlineBox& rootBox = root();
GraphicsContextStateSaver stateSaver(context);
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
LayoutRect selectionRect = LayoutRect(x() + paintOffset.x(), y() + paintOffset.y() + rootBox.selectionTop(), 0, rootBox.selectionHeight());
TextRun run = RenderBlock::constructTextRun(&blockFlow(), font, m_str, style, AllowTrailingExpansion);
font.adjustSelectionRectForText(run, selectionRect, 0, -1);
context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c);
}