本文整理汇总了C++中PaintLayer::addBlockSelectionGapsBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintLayer::addBlockSelectionGapsBounds方法的具体用法?C++ PaintLayer::addBlockSelectionGapsBounds怎么用?C++ PaintLayer::addBlockSelectionGapsBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintLayer
的用法示例。
在下文中一共展示了PaintLayer::addBlockSelectionGapsBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintSelection
void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ASSERT(paintInfo.phase == PaintPhaseForeground);
if (!m_layoutBlockFlow.shouldPaintSelectionGaps())
return;
LayoutUnit lastTop = 0;
LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layoutBlockFlow, lastTop);
LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layoutBlockFlow, lastTop);
LayoutRect bounds = m_layoutBlockFlow.visualOverflowRect();
bounds.moveBy(paintOffset);
// Only create a DrawingRecorder and ClipScope if skipRecording is false. This logic is needed
// because selectionGaps(...) needs to be called even when we do not record.
bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, paintOffset);
Optional<LayoutObjectDrawingRecorder> drawingRecorder;
Optional<ClipScope> clipScope;
if (!skipRecording) {
drawingRecorder.emplace(paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, FloatRect(bounds), paintOffset);
clipScope.emplace(paintInfo.context);
}
LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight,
skipRecording ? nullptr : &paintInfo,
skipRecording ? nullptr : &(*clipScope));
// TODO(wkorman): Rework below to process paint invalidation rects during layout rather than paint.
if (!gapRectsBounds.isEmpty()) {
PaintLayer* layer = m_layoutBlockFlow.enclosingLayer();
gapRectsBounds.moveBy(-paintOffset);
if (!m_layoutBlockFlow.hasLayer()) {
LayoutRect localBounds(gapRectsBounds);
m_layoutBlockFlow.flipForWritingMode(localBounds);
gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox());
if (layer->layoutObject()->hasOverflowClip())
gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset());
}
layer->addBlockSelectionGapsBounds(gapRectsBounds);
}
}