本文整理汇总了C++中InlineFlowBox::determineSpacingForFlowBoxes方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::determineSpacingForFlowBoxes方法的具体用法?C++ InlineFlowBox::determineSpacingForFlowBoxes怎么用?C++ InlineFlowBox::determineSpacingForFlowBoxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineFlowBox
的用法示例。
在下文中一共展示了InlineFlowBox::determineSpacingForFlowBoxes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}