本文整理汇总了C++中SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates方法的具体用法?C++ SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates怎么用?C++ SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGInlineTextBox
的用法示例。
在下文中一共展示了SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeTextMatchMarkerRectForRenderer
void SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(RenderSVGInlineText* textRenderer)
{
ASSERT(textRenderer);
Node* node = textRenderer->node();
if (!node || !node->inDocument())
return;
RenderStyle* style = textRenderer->style();
ASSERT(style);
Document* document = textRenderer->document();
Vector<DocumentMarker> markers = document->markers()->markersForNode(textRenderer->node());
Vector<DocumentMarker>::iterator markerEnd = markers.end();
for (Vector<DocumentMarker>::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) {
const DocumentMarker& marker = *markerIt;
// SVG is only interessted in the TextMatch marker, for now.
if (marker.type != DocumentMarker::TextMatch)
continue;
FloatRect markerRect;
for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
ASSERT(box->isSVGInlineTextBox());
SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(box);
int markerStartPosition = max<int>(marker.startOffset - textBox->start(), 0);
int markerEndPosition = min<int>(marker.endOffset - textBox->start(), textBox->len());
if (markerStartPosition >= markerEndPosition)
continue;
int fragmentStartPosition = 0;
int fragmentEndPosition = 0;
const Vector<SVGTextFragment>& fragments = textBox->textFragments();
unsigned textFragmentsSize = fragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
const SVGTextFragment& fragment = fragments.at(i);
fragmentStartPosition = markerStartPosition;
fragmentEndPosition = markerEndPosition;
if (!textBox->mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
continue;
FloatRect fragmentRect = textBox->selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style);
if (!fragment.transform.isIdentity())
fragmentRect = fragment.transform.mapRect(fragmentRect);
markerRect.unite(fragmentRect);
}
}
document->markers()->setRenderedRectForMarker(node, marker, textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());
}
}
示例2: paintTextMatchMarker
void SVGInlineTextBox::paintTextMatchMarker(GraphicsContext* context, const FloatPoint&, DocumentMarker* marker, RenderStyle* style, const Font& font)
{
// SVG is only interested in the TextMatch markers.
if (marker->type() != DocumentMarker::TextMatch)
return;
RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer());
ASSERT(textRenderer);
FloatRect markerRect;
AffineTransform fragmentTransform;
for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
if (!box->isSVGInlineTextBox())
continue;
SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
int markerStartPosition = max<int>(marker->startOffset() - textBox->start(), 0);
int markerEndPosition = min<int>(marker->endOffset() - textBox->start(), textBox->len());
if (markerStartPosition >= markerEndPosition)
continue;
const Vector<SVGTextFragment>& fragments = textBox->textFragments();
unsigned textFragmentsSize = fragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
const SVGTextFragment& fragment = fragments.at(i);
int fragmentStartPosition = markerStartPosition;
int fragmentEndPosition = markerEndPosition;
if (!textBox->mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
continue;
FloatRect fragmentRect = textBox->selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style);
fragment.buildFragmentTransform(fragmentTransform);
bool fragmentTransformIsIdentity = fragmentTransform.isIdentity();
// Draw the marker highlight.
if (renderer()->frame()->editor().markedTextMatchesAreHighlighted()) {
Color color = marker->activeMatch() ?
RenderTheme::theme().platformActiveTextSearchHighlightColor() :
RenderTheme::theme().platformInactiveTextSearchHighlightColor();
GraphicsContextStateSaver stateSaver(*context);
if (!fragmentTransformIsIdentity)
context->concatCTM(fragmentTransform);
context->setFillColor(color);
context->fillRect(fragmentRect, color);
}
if (!fragmentTransformIsIdentity)
fragmentRect = fragmentTransform.mapRect(fragmentRect);
markerRect.unite(fragmentRect);
}
}
toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());
}
示例3: paintTextMatchMarker
void SVGInlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* context, const LayoutPoint&, DocumentMarker* marker, const ComputedStyle& style, const Font& font)
{
// SVG is only interested in the TextMatch markers.
if (marker->type() != DocumentMarker::TextMatch)
return;
LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
AffineTransform fragmentTransform;
for (InlineTextBox* box = textLayoutObject.firstTextBox(); box; box = box->nextTextBox()) {
if (!box->isSVGInlineTextBox())
continue;
SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
int markerStartPosition = std::max<int>(marker->startOffset() - textBox->start(), 0);
int markerEndPosition = std::min<int>(marker->endOffset() - textBox->start(), textBox->len());
if (markerStartPosition >= markerEndPosition)
continue;
const Vector<SVGTextFragment>& fragments = textBox->textFragments();
unsigned textFragmentsSize = fragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
const SVGTextFragment& fragment = fragments.at(i);
int fragmentStartPosition = markerStartPosition;
int fragmentEndPosition = markerEndPosition;
if (!textBox->mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
continue;
FloatRect fragmentRect = textBox->selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style);
fragment.buildFragmentTransform(fragmentTransform);
// Draw the marker highlight.
if (m_svgInlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHighlighted()) {
Color color = marker->activeMatch() ?
LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
GraphicsContextStateSaver stateSaver(*context);
if (!fragmentTransform.isIdentity())
context->concatCTM(fragmentTransform);
context->setFillColor(color);
context->fillRect(fragmentRect, color);
}
}
}
}