本文整理汇总了C++中InlineBox::isInlineFlowBox方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineBox::isInlineFlowBox方法的具体用法?C++ InlineBox::isInlineFlowBox怎么用?C++ InlineBox::isInlineFlowBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineBox
的用法示例。
在下文中一共展示了InlineBox::isInlineFlowBox方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutCharactersInTextBoxes
void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGTextLayoutEngine& characterLayout)
{
for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox()) {
ASSERT(child->renderer().isSVGInlineText());
SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
characterLayout.layoutInlineTextBox(textBox);
} else {
// Skip generated content.
Node* node = child->renderer().node();
if (!node)
continue;
ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox());
SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
bool isTextPath = node->hasTagName(SVGNames::textPathTag);
if (isTextPath) {
// Build text chunks for all <textPath> children, using the line layout algorithm.
// This is needeed as text-anchor is just an additional startOffset for text paths.
SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes());
layoutCharactersInTextBoxes(flowBox, lineLayout);
characterLayout.beginTextPathLayout(&child->renderer(), lineLayout);
}
layoutCharactersInTextBoxes(flowBox, characterLayout);
if (isTextPath)
characterLayout.endTextPathLayout();
}
}
}
示例2: layoutChildBoxes
void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRect)
{
for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
FloatRect boxRect;
if (child->isSVGInlineTextBox()) {
ASSERT(child->renderer().isSVGInlineText());
SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
boxRect = textBox->calculateBoundaries();
textBox->setX(boxRect.x());
textBox->setY(boxRect.y());
textBox->setLogicalWidth(boxRect.width());
textBox->setLogicalHeight(boxRect.height());
} else {
// Skip generated content.
if (!child->renderer().node())
continue;
ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox());
SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
layoutChildBoxes(flowBox);
boxRect = flowBox->calculateBoundaries();
flowBox->setX(boxRect.x());
flowBox->setY(boxRect.y());
flowBox->setLogicalWidth(boxRect.width());
flowBox->setLogicalHeight(boxRect.height());
}
if (childRect)
childRect->unite(boxRect);
}
}
示例3: adjustMaxAscentAndDescent
void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
int maxPositionTop, int maxPositionBottom)
{
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
// The computed lineheight needs to be extended for the
// positioned elements
// see khtmltests/rendering/html_align.html
if (curr->object()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
if (curr->yPos() == PositionTop || curr->yPos() == PositionBottom) {
if (curr->yPos() == PositionTop) {
if (maxAscent + maxDescent < curr->height())
maxDescent = curr->height() - maxAscent;
}
else {
if (maxAscent + maxDescent < curr->height())
maxAscent = curr->height() - maxDescent;
}
if ( maxAscent + maxDescent >= kMax( maxPositionTop, maxPositionBottom ) )
break;
}
if (curr->isInlineFlowBox())
static_cast<InlineFlowBox*>(curr)->adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
}
}
示例4: placeBoxesVerticallyWithAbsBaseline
static void placeBoxesVerticallyWithAbsBaseline(InlineFlowBox* flow, int& heightOfBlock, int& minY, int& maxY, int& baseline, int yPos)
{
for (InlineBox* curr = flow->firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->isInlineFlowBox() && !curr->object()->element()->hasTagName(aTag)) {
SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(curr->object()->element());
baseline += (int)(text->dy()->getFirst().value());
if (text->y()->numberOfItems() > 0)
baseline = (int)(text->y()->getFirst().value() - yPos);
placeBoxesVerticallyWithAbsBaseline(static_cast<InlineFlowBox*>(curr), heightOfBlock, minY, maxY, baseline, yPos);
}
const Font& font = curr->object()->firstLineStyle()->font(); // FIXME: Is it right to always use firstLineStyle here?
int ascent = font.ascent();
int position = baseline - ascent;
int height = ascent + font.descent();
curr->setBaseline(ascent);
curr->setYPos(position);
curr->setHeight(height);
if (position < minY)
minY = position;
if (position + height > maxY)
maxY = position + height;
}
if (flow->isRootInlineBox()) {
flow->setYPos(minY);
flow->setHeight(maxY - minY);
flow->setBaseline(baseline - minY);
heightOfBlock += maxY - minY;
}
}
示例5: layoutChildBoxes
void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start)
{
for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
if (child->isSVGInlineTextBox()) {
ASSERT(child->renderer());
ASSERT(child->renderer()->isSVGInlineText());
SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child);
IntRect boxRect = textBox->calculateBoundaries();
textBox->setX(boxRect.x());
textBox->setY(boxRect.y());
textBox->setLogicalWidth(boxRect.width());
textBox->setLogicalHeight(boxRect.height());
} else {
ASSERT(child->isInlineFlowBox());
// Skip generated content.
if (!child->renderer()->node())
continue;
SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child);
layoutChildBoxes(flowBox);
IntRect boxRect = flowBox->calculateBoundaries();
flowBox->setX(boxRect.x());
flowBox->setY(boxRect.y());
flowBox->setLogicalWidth(boxRect.width());
flowBox->setLogicalHeight(boxRect.height());
}
}
}
示例6: determineSpacingForFlowBoxes
void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject)
{
// All boxes start off open. They will not apply any margins/border/padding on
// any side.
bool includeLeftEdge = false;
bool includeRightEdge = false;
RenderFlow* flow = static_cast<RenderFlow*>(object());
if (!flow->firstChild())
includeLeftEdge = includeRightEdge = true; // Empty inlines never split across lines.
else if (parent()) { // The root inline box never has borders/margins/padding.
bool ltr = flow->style()->direction() == LTR;
// Check to see if all initial lines are unconstructed. If so, then
// we know the inline began on this line.
if (!flow->firstLineBox()->isConstructed()) {
if (ltr && flow->firstLineBox() == this)
includeLeftEdge = true;
else if (!ltr && flow->lastLineBox() == this)
includeRightEdge = true;
}
// In order to determine if the inline ends on this line, we check three things:
// (1) If we are the last line and we don't have a continuation(), then we can
// close up.
// (2) If the last line box for the flow has an object following it on the line (ltr,
// reverse for rtl), then the inline has closed.
// (3) The line may end on the inline. If we are the last child (climbing up
// the end object's chain), then we just closed as well.
if (!flow->lastLineBox()->isConstructed()) {
if (ltr) {
if (!nextLineBox() &&
((lastLine && !object()->continuation()) || nextOnLineExists()
|| onEndChain(endObject)))
includeRightEdge = true;
}
else {
if ((!prevLineBox() || !prevLineBox()->isConstructed()) &&
((lastLine && !object()->continuation()) ||
prevOnLineExists() || onEndChain(endObject)))
includeLeftEdge = true;
}
}
}
setEdges(includeLeftEdge, includeRightEdge);
// Recur into our children.
for (InlineBox* currChild = firstChild(); currChild; currChild = currChild->nextOnLine()) {
if (currChild->isInlineFlowBox()) {
InlineFlowBox* currFlow = static_cast<InlineFlowBox*>(currChild);
currFlow->determineSpacingForFlowBoxes(lastLine, endObject);
}
}
}
示例7: getFlowSpacingWidth
int InlineFlowBox::getFlowSpacingWidth() const
{
int totWidth = marginBorderPaddingLeft() + marginBorderPaddingRight();
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->isInlineFlowBox())
totWidth += static_cast<InlineFlowBox*>(curr)->getFlowSpacingWidth();
}
return totWidth;
}
示例8: invalidateLineBoxPaintOffsetsInternal
static void invalidateLineBoxPaintOffsetsInternal(PaintController& paintController, InlineFlowBox* inlineBox)
{
paintController.invalidatePaintOffset(*inlineBox);
for (InlineBox* child = inlineBox->firstChild(); child; child = child->nextOnLine()) {
if (!child->lineLayoutItem().isText() && child->boxModelObject().hasSelfPaintingLayer())
continue;
if (child->isInlineFlowBox())
invalidateLineBoxPaintOffsetsInternal(paintController, toInlineFlowBox(child));
else
paintController.invalidatePaintOffset(*child);
}
}
示例9: computeLogicalBoxHeights
void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
int& maxAscent, int& maxDescent, bool strictMode)
{
if (isRootInlineBox()) {
// Examine our root box.
setHeight(object()->lineHeight(m_firstLine));
bool isTableCell = object()->isTableCell();
if (isTableCell) {
RenderTableCell* tableCell = static_cast<RenderTableCell*>(object());
setBaseline(tableCell->RenderBlock::baselinePosition(m_firstLine));
}
else
setBaseline(object()->baselinePosition(m_firstLine));
if (hasTextChildren() || strictMode) {
int ascent = baseline();
int descent = height() - ascent;
if (maxAscent < ascent)
maxAscent = ascent;
if (maxDescent < descent)
maxDescent = descent;
}
}
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->object()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
curr->setHeight(curr->object()->lineHeight(m_firstLine));
curr->setBaseline(curr->object()->baselinePosition(m_firstLine));
curr->setYPos(curr->object()->verticalPositionHint(m_firstLine));
if (curr->yPos() == PositionTop) {
if (maxPositionTop < curr->height())
maxPositionTop = curr->height();
}
else if (curr->yPos() == PositionBottom) {
if (maxPositionBottom < curr->height())
maxPositionBottom = curr->height();
}
else if (curr->hasTextChildren() || strictMode) {
int ascent = curr->baseline() - curr->yPos();
int descent = curr->height() - ascent;
if (maxAscent < ascent)
maxAscent = ascent;
if (maxDescent < descent)
maxDescent = descent;
}
if (curr->isInlineFlowBox())
static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode);
}
}
示例10: collectTextBoxesInFlowBox
void SVGTextQuery::collectTextBoxesInFlowBox(InlineFlowBox* flowBox)
{
if (!flowBox)
return;
for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) {
if (child->isInlineFlowBox()) {
// Skip generated content.
if (!child->renderer()->node())
continue;
collectTextBoxesInFlowBox(toInlineFlowBox(child));
continue;
}
if (child->isSVGInlineTextBox())
m_textBoxes.append(toSVGInlineTextBox(child));
}
}
示例11: collectTextBoxesInFlowBox
static void collectTextBoxesInFlowBox(InlineFlowBox* flowBox, Vector<SVGInlineTextBox*>& textBoxes)
{
if (!flowBox)
return;
for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) {
if (child->isInlineFlowBox()) {
// Skip generated content.
if (!child->layoutObject().node())
continue;
collectTextBoxesInFlowBox(toInlineFlowBox(child), textBoxes);
continue;
}
if (child->isSVGInlineTextBox())
textBoxes.append(toSVGInlineTextBox(child));
}
}
示例12: shrinkBoxesWithNoTextChildren
void InlineFlowBox::shrinkBoxesWithNoTextChildren(int topPos, int bottomPos)
{
// First shrink our kids.
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->object()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
if (curr->isInlineFlowBox())
static_cast<InlineFlowBox*>(curr)->shrinkBoxesWithNoTextChildren(topPos, bottomPos);
}
// See if we have text children. If not, then we need to shrink ourselves to fit on the line.
if (!hasTextDescendant()) {
if (yPos() < topPos)
setYPos(topPos);
if (yPos() + height() > bottomPos)
setHeight(bottomPos - yPos());
if (baseline() > height())
setBaseline(height());
}
}
示例13: recursiveBuildTextChunks
//.........这里部分代码省略.........
fprintf(stderr, " | -> Record last chunk of inline text box!\n");
#endif
startTextChunk();
SVGInlineBoxCharacterRange& range = m_chunk.boxes.last();
m_assignChunkProperties = false;
m_chunk.isVerticalText = isVerticalWritingMode(text->style()->svgStyle());
m_chunk.isTextPath = m_handlingTextPath;
m_chunk.anchor = text->style()->svgStyle()->textAnchor();
m_chunk.textLength = textContent->textLength().value(textContent);
m_chunk.lengthAdjust = (ELengthAdjust) textContent->lengthAdjust();
range.box = curr;
range.startOffset = i;
ASSERT(!range.isOpen());
ASSERT(!range.isClosed());
}
}
// This should only hold true for the first character of the first chunk
if (isFirstCharacter)
isFirstCharacter = false;
++m_charsIt;
}
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Finished inline text box!\n");
#endif
SVGInlineBoxCharacterRange& range = m_chunk.boxes.last();
if (!range.isOpen() && !range.isClosed()) {
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Last range not closed - closing with endOffset: %i\n", length);
#endif
// Current text chunk is not yet closed. Finish the current range, but don't start a new chunk.
range.endOffset = length;
if (m_charsIt != m_charsEnd) {
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Not at last character yet!\n");
#endif
// If we're not at the end of the last box to be processed, and if the next
// character starts a new chunk, then close the current chunk and start a new one.
if (m_charsIt->newTextChunk) {
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Next character starts new chunk! Closing current chunk, and starting a new one...\n");
#endif
closeTextChunk();
startTextChunk();
} else {
// Just start a new character range
m_chunk.boxes.append(SVGInlineBoxCharacterRange());
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Next character does NOT start a new chunk! Starting new character range...\n");
#endif
}
} else {
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Closing final chunk! Finished processing!\n");
#endif
// Close final chunk, once we're at the end of the last box
closeTextChunk();
}
}
} else {
ASSERT(curr->isInlineFlowBox());
InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(curr);
// Skip generated content.
if (!flowBox->renderer()->node())
continue;
bool isTextPath = flowBox->renderer()->node()->hasTagName(SVGNames::textPathTag);
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " -> Handle inline flow box (%p), isTextPath=%i\n", flowBox, (int) isTextPath);
#endif
if (isTextPath)
m_handlingTextPath = true;
recursiveBuildTextChunks(flowBox);
if (isTextPath)
m_handlingTextPath = false;
}
}
#if DEBUG_CHUNK_BUILDING > 1
fprintf(stderr, " <- buildTextChunks(start=%p)\n", start);
#endif
}
示例14: placeBoxesVertically
void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
int& topPosition, int& bottomPosition)
{
if (isRootInlineBox()) {
setYPos(y + maxAscent - baseline());// Place our root box.
// CSS2: 10.8.1 - line-height on the block level element specifies the *minimum*
// height of the generated line box
if (hasTextChildren() && maxHeight < object()->lineHeight(m_firstLine))
maxHeight = object()->lineHeight(m_firstLine);
}
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->object()->isPositioned())
continue; // Positioned placeholders don't affect calculations.
// Adjust boxes to use their real box y/height and not the logical height (as dictated by
// line-height).
if (curr->isInlineFlowBox())
static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode,
topPosition, bottomPosition);
bool childAffectsTopBottomPos = true;
if (curr->yPos() == PositionTop)
curr->setYPos(y);
else if (curr->yPos() == PositionBottom)
curr->setYPos(y + maxHeight - curr->height());
else {
if (!strictMode && !curr->hasTextDescendant())
childAffectsTopBottomPos = false;
curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline());
}
int newY = curr->yPos();
int newHeight = curr->height();
int newBaseline = curr->baseline();
int overflowTop = 0;
int overflowBottom = 0;
if (curr->isInlineTextBox() || curr->isInlineFlowBox()) {
const QFontMetrics &fm = curr->object()->fontMetrics( m_firstLine );
#ifdef APPLE_CHANGES
newBaseline = fm.ascent();
newY += curr->baseline() - newBaseline;
newHeight = newBaseline+fm.descent();
#else
// only adjust if the leading delta is superior to the font's natural leading
if ( kAbs(fm.ascent() - curr->baseline()) > fm.leading()/2 ) {
int ascent = fm.ascent()+fm.leading()/2;
newBaseline = ascent;
newY += curr->baseline() - newBaseline;
newHeight = fm.lineSpacing();
}
#endif
for (ShadowData* shadow = curr->object()->style()->textShadow(); shadow; shadow = shadow->next) {
overflowTop = kMin(overflowTop, shadow->y - shadow->blur);
overflowBottom = kMax(overflowBottom, shadow->y + shadow->blur);
}
if (curr->isInlineFlowBox()) {
newHeight += curr->object()->borderTop() + curr->object()->paddingTop() +
curr->object()->borderBottom() + curr->object()->paddingBottom();
newY -= curr->object()->borderTop() + curr->object()->paddingTop();
newBaseline += curr->object()->borderTop() + curr->object()->paddingTop();
}
} else {
newY += curr->object()->marginTop();
newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom());
overflowTop = curr->object()->overflowTop();
overflowBottom = curr->object()->overflowHeight() - newHeight;
}
curr->setYPos(newY);
curr->setHeight(newHeight);
curr->setBaseline(newBaseline);
if (childAffectsTopBottomPos) {
topPosition = kMin(topPosition, newY + overflowTop);
bottomPosition = kMax(bottomPosition, newY + newHeight + overflowBottom);
}
}
if (isRootInlineBox()) {
const QFontMetrics &fm = object()->fontMetrics( m_firstLine );
#ifdef APPLE_CHANGES
setHeight(fm.ascent()+fm.descent());
setYPos(yPos() + baseline() - fm.ascent());
setBaseline(fm.ascent());
#else
if ( kAbs(fm.ascent() - baseline()) > fm.leading()/2 ) {
int ascent = fm.ascent()+fm.leading()/2;
setHeight(fm.lineSpacing());
setYPos(yPos() + baseline() - ascent);
setBaseline(ascent);
}
#endif
if (hasTextDescendant() || strictMode) {
if (yPos() < topPosition)
topPosition = yPos();
if (yPos() + height() > bottomPosition)
bottomPosition = yPos() + height();
}
}
}