Lines Matching full:child
238 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
239 if (child->isAnonymousBlock()) {
243 child->setStyle(newStyle.release());
285 // Insert the child into the anonymous block box instead of here.
309 // So, if our children are currently inline and a block child has to be inserted, we move all our
322 // If we're inserting an inline child but all of our children are blocks, then we have to make sure
405 void RenderBlock::moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* child)
407 ASSERT(this == child->parent());
408 child, false), false);
411 void RenderBlock::moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* beforeChild, RenderObject* child)
413 ASSERT(this == child->parent());
415 toChildList->insertChildNode(to, children()->removeChildNode(this, child, false), beforeChild, false);
422 RenderObject* child = nextChild;
423 nextChild = child->nextSibling();
424 toChildList->appendChildNode(to, children()->removeChildNode(this, child, false), false);
437 RenderObject* child = nextChild;
438 nextChild = child->nextSibling();
439 toChildList->insertChildNode(to, children()->removeChildNode(this, child, false), beforeChild, false);
448 // the new block child that is causing us to have to wrap all the inlines. This
450 // |insertionPoint|, because the new child is going to be inserted in between the inlines,
457 RenderObject *child = firstChild();
458 if (!child)
463 while (child) {
465 getInlineRun(child, insertionPoint, inlineRunStart, inlineRunEnd);
470 child = inlineRunEnd->nextSibling();
492 void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child)
494 ASSERT(child->isAnonymousBlock());
495 ASSERT(!child->childrenInline());
497 if (child->inlineContinuation())
500 RenderObject* firstAnChild = child->m_children.firstChild();
501 RenderObject* lastAnChild = child->m_children.lastChild();
508 firstAnChild->setPreviousSibling(child->previousSibling());
509 lastAnChild->setNextSibling(child->nextSibling());
510 if (child->previousSibling())
511 child->previousSibling()->setNextSibling(firstAnChild);
512 if (child->nextSibling())
513 child->nextSibling()->setPreviousSibling(lastAnChild);
515 if (child->previousSibling())
516 child->previousSibling()->setNextSibling(child->nextSibling());
517 if (child->nextSibling())
518 child->nextSibling()->setPreviousSibling(child->previousSibling());
520 if (child == m_children.firstChild())
522 if (child == m_children.lastChild())
524 child->setParent(0);
525 child->setPreviousSibling(0);
526 child->setNextSibling(0);
528 child->children()->setFirstChild(0);
529 child->m_next = 0;
531 child->destroy();
536 // If this child is a block, and if our previous and next siblings are
559 RenderObject* child = prev ? prev : next;
560 if (canDeleteAnonymousBlocks && child && !child->previousSibling() && !child->nextSibling() && !isFlexibleBox()) {
565 RenderBlock* anonBlock = toRenderBlock(children()->removeChildNode(this, child, false));
573 // If this was our last child be sure to clear out our line boxes.
611 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
612 if (child->isFloatingOrPositioned())
614 if (!child->isSelfCollapsingBlock())
773 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
774 if (child->isBlockFlow() && !child->isFloatingOrPositioned()) {
775 RenderBlock* block = toRenderBlock(child);
795 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
852 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
853 if (!child->isFloatingOrPositioned())
854 addOverflowFromChild(child);
877 void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
879 if (child->style()->hasStaticX()) {
881 child->layer()->setStaticX(borderLeft() + paddingLeft());
883 child->layer()->setStaticX(borderRight() + paddingRight());
886 if (child->style()->hasStaticY()) {
889 child->calcVerticalMargins();
890 int marginTop = child->marginTop();
902 RenderLayer* childLayer = child->layer();
904 child->layer()->setStaticY(y);
905 child->setChildNeedsLayout(true, false);
931 bool RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginInfo)
934 return handlePositionedChild(child, marginInfo)
935 || handleFloatingChild(child, marginInfo)
936 || handleRunInChild(child);
940 bool RenderBlock::handlePositionedChild(RenderBox* child, const MarginInfo& marginInfo)
942 if (child->isPositioned()) {
943 child->containingBlock()->insertPositionedObject(child);
944 adjustPositionedBlock(child, marginInfo);
950 bool RenderBlock::handleFloatingChild(RenderBox* child, const MarginInfo& marginInfo)
952 if (child->isFloating()) {
953 insertFloatingObject(child);
960 bool RenderBlock::handleRunInChild(RenderBox* child)
965 if (!child->isRunIn() || !child->childrenInline())
968 if (!child->isRenderBlock())
972 RenderBlock* blockRunIn = toRenderBlock(child);
982 // Remove the old child.
990 bool runInIsGenerated = child->style()->styleType() == BEFORE || child->style()->styleType() == AFTER;
992 // Move the nodes from the old child to the new child, but skip any :before/:after content. It has already
1001 // Now insert the new child under |currBlock|.
1017 int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
1020 int posTop = child->maxTopMargin(true);
1021 int negTop = child->maxTopMargin(false);
1025 if (child->isSelfCollapsingBlock()) {
1026 posTop = max(posTop, child->maxBottomMargin(true));
1027 negTop = max(negTop, child->maxBottomMargin(false));
1030 // See if the top margin is quirky. We only care if this child has
1032 bool topQuirk = child->isTopMarginQuirk() || style()->marginTopCollapse() == MDISCARD;
1035 // This child is collapsing with the top of the
1051 // We have no top margin and our top child has a quirky margin.
1063 if (child->isSelfCollapsingBlock()) {
1064 // This child has no height. We need to compute our
1065 // position before we collapse the child's margins together,
1067 int collapsedTopPos = max(marginInfo.posMargin(), child->maxTopMargin(true));
1068 int collapsedTopNeg = max(marginInfo.negMargin(), child->maxTopMargin(false));
1071 // Now collapse the child's margins together, which means examining our
1073 marginInfo.setPosMarginIfLarger(child->maxBottomMargin(true));
1074 marginInfo.setNegMarginIfLarger(child->maxBottomMargin(false));
1084 if (child->style()->marginTopCollapse() == MSEPARATE) {
1085 setHeight(height() + marginInfo.margin() + child->marginTop());
1097 marginInfo.setPosMargin(child->maxBottomMargin(true));
1098 marginInfo.setNegMargin(child->maxBottomMargin(false));
1101 marginInfo.setBottomQuirk(child->isBottomMarginQuirk() || style()->marginBottomCollapse() == MDISCARD);
1107 int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin, int yPos)
1109 int heightIncrease = getClearDelta(child, yPos);
1113 if (child->isSelfCollapsingBlock()) {
1122 for (RenderBox* curr = child->nextSiblingBox(); curr && atBottomOfBlock; curr = curr->nextSiblingBox()) {
1127 marginInfo.setPosMargin(child->maxBottomMargin(true));
1128 marginInfo.setNegMargin(child->maxBottomMargin(false));
1130 marginInfo.setPosMargin(max(child->maxTopMargin(true), child->maxBottomMargin(true)));
1131 marginInfo.setNegMargin(max(child->maxTopMargin(false), child->maxBottomMargin(false)));
1136 setHeight(child->y() - max(0, marginInfo.margin()));
1154 int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& marginInfo)
1160 int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginTop();
1163 yPosEstimate += getClearDelta(child, yPosEstimate);
1167 void RenderBlock::determineHorizontalPosition(RenderBox* child)
1173 int chPos = xPos + child->marginLeft();
1177 if (child->avoidsFloats()) {
1179 if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginLeft().type() != Auto) {
1180 if (child->marginLeft() < 0)
1181 leftOff += child->marginLeft();
1182 chPos = max(chPos, leftOff); // Let the float sit in the child's margin if it can fit.
1190 child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false));
1191 chPos = leftOff + child->marginLeft();
1194 view()->addLayoutDelta(IntSize(child->x() - chPos, 0));
1195 child->setLocation(chPos, child->y());
1198 int chPos = xPos - (child->width() + child->marginRight());
1199 if (child->avoidsFloats()) {
1201 if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginRight().type() != Auto) {
1202 if (child->marginRight() < 0)
1203 rightOff -= child->marginRight();
1204 chPos = min(chPos, rightOff - child->width()); // Let the float sit in the child's margin if it can fit.
1211 child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false));
1212 chPos = rightOff - child->marginRight() - child->width();
1215 view()->addLayoutDelta(IntSize(child->x() - chPos, 0));
1216 child->setLocation(chPos, child->y());
1231 // We have no bottom margin and our last child has a quirky margin.
1296 RenderBox* child = next;
1297 next = child->nextSiblingBox();
1299 if (legend == child)
1305 if (relayoutChildren || ((child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent()) && !isRenderView()))
1306 child->setChildNeedsLayout(true, false);
1308 // If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths.
1309 if (relayoutChildren && (child->style()->paddingLeft().isPercent() || child->style()->paddingRight().isPercent()))
1310 child->setPrefWidthsDirty(true, false);
1314 if (handleSpecialChild(child, marginInfo))
1317 // Lay out the child.
1318 layoutBlockChild(child, marginInfo, previousFloatBottom, maxFloatBottom);
1326 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatBottom, int& maxFloatBottom)
1331 // The child is a normal flow object. Compute its vertical margins now.
1332 child->calcVerticalMargins();
1335 if (child->style()->marginTopCollapse() == MSEPARATE) {
1343 int yPosEstimate = estimateVerticalPosition(child, marginInfo);
1345 // Cache our old rect so that we can dirty the proper repaint rects if the child moves.
1346 IntRect oldRect(child->x(), child->y() , child->width(), child->height());
1350 // Go ahead and position the child as though it didn't collapse with the top.
1351 view()->addLayoutDelta(IntSize(0, child->y() - yPosEstimate));
1352 child->setLocation(child->x(), yPosEstimate);
1355 if (yPosEstimate != oldRect.y() && !child->avoidsFloats() && child->isBlockFlow() && toRenderBlock(child)->containsFloats())
1357 else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) {
1365 if (child->isRenderBlock()) {
1367 toRenderBlock(child)->markAllDescendantsWithFloatsForLayout();
1369 previousFloatBottom = max(previousFloatBottom, oldRect.y() + toRenderBlock(child)->floatBottom());
1372 bool childHadLayout = child->m_everHadLayout;
1373 bool childNeededLayout = child->needsLayout();
1375 child->layout();
1379 int yBeforeClear = collapseMargins(child, marginInfo);
1382 int yAfterClear = clearFloatsIfNeeded(child, marginInfo, oldTopPosMargin, oldTopNegMargin, yBeforeClear);
1385 child->setLocation(child->x(), yAfterClear);
1389 if (child->shrinkToAvoidFloats()) {
1390 // The child's width depends on the line width.
1391 // When the child shifts to clear an item, its width can
1394 child->setChildNeedsLayout(true, false);
1396 if (!child->avoidsFloats() && child->isBlockFlow() && toRenderBlock(child)->containsFloats())
1397 toRenderBlock(child)->markAllDescendantsWithFloatsForLayout();
1398 // Our guess was wrong. Make the child lay itself out again.
1399 child->layoutIfNeeded();
1402 // We are no longer at the top of the block if we encounter a non-empty child.
1404 if (marginInfo.atTopOfBlock() && !child->isSelfCollapsingBlock())
1407 // Now place the child in the correct horizontal position
1408 determineHorizontalPosition(child);
1410 // Update our height now that the child has been placed in the correct position.
1411 setHeight(height() + child->height());
1412 if (child->style()->marginBottomCollapse() == MSEPARATE) {
1413 setHeight(height() + child->marginBottom());
1416 // If the child has overhanging floats that intrude into following siblings (or possibly out
1418 if (child->isBlockFlow() && toRenderBlock(child)->containsFloats())
1419 maxFloatBottom = max(maxFloatBottom, addOverhangingFloats(toRenderBlock(child), -child->x(), -child->y(), !childNeededLayout));
1421 IntSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y());
1425 // If the child moved, we have to repaint it as well as any floating/positioned
1427 // repaint ourselves (and the child) anyway.
1428 if (childHadLayout && !selfNeedsLayout() && child->checkForRepaintDuringLayout())
1429 child->repaintDuringLayoutIfMoved(oldRect);
1432 if (!childHadLayout && child->checkForRepaintDuringLayout()) {
1433 child->repaint();
1434 child->repaintOverhangingFloats(true);
1485 // If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths.
1580 // We need to do multiple passes, breaking up our child painting into strips.
1615 // We need to do multiple passes, breaking up our child painting into strips.
1681 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
1683 if (isPrinting && !childrenInline() && child->style()->pageBreakBefore() == PBALWAYS &&
1684 inRootBlockContext() && (ty + child->y()) > paintInfo.rect.y() &&
1685 (ty + child->y()) < paintInfo.rect.bottom()) {
1686 view()->setBestTruncatedAt(ty + child->y(), this, true);
1690 if (!child->hasSelfPaintingLayer() && !child->isFloating())
1691 child->paint(info, tx, ty);
1694 if (isPrinting && !childrenInline() && child->style()->pageBreakAfter() == PBALWAYS &&
1695 inRootBlockContext() && (ty + child->y() + child->height()) > paintInfo.rect.y() &&
1696 (ty + child->y() + child->height()) < paintInfo.rect.bottom()) {
1697 view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true);
2114 // Go ahead and jump right to the first block child that contains some selected objects.
2316 // It is parent blocks job to add positioned child to positioned objects list of its containing block
2458 // If the child moved, we have to repaint it.
2683 // a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
2750 // Find the last normal flow child.
2777 // a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
2874 // a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
3079 int RenderBlock::addOverhangingFloats(RenderBlock* child, int xoff, int yoff, bool makeChildPaintOtherFloats)
3082 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot())
3087 // Floats that will remain the child's responsibility to paint should factor into its
3089 DeprecatedPtrListIterator<FloatingObject> it(*child->m_floatingObjects);
3091 int bottom = child->y() + r->m_bottom;
3121 r->m_renderer->isDescendantOf(child) && r->m_renderer->enclosingLayer() == child->enclosingLayer())
3122 // The float is not overhanging from this block, so if it is a descendant of the child, the child should
3123 // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing
3125 // If makeChildPaintOtherFloats is false, it means that the child must already know about all the floats
3130 child->addOverflowFromChild(r->m_renderer, IntSize(r->m_left + r->m_renderer->marginLeft(), r->m_top + r->m_renderer->marginTop()));
3159 // Applying the child's margin makes no sense in the case where the child was passed in.
3162 // into account. Only apply this code if |child| is false, since otherwise the left margin
3210 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
3211 if ((!floatToRemove && child->isFloatingOrPositioned()) || !child->isRenderBlock())
3213 RenderBlock* childBlock = toRenderBlock(child);
3220 int RenderBlock::getClearDelta(RenderBox* child, int yPos)
3227 bool clearSet = child->style()->clear() != CNONE;
3229 switch (child->style()->clear()) {
3245 if (!result && child->avoidsFloats()) {
3247 if (child->minPrefWidth() > availableWidth)
3256 int oldChildY = child->y();
3257 int oldChildWidth = child->width();
3258 child->setY(y);
3259 child->calcWidth();
3260 int childWidthAtY = child->width();
3261 child->setY(oldChildY);
3262 child->setWidth(oldChildWidth);
3403 for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) {
3404 if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, x, y, tx, ty, childHitTest)) {
3451 static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBox* parent, RenderBox* child, const IntPoint& pointInParentCoordinates)
3453 IntPoint pointInChildCoordinates(pointInParentCoordinates - child->location());
3456 Node* childNode = child->node();
3458 return child->positionForPoint(pointInChildCoordinates);
3460 // Otherwise, first make sure that the editability of the parent and child agree.
3461 // If they don't agree, then we return a visible position just before or after the child
3468 return child->positionForPoint(pointInChildCoordinates);
3470 // Otherwise return before or after the child, depending on if the click was left or right of the child
3471 int childMidX = child->width() / 2;
3575 // We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3).
4027 static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline)
4029 RenderStyle* cstyle = child->style();
4032 result += getBPMWidth((leftSide ? child->marginLeft() : child->marginRight()),
4035 result += getBPMWidth((leftSide ? child->paddingLeft() : child->paddingRight()),
4038 result += leftSide ? child->borderLeft() : child->borderRight();
4081 while (RenderObject* child = childIterator.next()) {
4082 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() :
4083 child->style()->autoWrap();
4085 if (!child->isBR()) {
4121 RenderStyle* cstyle = child->style();
4125 if (!child->isText()) {
4127 if (child->isRenderInline()) {
4130 int bpm = getBorderPaddingMargin(toRenderInline(child), childIterator.endOfInline);
4137 child->setPrefWidthsDirty(false);
4152 if (!child->isRenderInline() && !child->isText()) {
4156 childMin += child->minPrefWidth();
4157 childMax += child->maxPrefWidth();
4160 if (child->isFloating()) {
4162 && ((prevFloat->style()->floating() == FLEFT && (child->style()->clear() & CLEFT))
4163 || (prevFloat->style()->floating() == FRIGHT && (child->style()->clear() & CRIGHT))));
4164 prevFloat = child;
4168 bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak;
4193 if (child->isFloating())
4207 if (!child->isFloating()) {
4211 } else if (child->isText()) {
4213 RenderText* t = toRenderText(child);
4248 trailingSpaceChild = child;
4301 if (child->isListMarker())
4312 if (!child->isRenderInline())
4313 previousLeaf = child;
4330 RenderObject *child = firstChild();
4332 while (child) {
4334 if (child->isPositioned()) {
4335 child = child->nextSibling();
4339 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
4341 if (child->style()->clear() & CLEFT) {
4345 if (child->style()->clear() & CRIGHT) {
4354 Length ml = child->style()->marginLeft();
4355 Length mr = child->style()->marginRight();
4363 int w = child->minPrefWidth() + margin;
4367 if (nowrap && !child->isTable())
4370 w = child->maxPrefWidth() + margin;
4372 if (!child->isFloating()) {
4373 if (child->isBox() && toRenderBox(child)->avoidsFloats()) {
4379 w = child->maxPrefWidth() + maxLeft + maxRight;
4387 if (child->isFloating()) {
4408 if (style()->htmlHacks() && child->style()->width().isPercent() &&
4409 !isTableCell() && child->isTable() && m_maxPrefWidth < BLOCK_MAX_WIDTH) {
4417 child = child->nextSibling();
4583 // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find
4604 // Drill into inlines looking for our first text child.
4624 // If the child already has style, then it has already been created, so we just want
4637 // If the child does not already have style, we create it here.