本文整理汇总了C++中InlineTextBox::nextTextBox方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineTextBox::nextTextBox方法的具体用法?C++ InlineTextBox::nextTextBox怎么用?C++ InlineTextBox::nextTextBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineTextBox
的用法示例。
在下文中一共展示了InlineTextBox::nextTextBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove
void RenderTextLineBoxes::remove(InlineTextBox& box)
{
checkConsistency();
if (&box == m_first)
m_first = box.nextTextBox();
if (&box == m_last)
m_last = box.prevTextBox();
if (box.nextTextBox())
box.nextTextBox()->setPreviousTextBox(box.prevTextBox());
if (box.prevTextBox())
box.prevTextBox()->setNextTextBox(box.nextTextBox());
checkConsistency();
}
示例2: floatLinesBoundingBox
FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const
{
FloatRect boundingBox;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
boundingBox.unite(box->calculateBoundaries().toFloatRect());
return boundingBox;
}
示例3: computeAbsoluteRectForRange
IntRect RenderSVGInlineText::computeAbsoluteRectForRange(int startPos, int endPos)
{
IntRect rect;
RenderBlock* cb = containingBlock();
if (!cb || !cb->container())
return rect;
RenderSVGRoot* root = findSVGRootObject(parent());
if (!root)
return rect;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
rect.unite(box->selectionRect(0, 0, startPos, endPos));
// Mimic RenderBox::computeAbsoluteRepaintRect() functionality. But only the subset needed for SVG and respecting SVG transformations.
int x, y;
cb->container()->absolutePosition(x, y);
// Remove HTML parent translation offsets here! These need to be retrieved from the RenderSVGRoot object.
// But do take the containingBlocks's container position into account, ie. SVG text in scrollable <div>.
AffineTransform htmlParentCtm = root->RenderContainer::absoluteTransform();
FloatRect fixedRect(narrowPrecisionToFloat(rect.x() + x - xPos() - htmlParentCtm.e()), narrowPrecisionToFloat(rect.y() + y - yPos() - htmlParentCtm.f()), rect.width(), rect.height());
return enclosingIntRect(absoluteTransform().mapRect(fixedRect));
}
示例4: write
void write(TextStream& ts, const RenderObject& o, int indent)
{
#if ENABLE(SVG)
if (o.isRenderPath()) {
write(ts, *toRenderPath(&o), indent);
return;
}
if (o.isSVGContainer()) {
writeSVGContainer(ts, o, indent);
return;
}
if (o.isSVGRoot()) {
write(ts, *toRenderSVGRoot(&o), indent);
return;
}
if (o.isSVGText()) {
if (!o.isText())
writeSVGText(ts, *toRenderBlock(&o), indent);
else
writeSVGInlineText(ts, *toRenderText(&o), indent);
return;
}
if (o.isSVGImage()) {
writeSVGImage(ts, *toRenderImage(&o), indent);
return;
}
#endif
writeIndent(ts, indent);
ts << o << "\n";
if (o.isText() && !o.isBR()) {
const RenderText& text = *toRenderText(&o);
for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
writeIndent(ts, indent + 1);
writeTextRun(ts, text, *box);
}
}
for (RenderObject* child = o.firstChild(); child; child = child->nextSibling()) {
if (child->hasLayer())
continue;
write(ts, *child, indent + 1);
}
if (o.isWidget()) {
Widget* widget = toRenderWidget(&o)->widget();
if (widget && widget->isFrameView()) {
FrameView* view = static_cast<FrameView*>(widget);
RenderView* root = view->frame()->contentRenderer();
if (root) {
view->layout();
RenderLayer* l = root->layer();
if (l)
writeLayers(ts, l, l, IntRect(l->x(), l->y(), l->width(), l->height()), indent + 1);
}
}
}
}
示例5: linesBoundingBox
IntRect RenderSVGInlineText::linesBoundingBox() const
{
IntRect boundingBox;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
boundingBox.unite(box->calculateBoundaries());
return boundingBox;
}
示例6: write
static void write(QTextStream &ts, const RenderObject &o, int indent = 0)
{
writeIndent(ts, indent);
ts << o << "\n";
if (o.isText() && !o.isBR()) {
const RenderText &text = static_cast<const RenderText &>(o);
for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
writeIndent(ts, indent+1);
writeTextRun(ts, text, *box);
}
}
for (RenderObject *child = o.firstChild(); child; child = child->nextSibling()) {
if (child->layer()) {
continue;
}
write(ts, *child, indent + 1);
}
if (o.isWidget()) {
QWidget *widget = static_cast<const RenderWidget &>(o).widget();
if (widget && widget->inherits("KHTMLView")) {
KHTMLView *view = static_cast<KHTMLView *>(widget);
RenderObject *root = KWQ(view->part())->renderer();
if (root) {
view->layout();
RenderLayer* l = root->layer();
if (l)
writeLayers(ts, l, l, QRect(l->xPos(), l->yPos(), l->width(), l->height()), indent+1);
}
}
}
}
示例7: getPangoLayoutForAtk
static PangoLayout* getPangoLayoutForAtk(AtkText* textObject)
{
AccessibilityObject* coreObject = core(textObject);
HostWindow* hostWindow = coreObject->document()->view()->hostWindow();
if (!hostWindow)
return 0;
PlatformPageClient webView = hostWindow->platformPageClient();
if (!webView)
return 0;
GString* str = g_string_new(NULL);
AccessibilityRenderObject* accObject = static_cast<AccessibilityRenderObject*>(coreObject);
if (!accObject)
return 0;
RenderText* renderText = toRenderText(accObject->renderer());
if (!renderText)
return 0;
// Create a string with the layout as it appears on the screen
InlineTextBox* box = renderText->firstTextBox();
while (box) {
gchar *text = convertUniCharToUTF8(renderText->characters(), renderText->textLength(), box->start(), box->end());
g_string_append(str, text);
g_string_append(str, "\n");
box = box->nextTextBox();
}
PangoLayout* layout = gtk_widget_create_pango_layout(static_cast<GtkWidget*>(webView), g_string_free(str, FALSE));
g_object_set_data_full(G_OBJECT(textObject), "webkit-accessible-pango-layout", layout, g_object_unref);
return layout;
}
示例8: collectTextBoxesInLogicalOrder
static void collectTextBoxesInLogicalOrder(LineLayoutSVGInlineText textLineLayout, Vector<SVGInlineTextBox*>& textBoxes)
{
textBoxes.shrink(0);
for (InlineTextBox* textBox = textLineLayout.firstTextBox(); textBox; textBox = textBox->nextTextBox())
textBoxes.append(toSVGInlineTextBox(textBox));
std::sort(textBoxes.begin(), textBoxes.end(), InlineTextBox::compareByStart);
}
示例9: upstream
Position Position::upstream(EStayInBlock stayInBlock) const
{
Position start = equivalentDeepPosition();
NodeImpl *startNode = start.node();
if (!startNode)
return Position();
NodeImpl *block = startNode->enclosingBlockFlowOrTableElement();
Position lastVisible;
PositionIterator it(start);
for (; !it.atStart(); it.previous()) {
NodeImpl *currentNode = it.current().node();
if (stayInBlock) {
NodeImpl *currentBlock = currentNode->enclosingBlockFlowOrTableElement();
if (block != currentBlock)
return it.next();
}
RenderObject *renderer = currentNode->renderer();
if (!renderer)
continue;
if (renderer->style()->visibility() != VISIBLE)
continue;
lastVisible = it.current();
if (renderer->isReplaced() || renderer->isBR()) {
if (it.current().offset() >= renderer->caretMaxOffset())
return Position(currentNode, renderer->caretMaxOffset());
else
continue;
}
if (renderer->isText() && static_cast<RenderText *>(renderer)->firstTextBox()) {
if (currentNode != startNode)
return Position(currentNode, renderer->caretMaxOffset());
if (it.current().offset() < 0)
continue;
uint textOffset = it.current().offset();
RenderText *textRenderer = static_cast<RenderText *>(renderer);
for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
if (textOffset > box->start() && textOffset <= box->start() + box->len())
return it.current();
else if (box != textRenderer->lastTextBox() &&
!box->nextOnLine() &&
textOffset == box->start() + box->len() + 1)
return it.current();
}
}
}
return lastVisible.isNotNull() ? lastVisible : *this;
}
示例10: 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());
}
示例11: dirtyLineBoxes
void SVGInlineTextBox::dirtyLineBoxes()
{
dirtyOwnLineBoxes();
// And clear any following text fragments as the text on which they
// depend may now no longer exist, or glyph positions may be wrong
for (InlineTextBox* nextBox = nextTextBox(); nextBox; nextBox = nextBox->nextTextBox())
nextBox->dirtyOwnLineBoxes();
}
示例12: 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());
}
}
示例13: writeSVGInlineTextBoxes
static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text, int indent)
{
for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
if (!box->isSVGInlineTextBox())
continue;
writeSVGInlineTextBox(ts, toSVGInlineTextBox(box), indent);
}
}
示例14: positionForPoint
PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& point)
{
if (!firstTextBox() || !textLength())
return createPositionWithAffinity(0, DOWNSTREAM);
ASSERT(m_scalingFactor);
float baseline = m_scaledFont.fontMetrics().floatAscent() / m_scalingFactor;
LayoutBlock* containingBlock = this->containingBlock();
ASSERT(containingBlock);
// Map local point to absolute point, as the character origins stored in the text fragments use absolute coordinates.
FloatPoint absolutePoint(point);
absolutePoint.moveBy(containingBlock->location());
float closestDistance = std::numeric_limits<float>::max();
float closestDistancePosition = 0;
const SVGTextFragment* closestDistanceFragment = 0;
SVGInlineTextBox* closestDistanceBox = 0;
AffineTransform fragmentTransform;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
if (!box->isSVGInlineTextBox())
continue;
SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
Vector<SVGTextFragment>& fragments = textBox->textFragments();
unsigned textFragmentsSize = fragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
const SVGTextFragment& fragment = fragments.at(i);
FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height);
fragment.buildFragmentTransform(fragmentTransform);
if (!fragmentTransform.isIdentity())
fragmentRect = fragmentTransform.mapRect(fragmentRect);
float distance = 0;
if (!fragmentRect.contains(absolutePoint))
distance = squaredDistanceToClosestPoint(fragmentRect, absolutePoint);
if (distance <= closestDistance) {
closestDistance = distance;
closestDistanceBox = textBox;
closestDistanceFragment = &fragment;
closestDistancePosition = fragmentRect.x();
}
}
}
if (!closestDistanceFragment)
return createPositionWithAffinity(0, DOWNSTREAM);
int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanceFragment, absolutePoint.x() - closestDistancePosition, true);
return createPositionWithAffinity(offset + closestDistanceBox->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
}
示例15: positionForPoint
VisiblePosition RenderSVGInlineText::positionForPoint(const LayoutPoint& point, const RenderRegion*)
{
if (!firstTextBox() || !textLength())
return createVisiblePosition(0, DOWNSTREAM);
float baseline = m_scaledFont.fontMetrics().floatAscent();
RenderBlock* containingBlock = this->containingBlock();
ASSERT(containingBlock);
// Map local point to absolute point, as the character origins stored in the text fragments use absolute coordinates.
FloatPoint absolutePoint(point);
absolutePoint.moveBy(containingBlock->location());
float closestDistance = std::numeric_limits<float>::max();
float closestDistancePosition = 0;
const SVGTextFragment* closestDistanceFragment = nullptr;
SVGInlineTextBox* closestDistanceBox = nullptr;
AffineTransform fragmentTransform;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
if (!is<SVGInlineTextBox>(*box))
continue;
auto& textBox = downcast<SVGInlineTextBox>(*box);
Vector<SVGTextFragment>& fragments = textBox.textFragments();
unsigned textFragmentsSize = fragments.size();
for (unsigned i = 0; i < textFragmentsSize; ++i) {
const SVGTextFragment& fragment = fragments.at(i);
FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height);
fragment.buildFragmentTransform(fragmentTransform);
if (!fragmentTransform.isIdentity())
fragmentRect = fragmentTransform.mapRect(fragmentRect);
float distance = powf(fragmentRect.x() - absolutePoint.x(), 2) +
powf(fragmentRect.y() + fragmentRect.height() / 2 - absolutePoint.y(), 2);
if (distance < closestDistance) {
closestDistance = distance;
closestDistanceBox = &textBox;
closestDistanceFragment = &fragment;
closestDistancePosition = fragmentRect.x();
}
}
}
if (!closestDistanceFragment)
return createVisiblePosition(0, DOWNSTREAM);
int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanceFragment, absolutePoint.x() - closestDistancePosition, true);
return createVisiblePosition(offset + closestDistanceBox->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
}