本文整理汇总了C++中selectionState函数的典型用法代码示例。如果您正苦于以下问题:C++ selectionState函数的具体用法?C++ selectionState怎么用?C++ selectionState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了selectionState函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ASSERT
IntRect RenderSVGInlineText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/)
{
ASSERT(!needsLayout());
if (selectionState() == SelectionNone)
return IntRect();
// Early exit if we're ie. a <text> within a <defs> section.
if (isChildOfHiddenContainer(this))
return IntRect();
// Now calculate startPos and endPos for painting selection.
// We include a selection while endPos > 0
int startPos, endPos;
if (selectionState() == SelectionInside) {
// We are fully selected.
startPos = 0;
endPos = textLength();
} else {
selectionStartEnd(startPos, endPos);
if (selectionState() == SelectionStart)
endPos = textLength();
else if (selectionState() == SelectionEnd)
startPos = 0;
}
if (startPos == endPos)
return IntRect();
return computeRepaintRectForRange(repaintContainer, startPos, endPos);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:31,代码来源:RenderSVGInlineText.cpp
示例2: x
void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
{
if (!shouldPaint(paintInfo, tx, ty))
return;
tx += x();
ty += y();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, tx, ty);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, tx, ty);
return;
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo.context, tx, ty, width(), height());
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
if (!paintInfo.shouldPaintWithinRoot(this))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
IntRect borderRect = IntRect(tx, ty, width(), height());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect));
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, tx, ty);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (drawSelectionTint) {
IntRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.move(tx, ty);
paintInfo.context->fillRect(selectionPaintingRect, selectionBackgroundColor(), style()->colorSpace());
}
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:60,代码来源:RenderReplaced.cpp
示例3: location
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, adjustedPaintOffset);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo.context, paintRect);
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && !canHaveChildren())
return;
if (!paintInfo.shouldPaintWithinRoot(this))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(paintRect, view()));
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, adjustedPaintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (drawSelectionTint) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor(), style()->colorSpace());
}
}
开发者ID:Moondee,项目名称:Artemis,代码行数:60,代码来源:RenderReplaced.cpp
示例4: ASSERT
IntRect RenderSVGInlineText::selectionRect(bool)
{
ASSERT(!needsLayout());
IntRect rect;
if (selectionState() == SelectionNone)
return rect;
// Early exit if we're ie. a <text> within a <defs> section.
if (isChildOfHiddenContainer(this))
return rect;
// Now calculate startPos and endPos for painting selection.
// We include a selection while endPos > 0
int startPos, endPos;
if (selectionState() == SelectionInside) {
// We are fully selected.
startPos = 0;
endPos = textLength();
} else {
selectionStartEnd(startPos, endPos);
if (selectionState() == SelectionStart)
endPos = textLength();
else if (selectionState() == SelectionEnd)
startPos = 0;
}
if (startPos == endPos)
return rect;
return computeAbsoluteRectForRange(startPos, endPos);
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:32,代码来源:RenderSVGInlineText.cpp
示例5: selectionState
GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo)
{
GapRects result;
bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth;
if (!firstLineBox()) {
if (containsStart) {
// Go ahead and update our lastLogicalTop to be the bottom of the block. <hr>s or empty blocks with height can trip this
// case.
lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) + logicalHeight();
lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeight());
lastLogicalRight = logicalRightSelectionOffset(rootBlock, logicalHeight());
}
return result;
}
RootInlineBox* lastSelectedLine = 0;
RootInlineBox* curr;
for (curr = firstRootBox(); curr && !curr->hasSelectedChildren(); curr = curr->nextRootBox()) { }
// Now paint the gaps for the lines.
for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) {
LayoutUnit selTop = curr->selectionTopAdjustedForPrecedingBlock();
LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock();
if (!containsStart && !lastSelectedLine && selectionState() != SelectionStart && selectionState() != SelectionBoth) {
result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop,
lastLogicalLeft, lastLogicalRight, selTop, paintInfo));
}
LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth(), selTop + selHeight);
logicalRect.move(offsetFromRootBlock);
LayoutRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);
if (!paintInfo || (physicalRect.y() < paintInfo->rect.maxY() && physicalRect.maxY() > paintInfo->rect.y()))
result.unite(curr->lineSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, selTop, selHeight, paintInfo));
lastSelectedLine = curr;
}
if (containsStart && !lastSelectedLine) {
// VisibleSelection must start just after our last line.
lastSelectedLine = lastRootBox();
}
if (lastSelectedLine && selectionState() != SelectionEnd && selectionState() != SelectionBoth) {
// Go ahead and update our lastY to be the bottom of the last selected line.
lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) + lastSelectedLine->selectionBottom();
lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
}
return result;
}
开发者ID:domenic,项目名称:mojo,代码行数:54,代码来源:RenderBlockFlow.cpp
示例6: selectionState
EventCommand* DialogCommandChangeState::getCommand() const{
QVector<QString> command;
selectionState(command);
operation(command);
return new EventCommand(EventCommandKind::ChangeState, command);
}
开发者ID:Wano-k,项目名称:RPG-Paper-Maker,代码行数:7,代码来源:dialogcommandchangestate.cpp
示例7: renderer
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
if (!isHorizontal())
boxOrigin.move(0, -virtualLogicalHeight());
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
if (!isHorizontal())
context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise));
FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
bool isPrinting = renderer().document().printing();
bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && selectionState() != RenderObject::SelectionNone;
if (haveSelection)
paintSelection(context, boxOrigin, style, font);
else if (paintInfo.phase == PaintPhaseSelection)
return;
TextPainter::Style textStyle = TextPainter::textPaintingStyle(renderer(), style, paintInfo.forceBlackText(), isPrinting);
if (haveSelection)
textStyle = TextPainter::selectionPaintingStyle(renderer(), true, paintInfo.forceBlackText(), isPrinting, textStyle);
TextRun textRun = constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextPainter textPainter(context, font, textRun, textOrigin, boxRect, isHorizontal());
textPainter.paint(0, m_str.length(), m_str.length(), textStyle);
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:33,代码来源:EllipsisBox.cpp
示例8: ASSERT
void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
{
ASSERT(paintInfo.shouldPaintWithinRoot(renderer()));
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
ASSERT(truncation() == cNoTruncation);
if (renderer()->style()->visibility() != VISIBLE)
return;
RenderObject* parentRenderer = parent()->renderer();
ASSERT(parentRenderer);
ASSERT(!parentRenderer->document().printing());
// Determine whether or not we're selected.
bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
bool hasSelection = selectionState() != RenderObject::SelectionNone;
if (!hasSelection || paintSelectedTextOnly)
return;
Color backgroundColor = renderer()->selectionBackgroundColor();
if (!backgroundColor.alpha())
return;
RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer());
ASSERT(textRenderer);
if (!textShouldBePainted(textRenderer))
return;
RenderStyle* style = parentRenderer->style();
ASSERT(style);
int startPosition, endPosition;
selectionStartEnd(startPosition, endPosition);
int fragmentStartPosition = 0;
int fragmentEndPosition = 0;
AffineTransform fragmentTransform;
unsigned textFragmentsSize = m_textFragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
SVGTextFragment& fragment = m_textFragments.at(i);
ASSERT(!m_paintingResource);
fragmentStartPosition = startPosition;
fragmentEndPosition = endPosition;
if (!mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
continue;
GraphicsContextStateSaver stateSaver(*paintInfo.context);
fragment.buildFragmentTransform(fragmentTransform);
if (!fragmentTransform.isIdentity())
paintInfo.context->concatCTM(fragmentTransform);
paintInfo.context->setFillColor(backgroundColor);
paintInfo.context->fillRect(selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style), backgroundColor);
m_paintingResourceMode = ApplyToDefaultMode;
}
ASSERT(!m_paintingResource);
}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:60,代码来源:SVGInlineTextBox.cpp
示例9: ASSERT
void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
{
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
ASSERT(!paintInfo.context->paintingDisabled());
bool isPrinting = renderSVGText().document().printing();
bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
PaintInfo childPaintInfo(paintInfo);
if (hasSelection) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox())
toSVGInlineTextBox(child)->paintSelectionBackground(childPaintInfo);
else if (child->isSVGInlineFlowBox())
toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintInfo);
}
}
SVGRenderingContext renderingContext(renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
if (renderingContext.isRenderingPrepared()) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox())
SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(&toSVGInlineTextBox(child)->renderer());
child->paint(paintInfo, LayoutPoint(), 0, 0);
}
}
}
开发者ID:boska,项目名称:webkit,代码行数:28,代码来源:SVGRootInlineBox.cpp
示例10: renderer
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
if (!isHorizontal())
boxOrigin.move(0, -virtualLogicalHeight());
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
if (!isHorizontal())
context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise));
FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
Color styleTextColor = renderer().resolveColor(style, CSSPropertyWebkitTextFillColor);
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, boxOrigin, style, font);
// Select the correct color for painting the text.
Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor();
if (foreground != styleTextColor)
context->setFillColor(foreground);
}
// Text shadows are disabled when printing. http://crbug.com/258321
const ShadowList* shadowList = context->printing() ? 0 : style->textShadow();
bool hasShadow = shadowList;
if (hasShadow) {
OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create();
for (size_t i = shadowList->shadows().size(); i--; ) {
const ShadowData& shadow = shadowList->shadows()[i];
float shadowX = isHorizontal() ? shadow.x() : shadow.y();
float shadowY = isHorizontal() ? shadow.y() : -shadow.x();
FloatSize offset(shadowX, shadowY);
drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(),
DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha);
}
drawLooperBuilder->addUnmodifiedContent();
context->setDrawLooper(drawLooperBuilder.release());
}
TextRun textRun = RenderBlockFlow::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextRunPaintInfo textRunPaintInfo(textRun);
textRunPaintInfo.bounds = boxRect;
context->drawText(font, textRunPaintInfo, textOrigin);
// Restore the regular fill color.
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (hasShadow)
context->clearDrawLooper();
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:60,代码来源:EllipsisBox.cpp
示例11: setSelectionState
void RenderWidget::setSelectionState(SelectionState state)
{
if (selectionState() != state) {
RenderReplaced::setSelectionState(state);
if (m_widget)
m_widget->setIsSelected(isSelected());
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:8,代码来源:RenderWidget.cpp
示例12: selectionState
void RenderBoxModelObject::setSelectionState(SelectionState state)
{
if (state == SelectionInside && selectionState() != SelectionNone)
return;
if ((state == SelectionStart && selectionState() == SelectionEnd)
|| (state == SelectionEnd && selectionState() == SelectionStart))
RenderObject::setSelectionState(SelectionBoth);
else
RenderObject::setSelectionState(state);
// FIXME: We should consider whether it is OK propagating to ancestor RenderInlines.
// This is a workaround for http://webkit.org/b/32123
// The containing block can be null in case of an orphaned tree.
RenderBlock* containingBlock = this->containingBlock();
if (containingBlock && !containingBlock->isRenderView())
containingBlock->setSelectionState(state);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:18,代码来源:RenderBoxModelObject.cpp
示例13: selectionState
GapRects RootInlineBox::lineSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
LayoutUnit selTop, LayoutUnit selHeight, const LogicalSelectionOffsetCaches& cache, const PaintInfo* paintInfo)
{
RenderObject::SelectionState lineState = selectionState();
bool leftGap, rightGap;
blockFlow().getSelectionGapInfo(lineState, leftGap, rightGap);
GapRects result;
InlineBox* firstBox = firstSelectedBox();
InlineBox* lastBox = lastSelectedBox();
if (leftGap) {
result.uniteLeft(blockFlow().logicalLeftSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &firstBox->parent()->renderer(), firstBox->logicalLeft(),
selTop, selHeight, cache, paintInfo));
}
if (rightGap) {
result.uniteRight(blockFlow().logicalRightSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, &lastBox->parent()->renderer(), lastBox->logicalRight(),
selTop, selHeight, cache, paintInfo));
}
// When dealing with bidi text, a non-contiguous selection region is possible.
// e.g. The logical text aaaAAAbbb (capitals denote RTL text and non-capitals LTR) is layed out
// visually as 3 text runs |aaa|bbb|AAA| if we select 4 characters from the start of the text the
// selection will look like (underline denotes selection):
// |aaa|bbb|AAA|
// ___ _
// We can see that the |bbb| run is not part of the selection while the runs around it are.
if (firstBox && firstBox != lastBox) {
// Now fill in any gaps on the line that occurred between two selected elements.
LayoutUnit lastLogicalLeft = firstBox->logicalRight();
bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
if (box->selectionState() != RenderObject::SelectionNone) {
LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft() - lastLogicalLeft, selHeight);
logicalRect.move(renderer().isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
LayoutRect gapRect = rootBlock.logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);
if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.height() > 0) {
if (paintInfo && box->parent()->renderer().style().visibility() == VISIBLE)
paintInfo->context->fillRect(gapRect, box->parent()->renderer().selectionBackgroundColor(), box->parent()->renderer().style().colorSpace());
// VisibleSelection may be non-contiguous, see comment above.
result.uniteCenter(gapRect);
}
lastLogicalLeft = box->logicalRight();
}
if (box == lastBox)
break;
isPreviousBoxSelected = box->selectionState() != RenderObject::SelectionNone;
}
}
return result;
}
开发者ID:qfish,项目名称:webkit,代码行数:53,代码来源:RootInlineBox.cpp
示例14: paintBoxDecorations
void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
{
if (!shouldPaint(paintInfo, tx, ty))
return;
tx += m_x;
ty += m_y;
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, tx, ty);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, tx, ty);
return;
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo.context, tx, ty, width(), height(), style());
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
if (!shouldPaintWithinRoot(paintInfo))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
paintReplaced(paintInfo, tx, ty);
if (drawSelectionTint) {
IntRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.move(tx, ty);
paintInfo.context->fillRect(selectionPaintingRect, selectionBackgroundColor());
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:40,代码来源:RenderReplaced.cpp
示例15: ASSERT
LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const
{
ASSERT(!needsLayout());
if (selectionState() == SelectionNone || !inlineBoxWrapper())
return LayoutRect();
RootInlineBox& root = inlineBoxWrapper()->root();
LayoutRect rect(0, root.selectionTop() - location().y(), size().width(), root.selectionHeight());
mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, nullptr);
// FIXME: groupedMapping() leaks the squashing abstraction.
if (paintInvalidationContainer->layer()->groupedMapping())
PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
return rect;
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:15,代码来源:LayoutListMarker.cpp
示例16: selectionState
GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
const RenderObject::PaintInfo* paintInfo)
{
RenderObject::SelectionState lineState = selectionState();
bool leftGap, rightGap;
block()->getHorizontalSelectionGapInfo(lineState, leftGap, rightGap);
GapRects result;
InlineBox* firstBox = firstSelectedBox();
InlineBox* lastBox = lastSelectedBox();
if (leftGap)
result.uniteLeft(block()->fillLeftSelectionGap(firstBox->parent()->renderer(),
firstBox->x(), selTop, selHeight,
rootBlock, blockX, blockY, tx, ty, paintInfo));
if (rightGap)
result.uniteRight(block()->fillRightSelectionGap(lastBox->parent()->renderer(),
lastBox->x() + lastBox->width(), selTop, selHeight,
rootBlock, blockX, blockY, tx, ty, paintInfo));
// When dealing with bidi text, a non-contiguous selection region is possible.
// e.g. The logical text aaaAAAbbb (capitals denote RTL text and non-capitals LTR) is layed out
// visually as 3 text runs |aaa|bbb|AAA| if we select 4 characters from the start of the text the
// selection will look like (underline denotes selection):
// |aaa|bbb|AAA|
// ___ _
// We can see that the |bbb| run is not part of the selection while the runs around it are.
if (firstBox && firstBox != lastBox) {
// Now fill in any gaps on the line that occurred between two selected elements.
int lastX = firstBox->x() + firstBox->width();
bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
if (box->selectionState() != RenderObject::SelectionNone) {
if (isPreviousBoxSelected) // VisibleSelection may be non-contiguous, see comment above.
result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->renderer(),
lastX + tx, selTop + ty,
box->x() - lastX, selHeight, paintInfo));
lastX = box->x() + box->width();
}
if (box == lastBox)
break;
isPreviousBoxSelected = box->selectionState() != RenderObject::SelectionNone;
}
}
return result;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:48,代码来源:RootInlineBox.cpp
示例17: localSelectionRect
LayoutRect LayoutReplaced::localSelectionRect() const
{
if (selectionState() == SelectionNone)
return LayoutRect();
if (!inlineBoxWrapper()) {
// We're a block-level replaced element. Just return our own dimensions.
return LayoutRect(LayoutPoint(), size());
}
RootInlineBox& root = inlineBoxWrapper()->root();
LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode() ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectionTop() - inlineBoxWrapper()->logicalTop();
if (root.block().style()->isHorizontalWritingMode())
return LayoutRect(0, newLogicalTop, size().width(), root.selectionHeight());
return LayoutRect(newLogicalTop, 0, root.selectionHeight(), size().height());
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:16,代码来源:LayoutReplaced.cpp
示例18: renderer
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
Color styleTextColor = renderer().resolveColor(style, CSSPropertyWebkitTextFillColor);
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, boxOrigin, style, font);
// Select the correct color for painting the text.
Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor();
if (foreground != styleTextColor)
context->setFillColor(foreground);
}
const ShadowList* shadowList = style->textShadow();
bool hasShadow = shadowList;
if (hasShadow)
context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::ShadowIgnoresAlpha));
TextRun textRun = constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextRunPaintInfo textRunPaintInfo(textRun);
textRunPaintInfo.bounds = boxRect;
context->drawText(font, textRunPaintInfo, textOrigin);
// Restore the regular fill color.
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (hasShadow)
context->clearDrawLooper();
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
开发者ID:domenic,项目名称:mojo,代码行数:44,代码来源:EllipsisBox.cpp
示例19: location
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Vector<RenderBox*>& layers)
{
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorationBackground())
paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
if (style()->outlineWidth())
paintOutline(paintInfo, paintRect);
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, adjustedPaintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (selectionState() != SelectionNone) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
}
}
开发者ID:ztyjr888,项目名称:mojo,代码行数:43,代码来源:RenderReplaced.cpp
示例20: ASSERT
IntRect RenderListMarker::selectionRect(bool clipToVisibleContent)
{
ASSERT(!needsLayout());
if (selectionState() == SelectionNone || !inlineBoxWrapper())
return IntRect();
RootInlineBox* root = inlineBoxWrapper()->root();
IntRect rect(0, root->selectionTop() - yPos(), width(), root->selectionHeight());
if (clipToVisibleContent)
computeAbsoluteRepaintRect(rect);
else {
int absx, absy;
absolutePosition(absx, absy);
rect.move(absx, absy);
}
return rect;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:20,代码来源:RenderListMarker.cpp
注:本文中的selectionState函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论