本文整理汇总了C++中InlineFlowBox::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::parent方法的具体用法?C++ InlineFlowBox::parent怎么用?C++ InlineFlowBox::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineFlowBox
的用法示例。
在下文中一共展示了InlineFlowBox::parent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: positionListMarker
void RenderListItem::positionListMarker()
{
if (m_marker && m_marker->parent()->isBox() && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {
LayoutUnit markerOldLogicalLeft = m_marker->logicalLeft();
LayoutUnit blockOffset = 0;
LayoutUnit lineOffset = 0;
for (RenderBox* 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();
// FIXME: Need to account for relative positioning in the layout overflow.
if (style()->isLeftToRightDirection()) {
LayoutUnit leftLineOffset = logicalLeftOffsetForLine(blockOffset, logicalLeftOffsetForLine(blockOffset, false), false);
markerLogicalLeft = leftLineOffset - lineOffset - paddingStart() - borderStart() + m_marker->marginStart();
m_marker->inlineBoxWrapper()->adjustLineDirectionPosition((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->setOverflowFromLogicalRects(newLogicalLayoutOverflowRect, newLogicalVisualOverflowRect, lineTop, lineBottom);
if (box->boxModelObject()->hasSelfPaintingLayer())
hitSelfPaintingLayer = true;
}
} else {
LayoutUnit rightLineOffset = logicalRightOffsetForLine(blockOffset, logicalRightOffsetForLine(blockOffset, false), false);
markerLogicalLeft = rightLineOffset - lineOffset + paddingStart() + borderStart() + m_marker->marginEnd();
m_marker->inlineBoxWrapper()->adjustLineDirectionPosition((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->setOverflowFromLogicalRects(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();
RenderBox* o = m_marker;
bool propagateVisualOverflow = true;
bool propagateLayoutOverflow = true;
do {
o = o->parentBox();
if (o->isRenderBlock()) {
if (propagateVisualOverflow)
toRenderBlock(o)->addContentsVisualOverflow(markerRect);
if (propagateLayoutOverflow)
toRenderBlock(o)->addLayoutOverflow(markerRect);
}
if (o->hasOverflowClip()) {
propagateLayoutOverflow = false;
propagateVisualOverflow = false;
}
if (o->hasSelfPaintingLayer())
propagateVisualOverflow = false;
markerRect.moveBy(-o->location());
} while (o != this && propagateVisualOverflow && propagateLayoutOverflow);
}
}
}
示例2: dirtyLineBoxes
void InlineBox::dirtyLineBoxes()
{
markDirty();
for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr->parent())
curr->markDirty();
}
示例3: positionListMarker
void RenderListItem::positionListMarker()
{
if (m_marker && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {
int markerOldX = m_marker->x();
int yOffset = 0;
int xOffset = 0;
for (RenderBox* o = m_marker->parentBox(); o != this; o = o->parentBox()) {
yOffset += o->y();
xOffset += o->x();
}
bool adjustOverflow = false;
int markerXPos;
RootInlineBox* root = m_marker->inlineBoxWrapper()->root();
// FIXME: Inline flows in the line box hierarchy that have self-painting layers should act as cutoff points
// and really shouldn't keep propagating overflow up. This won't really break anything other than repainting
// not being as tight as it could be though.
if (style()->direction() == LTR) {
int leftLineOffset = leftRelOffset(yOffset, leftOffset(yOffset, false), false);
markerXPos = leftLineOffset - xOffset - paddingLeft() - borderLeft() + m_marker->marginLeft();
m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0);
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
if (markerXPos < box->leftLayoutOverflow()) {
box->setHorizontalOverflowPositions(markerXPos, box->rightLayoutOverflow(), box->leftVisualOverflow(), box->rightVisualOverflow());
if (box == root)
adjustOverflow = true;
}
}
} else {
int rightLineOffset = rightRelOffset(yOffset, rightOffset(yOffset, false), false);
markerXPos = rightLineOffset - xOffset + paddingRight() + borderRight() + m_marker->marginLeft();
m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0);
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
if (markerXPos + m_marker->width() > box->rightLayoutOverflow()) {
box->setHorizontalOverflowPositions(box->leftLayoutOverflow(), markerXPos + m_marker->width(), box->leftVisualOverflow(), box->rightVisualOverflow());
if (box == root)
adjustOverflow = true;
}
}
}
if (adjustOverflow) {
IntRect markerRect(markerXPos + xOffset, yOffset, m_marker->width(), m_marker->height());
RenderBox* o = m_marker;
do {
o = o->parentBox();
if (o->isRenderBlock())
toRenderBlock(o)->addLayoutOverflow(markerRect);
markerRect.move(-o->x(), -o->y());
} while (o != this && !o->hasSelfPaintingLayer());
}
}
}
示例4: readyWRATHWidgets
void RenderLineBoxList::readyWRATHWidgets(PaintedWidgetsOfWRATHHandle &handle,
RenderBoxModelObject *renderer,
PaintInfoOfWRATH &paintInfo, int tx, int ty)
{
RenderLineBoxList_WRATHWidgets *d;
d=RenderLineBoxList_WRATHWidgets::object(renderer, handle);
ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);
/*
this just.. sucks. WebKit builds a list of
RenderInline objects that it will draw outlines.
It is not clear if and how that list changes,
so we punt and make all them handle non-visible
and only those that are found in the list
are then made visible.
*/
d->m_handles.hideEachObject();
d->m_outlineHandles.hideEachObject();
// Only paint during the foreground/selection phases.
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline
&& paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines && paintInfo.phase != PaintPhaseTextClip
&& paintInfo.phase != PaintPhaseMask)
return;
ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could paint like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
return;
RenderView* v = renderer->view();
bool usePrintRect = !v->printRect().isEmpty();
int outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
if (!anyLineIntersectsRect(renderer, paintInfo.rect, tx, ty, usePrintRect, outlineSize))
return;
PaintInfoOfWRATH info(paintInfo);
ListHashSet<RenderInline*> outlineObjects;
info.outlineObjects = &outlineObjects;
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
if (usePrintRect) {
RootInlineBox* root = curr->root();
int topForPaginationCheck = curr->logicalTopVisualOverflow(root->lineTop());
int bottomForPaginationCheck = curr->logicalLeftVisualOverflow();
if (!curr->parent()) {
// We're a root box. Use lineTop and lineBottom as well here.
topForPaginationCheck = min(topForPaginationCheck, root->lineTop());
bottomForPaginationCheck = max(bottomForPaginationCheck, root->lineBottom());
}
if (bottomForPaginationCheck - topForPaginationCheck <= v->printRect().height()) {
if (ty + bottomForPaginationCheck > v->printRect().maxY()) {
if (RootInlineBox* nextRootBox = curr->root()->nextRootBox())
bottomForPaginationCheck = min(bottomForPaginationCheck, min(nextRootBox->logicalTopVisualOverflow(), nextRootBox->lineTop()));
}
if (ty + bottomForPaginationCheck > v->printRect().maxY()) {
if (ty + topForPaginationCheck < v->truncatedAt())
v->setBestTruncatedAt(ty + topForPaginationCheck, renderer);
// If we were able to truncate, don't paint.
if (ty + topForPaginationCheck >= v->truncatedAt())
break;
}
}
}
if (lineIntersectsDirtyRect(renderer, curr, info, tx, ty)) {
RootInlineBox* root = curr->root();
PaintedWidgetsOfWRATHHandleT<InlineBox> &currHandle(d->m_handles.getHandle(curr));
currHandle.visible(true);
curr->readyWRATHWidgets(currHandle, info, tx, ty, root->lineTop(), root->lineBottom());
}
}
if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline || info.phase == PaintPhaseChildOutlines) {
ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end();
for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
RenderInline* flow = *it;
PaintedWidgetsOfWRATHHandle &handle(d->m_outlineHandles.getHandle(flow));
handle.visible(true);
flow->readyWRATHWidgetOutline(handle, info.wrath_context, tx, ty);
}
info.outlineObjects->clear();
}
d->m_handles.removeNonVisibleHandles();
d->m_outlineHandles.removeNonVisibleHandles();
}
示例5: paint
void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
{
ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could paint like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
return;
// FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit
// NSViews. Do not add any more code for this.
RenderView& v = renderer->view();
bool usePrintRect = !v.printRect().isEmpty();
if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, usePrintRect))
return;
PaintInfo info(paintInfo);
ListHashSet<RenderInline*> outlineObjects;
info.outlineObjects = &outlineObjects;
// See if our root lines intersect with the dirty rect. If so, then we paint
// them. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
if (usePrintRect) {
// FIXME: This is the deprecated pagination model that is still needed
// for embedded views inside AppKit. AppKit is incapable of paginating vertical
// text pages, so we don't have to deal with vertical lines at all here.
const RootInlineBox& rootBox = curr->root();
LayoutUnit topForPaginationCheck = curr->logicalTopVisualOverflow(rootBox.lineTop());
LayoutUnit bottomForPaginationCheck = curr->logicalLeftVisualOverflow();
if (!curr->parent()) {
// We're a root box. Use lineTop and lineBottom as well here.
topForPaginationCheck = std::min(topForPaginationCheck, rootBox.lineTop());
bottomForPaginationCheck = std::max(bottomForPaginationCheck, rootBox.lineBottom());
}
if (bottomForPaginationCheck - topForPaginationCheck <= v.printRect().height()) {
if (paintOffset.y() + bottomForPaginationCheck > v.printRect().maxY()) {
if (RootInlineBox* nextRootBox = rootBox.nextRootBox())
bottomForPaginationCheck = std::min(bottomForPaginationCheck, std::min<LayoutUnit>(nextRootBox->logicalTopVisualOverflow(), nextRootBox->lineTop()));
}
if (paintOffset.y() + bottomForPaginationCheck > v.printRect().maxY()) {
if (paintOffset.y() + topForPaginationCheck < v.truncatedAt())
v.setBestTruncatedAt(paintOffset.y() + topForPaginationCheck, renderer);
// If we were able to truncate, don't paint.
if (paintOffset.y() + topForPaginationCheck >= v.truncatedAt())
break;
}
}
}
if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) {
const RootInlineBox& rootBox = curr->root();
curr->paint(info, paintOffset, rootBox.lineTop(), rootBox.lineBottom());
}
}
if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline || info.phase == PaintPhaseChildOutlines) {
ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end();
for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
RenderInline* flow = *it;
flow->paintOutline(info, paintOffset);
}
info.outlineObjects->clear();
}
}
示例6: positionListMarker
void RenderListItem::positionListMarker()
{
if (!m_marker || !m_marker->parent() || !m_marker->parent()->isBox())
return;
if (m_marker->isInside() || !m_marker->inlineBoxWrapper())
return;
LayoutUnit markerOldLogicalLeft = m_marker->logicalLeft();
LayoutUnit blockOffset = 0;
LayoutUnit lineOffset = 0;
for (RenderBox* o = m_marker->parentBox(); o != this; o = o->parentBox()) {
blockOffset += o->logicalTop();
lineOffset += o->logicalLeft();
}
bool adjustOverflow = false;
LayoutUnit markerLogicalLeft;
bool hitSelfPaintingLayer = false;
const RootInlineBox& rootBox = m_marker->inlineBoxWrapper()->root();
LayoutUnit lineTop = rootBox.lineTop();
LayoutUnit lineBottom = rootBox.lineBottom();
// FIXME: Need to account for relative positioning in the layout overflow.
if (style().isLeftToRightDirection()) {
markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset - paddingStart() - borderStart() + m_marker->marginStart();
m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft);
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 == &rootBox)
adjustOverflow = true;
}
if (markerLogicalLeft < newLogicalLayoutOverflowRect.x()) {
newLogicalLayoutOverflowRect.setWidth(newLogicalLayoutOverflowRect.maxX() - markerLogicalLeft);
newLogicalLayoutOverflowRect.setX(markerLogicalLeft);
if (box == &rootBox)
adjustOverflow = true;
}
box->setOverflowFromLogicalRects(newLogicalLayoutOverflowRect, newLogicalVisualOverflowRect, lineTop, lineBottom);
if (box->renderer().hasSelfPaintingLayer())
hitSelfPaintingLayer = true;
}
} else {
markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset + paddingStart() + borderStart() + m_marker->marginEnd();
m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft);
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 == &rootBox)
adjustOverflow = true;
}
if (markerLogicalLeft + m_marker->logicalWidth() > newLogicalLayoutOverflowRect.maxX()) {
newLogicalLayoutOverflowRect.setWidth(markerLogicalLeft + m_marker->logicalWidth() - newLogicalLayoutOverflowRect.x());
if (box == &rootBox)
adjustOverflow = true;
}
box->setOverflowFromLogicalRects(newLogicalLayoutOverflowRect, newLogicalVisualOverflowRect, lineTop, lineBottom);
if (box->renderer().hasSelfPaintingLayer())
hitSelfPaintingLayer = true;
}
}
if (adjustOverflow) {
LayoutRect markerRect(markerLogicalLeft + lineOffset, blockOffset, m_marker->width(), m_marker->height());
if (!style().isHorizontalWritingMode())
markerRect = markerRect.transposedRect();
RenderBox* o = m_marker;
bool propagateVisualOverflow = true;
bool propagateLayoutOverflow = true;
do {
o = o->parentBox();
if (o->hasOverflowClip())
propagateVisualOverflow = false;
if (is<RenderBlock>(*o)) {
if (propagateVisualOverflow)
downcast<RenderBlock>(*o).addVisualOverflow(markerRect);
if (propagateLayoutOverflow)
downcast<RenderBlock>(*o).addLayoutOverflow(markerRect);
}
if (o->hasOverflowClip())
propagateLayoutOverflow = false;
if (o->hasSelfPaintingLayer())
propagateVisualOverflow = false;
markerRect.moveBy(-o->location());
} while (o != this && propagateVisualOverflow && propagateLayoutOverflow);
}
}