这篇教程C++ toRenderSVGInlineText函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toRenderSVGInlineText函数的典型用法代码示例。如果您正苦于以下问题:C++ toRenderSVGInlineText函数的具体用法?C++ toRenderSVGInlineText怎么用?C++ toRenderSVGInlineText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toRenderSVGInlineText函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: toRenderSVGInlineTextbool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object){ // RenderSVGInlineText performs whitespace filtering in order to support xml:space // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up with an empty string // even when its original constructor argument is non-empty. return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyText();}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:7,
示例2: toRenderSVGInlineTextFloatRect SVGInlineTextBox::calculateBoundaries() const{ FloatRect textRect; RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer()); ASSERT(textRenderer); float scalingFactor = textRenderer->scalingFactor(); ASSERT(scalingFactor); float baseline = textRenderer->scaledFont().fontMetrics().floatAscent() / scalingFactor; AffineTransform fragmentTransform; unsigned textFragmentsSize = m_textFragments.size(); for (unsigned i = 0; i < textFragmentsSize; ++i) { const SVGTextFragment& fragment = m_textFragments.at(i); FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height); fragment.buildFragmentTransform(fragmentTransform); if (!fragmentTransform.isIdentity()) fragmentRect = fragmentTransform.mapRect(fragmentRect); textRect.unite(fragmentRect); } return textRect;}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:26,
示例3: collectLayoutAttributesstatic inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes){ for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) { if (descendant->isSVGInlineText()) attributes.append(toRenderSVGInlineText(descendant)->layoutAttributes()); }}
开发者ID:ddxxyy,项目名称:webkit,代码行数:7,
示例4: ASSERTbool SVGTextQuery::executeQuery(Data* queryData, ProcessTextFragmentCallback fragmentCallback) const{ ASSERT(!m_textBoxes.isEmpty()); unsigned processedCharacters = 0; unsigned textBoxCount = m_textBoxes.size(); // Loop over all text boxes for (unsigned textBoxPosition = 0; textBoxPosition < textBoxCount; ++textBoxPosition) { queryData->textBox = m_textBoxes.at(textBoxPosition); queryData->textRenderer = toRenderSVGInlineText(queryData->textBox->textRenderer()); ASSERT(queryData->textRenderer); ASSERT(queryData->textRenderer->style()); ASSERT(queryData->textRenderer->style()->svgStyle()); queryData->isVerticalText = queryData->textRenderer->style()->svgStyle()->isVerticalWritingMode(); const Vector<SVGTextFragment>& fragments = queryData->textBox->textFragments(); // Loop over all text fragments in this text box, firing a callback for each. unsigned fragmentCount = fragments.size(); for (unsigned i = 0; i < fragmentCount; ++i) { const SVGTextFragment& fragment = fragments.at(i); if ((this->*fragmentCallback)(queryData, fragment)) return true; processedCharacters += fragment.length; } queryData->processedCharacters = processedCharacters; } return false;}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:33,
示例5: findPreviousAndNextAttributesstatic inline bool findPreviousAndNextAttributes(RenderObject* root, RenderSVGInlineText* locateElement, SVGTextLayoutAttributes*& previous, SVGTextLayoutAttributes*& next){ ASSERT(root); ASSERT(locateElement); bool stopAfterNext = false; RenderObject* current = root->firstChild(); while (current) { if (current->isSVGInlineText()) { RenderSVGInlineText* text = toRenderSVGInlineText(current); if (locateElement != text) { if (stopAfterNext) { next = text->layoutAttributes(); return true; } previous = text->layoutAttributes(); } else { stopAfterNext = true; } } else if (current->isSVGInline()) { // Descend into text content (if possible). if (RenderObject* child = current->firstChild()) { current = child; continue; } } current = current->nextInPreOrderAfterChildren(root); } return false;}
开发者ID:coinpayee,项目名称:blink,代码行数:31,
示例6: ASSERTvoid RenderSVGText::subtreeChildWillBeRemoved(RenderObject* child, Vector<SVGTextLayoutAttributes*, 2>& affectedAttributes){ ASSERT(child); if (!shouldHandleSubtreeMutations()) return; checkLayoutAttributesConsistency(this, m_layoutAttributes); // The positioning elements cache depends on the size of each text renderer in the // subtree. If this changes, clear the cache. It's going to be rebuilt below. m_layoutAttributesBuilder.clearTextPositioningElements(); if (m_layoutAttributes.isEmpty() || !child->isSVGInlineText()) return; // This logic requires that the 'text' child is still inserted in the tree. RenderSVGInlineText* text = toRenderSVGInlineText(child); bool stopAfterNext = false; SVGTextLayoutAttributes* previous = 0; SVGTextLayoutAttributes* next = 0; if (!documentBeingDestroyed()) findPreviousAndNextAttributes(this, text, stopAfterNext, previous, next); if (previous) affectedAttributes.append(previous); if (next) affectedAttributes.append(next); size_t position = m_layoutAttributes.find(text->layoutAttributes()); ASSERT(position != notFound); m_layoutAttributes.remove(position);}
开发者ID:ddxxyy,项目名称:webkit,代码行数:31,
示例7: renderervoid SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const{ auto activePaintingResource = this->activePaintingResource(); if (!activePaintingResource) { // TODO: We're only supporting simple filled HTML text so far. RenderSVGResourceSolidColor* solidPaintingResource = RenderSVGResource::sharedSolidPaintingResource(); solidPaintingResource->setColor(context->fillColor()); activePaintingResource = solidPaintingResource; } auto& elementRenderer = renderer().isRenderElement() ? toRenderElement(renderer()) : *renderer().parent(); RenderStyle& style = elementRenderer.style(); ASSERT(activePaintingResource); RenderSVGResourceMode resourceMode = context->textDrawingMode() == TextModeStroke ? ApplyToStrokeMode : ApplyToFillMode; auto translator(createGlyphToPathTranslator(*fontData, glyphBuffer, from, numGlyphs, point)); while (translator->containsMorePaths()) { Path glyphPath = translator->nextPath(); if (activePaintingResource->applyResource(elementRenderer, style, context, resourceMode)) { float strokeThickness = context->strokeThickness(); if (renderer().isSVGInlineText()) context->setStrokeThickness(strokeThickness * toRenderSVGInlineText(renderer()).scalingFactor()); activePaintingResource->postApplyResource(elementRenderer, context, resourceMode, &glyphPath, 0); context->setStrokeThickness(strokeThickness); } }}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:28,
示例8: toRenderSVGInlineTextvoid SVGTextMetricsBuilder::walkTree(RenderObject* start, RenderSVGInlineText* stopAtLeaf, MeasureTextData* data){ for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { if (child->isSVGInlineText()) { RenderSVGInlineText* text = toRenderSVGInlineText(child); if (stopAtLeaf && stopAtLeaf != text) { data->processRenderer = false; measureTextRenderer(text, data); continue; } data->processRenderer = true; measureTextRenderer(text, data); if (stopAtLeaf) return; continue; } if (!child->isSVGInline()) continue; walkTree(child, stopAtLeaf, data); }}
开发者ID:anger123520,项目名称:qtwebkit-23_from_gitorious,代码行数:25,
示例9: ASSERTvoid SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject* start, bool& lastCharacterWasSpace){ ASSERT(!start->isSVGText() || m_textPositions.isEmpty()); for (RenderObject* child = start->firstChildSlow(); child; child = child->nextSibling()) { if (child->isSVGInlineText()) { processRenderSVGInlineText(*toRenderSVGInlineText(child), m_textLength, lastCharacterWasSpace); continue; } if (!child->isSVGInline()) continue; SVGTextPositioningElement* element = SVGTextPositioningElement::elementFromRenderer(child); unsigned atPosition = m_textPositions.size(); if (element) m_textPositions.append(TextPosition(element, m_textLength)); collectTextPositioningElements(child, lastCharacterWasSpace); if (!element) continue; // Update text position, after we're back from recursion. TextPosition& position = m_textPositions[atPosition]; ASSERT(!position.length); position.length = m_textLength - position.start; }}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:29,
示例10: ASSERTFloatRect SVGInlineTextBox::selectionRectForTextFragment(const SVGTextFragment& fragment, int startPosition, int endPosition, RenderStyle* style){ ASSERT(startPosition < endPosition); ASSERT(style); FontCachePurgePreventer fontCachePurgePreventer; RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer()); ASSERT(textRenderer); float scalingFactor = textRenderer->scalingFactor(); ASSERT(scalingFactor); const Font& scaledFont = textRenderer->scaledFont(); const FontMetrics& scaledFontMetrics = scaledFont.fontMetrics(); FloatPoint textOrigin(fragment.x, fragment.y); if (scalingFactor != 1) textOrigin.scale(scalingFactor, scalingFactor); textOrigin.move(0, -scaledFontMetrics.floatAscent()); FloatRect selectionRect = scaledFont.selectionRectForText(constructTextRun(style, fragment), textOrigin, fragment.height * scalingFactor, startPosition, endPosition); if (scalingFactor == 1) return selectionRect; selectionRect.scale(1 / scalingFactor); return selectionRect;}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:28,
示例11: findPreviousAndNextAttributesstatic inline bool findPreviousAndNextAttributes(RenderObject* start, RenderSVGInlineText* locateElement, bool& stopAfterNext, SVGTextLayoutAttributes*& previous, SVGTextLayoutAttributes*& next){ ASSERT(start); ASSERT(locateElement); // FIXME: Make this iterative. for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { if (child->isSVGInlineText()) { RenderSVGInlineText* text = toRenderSVGInlineText(child); if (locateElement != text) { if (stopAfterNext) { next = text->layoutAttributes(); return true; } previous = text->layoutAttributes(); continue; } stopAfterNext = true; continue; } if (!child->isSVGInline()) continue; if (findPreviousAndNextAttributes(child, locateElement, stopAfterNext, previous, next)) return true; } return false;}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:31,
示例12: toRenderSVGInlineTextvoid SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyle* style, TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int endPosition){ RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer()); ASSERT(textRenderer); float scalingFactor = textRenderer->scalingFactor(); ASSERT(scalingFactor); const Font& scaledFont = textRenderer->scaledFont(); const ShadowData* shadow = style->textShadow(); FloatPoint textOrigin(fragment.x, fragment.y); FloatSize textSize(fragment.width, fragment.height); if (scalingFactor != 1) { textOrigin.scale(scalingFactor, scalingFactor); textSize.scale(scalingFactor); } FloatRect shadowRect(FloatPoint(textOrigin.x(), textOrigin.y() - scaledFont.fontMetrics().floatAscent()), textSize); do { if (!prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, style)) break; FloatSize extraOffset; if (shadow) extraOffset = applyShadowToGraphicsContext(context, shadow, shadowRect, false /* stroked */, true /* opaque */, true /* horizontal */); AffineTransform originalTransform; if (scalingFactor != 1) { originalTransform = context->getCTM(); AffineTransform newTransform = originalTransform; newTransform.scale(1 / scalingFactor); normalizeTransform(newTransform); context->setCTM(newTransform); } scaledFont.drawText(context, textRun, textOrigin + extraOffset, startPosition, endPosition); if (scalingFactor != 1) context->setCTM(originalTransform); restoreGraphicsContextAfterTextPainting(context, textRun); if (!shadow) break; if (shadow->next()) context->restore(); else context->clearShadow(); shadow = shadow->next(); } while (shadow);}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:58,
示例13: writeSVGInlineTextBoxstatic inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textBox, int indent){ Vector<SVGTextFragment>& fragments = textBox->textFragments(); if (fragments.isEmpty()) return; RenderSVGInlineText* textRenderer = toRenderSVGInlineText(textBox->textRenderer()); ASSERT(textRenderer); const SVGRenderStyle* svgStyle = textRenderer->style()->svgStyle(); String text = textBox->textRenderer()->text(); unsigned fragmentsSize = fragments.size(); for (unsigned i = 0; i < fragmentsSize; ++i) { SVGTextFragment& fragment = fragments.at(i); writeIndent(ts, indent + 1); unsigned startOffset = fragment.characterOffset; unsigned endOffset = fragment.characterOffset + fragment.length; // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << "chunk 1 "; ETextAnchor anchor = svgStyle->textAnchor(); bool isVerticalText = svgStyle->isVerticalWritingMode(); if (anchor == TA_MIDDLE) { ts << "(middle anchor"; if (isVerticalText) ts << ", vertical"; ts << ") "; } else if (anchor == TA_END) { ts << "(end anchor"; if (isVerticalText) ts << ", vertical"; ts << ") "; } else if (isVerticalText) ts << "(vertical) "; startOffset -= textBox->start(); endOffset -= textBox->start(); // </hack> ts << "text run " << i + 1 << " at (" << fragment.x << "," << fragment.y << ")"; ts << " startOffset " << startOffset << " endOffset " << endOffset; if (isVerticalText) ts << " height " << fragment.height; else ts << " width " << fragment.width; if (!textBox->isLeftToRightDirection() || textBox->dirOverride()) { ts << (textBox->isLeftToRightDirection() ? " LTR" : " RTL"); if (textBox->dirOverride()) ts << " override"; } ts << ": " << quoteAndEscapeNonPrintables(text.substring(fragment.characterOffset, fragment.length)) << "/n"; }}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:56,
示例14: recursiveUpdateLayoutAttributesstatic inline void recursiveUpdateLayoutAttributes(RenderObject* start, SVGTextLayoutAttributesBuilder& builder){ if (start->isSVGInlineText()) { builder.buildLayoutAttributesForTextRenderer(toRenderSVGInlineText(start)); return; } for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) recursiveUpdateLayoutAttributes(child, builder);}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:10,
示例15: updateFontInAllDescendantsstatic inline void updateFontInAllDescendants(RenderObject* start, SVGTextLayoutAttributesBuilder* builder = 0){ for (RenderObject* descendant = start; descendant; descendant = descendant->nextInPreOrder(start)) { if (!descendant->isSVGInlineText()) continue; RenderSVGInlineText& text = toRenderSVGInlineText(*descendant); text.updateScaledFont(); if (builder) builder->rebuildMetricsForTextRenderer(text); }}
开发者ID:ddxxyy,项目名称:webkit,代码行数:11,
示例16: recursiveCollectLayoutAttributesstatic inline void recursiveCollectLayoutAttributes(RenderObject* start, Vector<SVGTextLayoutAttributes*>& attributes){ for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { if (child->isSVGInlineText()) { attributes.append(toRenderSVGInlineText(child)->layoutAttributes()); continue; } recursiveCollectLayoutAttributes(child, attributes); }}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:11,
示例17: reverseInlineBoxRangeAndValueListsIfNeededstatic inline void reverseInlineBoxRangeAndValueListsIfNeeded(void* userData, Vector<InlineBox*>::iterator first, Vector<InlineBox*>::iterator last){ ASSERT(userData); Vector<SVGTextLayoutAttributes*>& attributes = *reinterpret_cast<Vector<SVGTextLayoutAttributes*>*>(userData); // This is a copy of std::reverse(first, last). It additionally assures that the metrics map within the renderers belonging to the InlineBoxes are reordered as well. while (true) { if (first == last || first == --last) return; if (!(*last)->isSVGInlineTextBox() || !(*first)->isSVGInlineTextBox()) { InlineBox* temp = *first; *first = *last; *last = temp; ++first; continue; } SVGInlineTextBox* firstTextBox = toSVGInlineTextBox(*first); SVGInlineTextBox* lastTextBox = toSVGInlineTextBox(*last); // Reordering is only necessary for BiDi text that is _absolutely_ positioned. if (firstTextBox->len() == 1 && firstTextBox->len() == lastTextBox->len()) { RenderSVGInlineText& firstContext = toRenderSVGInlineText(firstTextBox->renderer()); RenderSVGInlineText& lastContext = toRenderSVGInlineText(lastTextBox->renderer()); SVGTextLayoutAttributes* firstAttributes = 0; SVGTextLayoutAttributes* lastAttributes = 0; findFirstAndLastAttributesInVector(attributes, &firstContext, &lastContext, firstAttributes, lastAttributes); swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTextBox->start(), lastTextBox->start()); } InlineBox* temp = *first; *first = *last; *last = temp; ++first; }}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:39,
示例18: checkLayoutAttributesConsistencyvoid RenderSVGText::subtreeStyleDidChange(){ if (!shouldHandleSubtreeMutations() || documentBeingDestroyed()) return; checkLayoutAttributesConsistency(this, m_layoutAttributes); // Only update the metrics cache, but not the text positioning element cache // nor the layout attributes cached in the leaf #text renderers. FontCachePurgePreventer fontCachePurgePreventer; for (RenderObject* descendant = firstChild(); descendant; descendant = descendant->nextInPreOrder(this)) { if (descendant->isSVGInlineText()) m_layoutAttributesBuilder.rebuildMetricsForTextRenderer(toRenderSVGInlineText(descendant)); }}
开发者ID:coinpayee,项目名称:blink,代码行数:15,
示例19: ASSERTvoid SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit){ ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); ASSERT(!paintInfo.context->paintingDisabled()); RenderObject* boxRenderer = renderer(); ASSERT(boxRenderer); SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingContext::SaveGraphicsContext); if (renderingContext.isRenderingPrepared()) { for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { if (child->isSVGInlineTextBox()) computeTextMatchMarkerRectForRenderer(toRenderSVGInlineText(static_cast<SVGInlineTextBox*>(child)->textRenderer())); child->paint(paintInfo, LayoutPoint(), 0, 0); } }}
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:18,
示例20: walkTreestatic void walkTree(RenderSVGText* start, RenderSVGInlineText* stopAtLeaf, MeasureTextData* data){ RenderObject* child = start->firstChild(); while (child) { if (child->isSVGInlineText()) { RenderSVGInlineText* text = toRenderSVGInlineText(child); measureTextRenderer(text, data, !stopAtLeaf || stopAtLeaf == text); if (stopAtLeaf && stopAtLeaf == text) return; } else if (child->isSVGInline()) { // Visit children of text content elements. if (RenderObject* inlineChild = toRenderSVGInline(child)->firstChild()) { child = inlineChild; continue; } } child = child->nextInPreOrderAfterChildren(start); }}
开发者ID:kjthegod,项目名称:WebKit,代码行数:19,
示例21: toRenderSVGInlineTextint SVGInlineTextBox::offsetForPositionInFragment(const SVGTextFragment& fragment, float position, bool includePartialGlyphs) const{ RenderSVGInlineText& textRenderer = toRenderSVGInlineText(this->renderer()); float scalingFactor = textRenderer.scalingFactor(); ASSERT(scalingFactor); RenderStyle* style = textRenderer.style(); ASSERT(style); TextRun textRun = constructTextRun(style, fragment); // Eventually handle lengthAdjust="spacingAndGlyphs". // FIXME: Handle vertical text. AffineTransform fragmentTransform; fragment.buildFragmentTransform(fragmentTransform); if (!fragmentTransform.isIdentity()) textRun.setHorizontalGlyphStretch(narrowPrecisionToFloat(fragmentTransform.xScale())); return fragment.characterOffset - start() + textRenderer.scaledFont().offsetForPosition(textRun, position * scalingFactor, includePartialGlyphs);}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:21,
注:本文中的toRenderSVGInlineText函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toRenderText函数代码示例 C++ toRenderImage函数代码示例 |