本文整理汇总了C++中InlineFlowBox::overrideOverflowFromLogicalRects方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::overrideOverflowFromLogicalRects方法的具体用法?C++ InlineFlowBox::overrideOverflowFromLogicalRects怎么用?C++ InlineFlowBox::overrideOverflowFromLogicalRects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineFlowBox
的用法示例。
在下文中一共展示了InlineFlowBox::overrideOverflowFromLogicalRects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: positionListMarker
void LayoutListItem::positionListMarker()
{
if (m_marker && m_marker->parent() && m_marker->parent()->isBox() && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {
LayoutUnit markerOldLogicalLeft = m_marker->logicalLeft();
LayoutUnit blockOffset = 0;
LayoutUnit lineOffset = 0;
for (LayoutBox* o = m_marker->parentBox(); o != this; o = o->parentBox()) {
blockOffset += o->logicalTop();
lineOffset += o->logicalLeft();
}
bool adjustOverflow = false;
LayoutUnit markerLogicalLeft;
RootInlineBox& root = m_marker->inlineBoxWrapper()->root();
bool hitSelfPaintingLayer = false;
LayoutUnit lineTop = root.lineTop();
LayoutUnit lineBottom = root.lineBottom();
// TODO(jchaffraix): Propagating the overflow to the line boxes seems
// pretty wrong (https://crbug.com/554160).
// FIXME: Need to account for relative positioning in the layout overflow.
if (style()->isLeftToRightDirection()) {
LayoutUnit leftLineOffset = logicalLeftOffsetForLine(blockOffset, logicalLeftOffsetForLine(blockOffset, DoNotIndentText), DoNotIndentText);
markerLogicalLeft = leftLineOffset - lineOffset - paddingStart() - borderStart() + m_marker->marginStart();
m_marker->inlineBoxWrapper()->moveInInlineDirection((markerLogicalLeft - markerOldLogicalLeft).toFloat());
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom);
LayoutRect newLogicalLayoutOverflowRect = box->logicalLayoutOverflowRect(lineTop, lineBottom);
if (markerLogicalLeft < newLogicalVisualOverflowRect.x() && !hitSelfPaintingLayer) {
newLogicalVisualOverflowRect.setWidth(newLogicalVisualOverflowRect.maxX() - markerLogicalLeft);
newLogicalVisualOverflowRect.setX(markerLogicalLeft);
if (box == root)
adjustOverflow = true;
}
if (markerLogicalLeft < newLogicalLayoutOverflowRect.x()) {
newLogicalLayoutOverflowRect.setWidth(newLogicalLayoutOverflowRect.maxX() - markerLogicalLeft);
newLogicalLayoutOverflowRect.setX(markerLogicalLeft);
if (box == root)
adjustOverflow = true;
}
box->overrideOverflowFromLogicalRects(newLogicalLayoutOverflowRect, newLogicalVisualOverflowRect, lineTop, lineBottom);
if (box->boxModelObject().hasSelfPaintingLayer())
hitSelfPaintingLayer = true;
}
} else {
LayoutUnit rightLineOffset = logicalRightOffsetForLine(blockOffset, logicalRightOffsetForLine(blockOffset, DoNotIndentText), DoNotIndentText);
markerLogicalLeft = rightLineOffset - lineOffset + paddingStart() + borderStart() + m_marker->marginEnd();
m_marker->inlineBoxWrapper()->moveInInlineDirection((markerLogicalLeft - markerOldLogicalLeft).toFloat());
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom);
LayoutRect newLogicalLayoutOverflowRect = box->logicalLayoutOverflowRect(lineTop, lineBottom);
if (markerLogicalLeft + m_marker->logicalWidth() > newLogicalVisualOverflowRect.maxX() && !hitSelfPaintingLayer) {
newLogicalVisualOverflowRect.setWidth(markerLogicalLeft + m_marker->logicalWidth() - newLogicalVisualOverflowRect.x());
if (box == root)
adjustOverflow = true;
}
if (markerLogicalLeft + m_marker->logicalWidth() > newLogicalLayoutOverflowRect.maxX()) {
newLogicalLayoutOverflowRect.setWidth(markerLogicalLeft + m_marker->logicalWidth() - newLogicalLayoutOverflowRect.x());
if (box == root)
adjustOverflow = true;
}
box->overrideOverflowFromLogicalRects(newLogicalLayoutOverflowRect, newLogicalVisualOverflowRect, lineTop, lineBottom);
if (box->boxModelObject().hasSelfPaintingLayer())
hitSelfPaintingLayer = true;
}
}
if (adjustOverflow) {
LayoutRect markerRect(LayoutPoint(markerLogicalLeft + lineOffset, blockOffset), m_marker->size());
if (!style()->isHorizontalWritingMode())
markerRect = markerRect.transposedRect();
LayoutBox* o = m_marker;
bool propagateVisualOverflow = true;
bool propagateLayoutOverflow = true;
do {
o = o->parentBox();
if (o->isLayoutBlock()) {
if (propagateVisualOverflow)
toLayoutBlock(o)->addContentsVisualOverflow(markerRect);
if (propagateLayoutOverflow)
toLayoutBlock(o)->addLayoutOverflow(markerRect);
}
if (o->hasOverflowClip()) {
propagateLayoutOverflow = false;
propagateVisualOverflow = false;
}
if (o->hasSelfPaintingLayer())
propagateVisualOverflow = false;
markerRect.moveBy(-o->location());
} while (o != this && propagateVisualOverflow && propagateLayoutOverflow);
}
}
}