Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: Source/core/layout/LayoutBlock.cpp

Issue 1103883002: Convert Block code to layoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 void LayoutBlock::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& chil dPaintInvalidationState) 365 void LayoutBlock::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& chil dPaintInvalidationState)
366 { 366 {
367 LayoutBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); 367 LayoutBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState);
368 368
369 // Take care of positioned objects. This is required as PaintInvalidationSta te keeps a single clip rect. 369 // Take care of positioned objects. This is required as PaintInvalidationSta te keeps a single clip rect.
370 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObjects ()) { 370 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObjects ()) {
371 for (auto* box : *positionedObjects) { 371 for (auto* box : *positionedObjects) {
372 372
373 // One of the renderers we're skipping over here may be the child's paint invalidation container, 373 // One of the layoutObjects we're skipping over here may be the chil d's paint invalidation container,
374 // so we can't pass our own paint invalidation container along. 374 // so we can't pass our own paint invalidation container along.
375 const LayoutBoxModelObject& paintInvalidationContainerForChild = *bo x->containerForPaintInvalidation(); 375 const LayoutBoxModelObject& paintInvalidationContainerForChild = *bo x->containerForPaintInvalidation();
376 376
377 // If it's a new paint invalidation container, we won't have properl y accumulated the offset into the 377 // If it's a new paint invalidation container, we won't have properl y accumulated the offset into the
378 // PaintInvalidationState. 378 // PaintInvalidationState.
379 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co m/371485 379 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co m/371485
380 if (paintInvalidationContainerForChild != childPaintInvalidationStat e.paintInvalidationContainer()) { 380 if (paintInvalidationContainerForChild != childPaintInvalidationStat e.paintInvalidationContainer()) {
381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida tionState); 381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida tionState);
382 PaintInvalidationState disabledPaintInvalidationState(childPaint InvalidationState, *this, paintInvalidationContainerForChild); 382 PaintInvalidationState disabledPaintInvalidationState(childPaint InvalidationState, *this, paintInvalidationContainerForChild);
383 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); 383 box->invalidateTreeIfNeeded(disabledPaintInvalidationState);
384 continue; 384 continue;
385 } 385 }
386 386
387 // If the positioned renderer is absolutely positioned and it is ins ide 387 // If the positioned layoutObject is absolutely positioned and it is inside
388 // a relatively positioned inline element, we need to account for 388 // a relatively positioned inline element, we need to account for
389 // the inline elements position in PaintInvalidationState. 389 // the inline elements position in PaintInvalidationState.
390 if (box->style()->position() == AbsolutePosition) { 390 if (box->style()->position() == AbsolutePosition) {
391 LayoutObject* container = box->container(&paintInvalidationConta inerForChild, 0); 391 LayoutObject* container = box->container(&paintInvalidationConta inerForChild, 0);
392 if (container->isRelPositioned() && container->isLayoutInline()) { 392 if (container->isRelPositioned() && container->isLayoutInline()) {
393 // FIXME: We should be able to use PaintInvalidationState fo r this. 393 // FIXME: We should be able to use PaintInvalidationState fo r this.
394 // Currently, we will place absolutely positioned elements i nside 394 // Currently, we will place absolutely positioned elements i nside
395 // relatively positioned inline blocks in the wrong location . crbug.com/371485 395 // relatively positioned inline blocks in the wrong location . crbug.com/371485
396 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva lidationState); 396 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva lidationState);
397 PaintInvalidationState disabledPaintInvalidationState(childP aintInvalidationState, *this, paintInvalidationContainerForChild); 397 PaintInvalidationState disabledPaintInvalidationState(childP aintInvalidationState, *this, paintInvalidationContainerForChild);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 void LayoutBlock::addChildToContinuation(LayoutObject* newChild, LayoutObject* b eforeChild) 433 void LayoutBlock::addChildToContinuation(LayoutObject* newChild, LayoutObject* b eforeChild)
434 { 434 {
435 LayoutBlock* flow = continuationBefore(beforeChild); 435 LayoutBlock* flow = continuationBefore(beforeChild);
436 LayoutBoxModelObject* beforeChildParent = 0; 436 LayoutBoxModelObject* beforeChildParent = 0;
437 if (beforeChild) { 437 if (beforeChild) {
438 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); 438 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent());
439 // Don't attempt to insert into something that isn't a LayoutBlockFlow ( block 439 // Don't attempt to insert into something that isn't a LayoutBlockFlow ( block
440 // container). While the DOM nodes of |beforeChild| and |newChild| are s iblings, there may 440 // container). While the DOM nodes of |beforeChild| and |newChild| are s iblings, there may
441 // be anonymous table wrapper objects around |beforeChild| on the layout side. Therefore, 441 // be anonymous table wrapper objects around |beforeChild| on the layout side. Therefore,
442 // find the nearest LayoutBlockFlow. If it turns out that the new render er doesn't belong 442 // find the nearest LayoutBlockFlow. If it turns out that the new layout Object doesn't belong
443 // inside the anonymous table, this will make sure that it's really put on the outside. If 443 // inside the anonymous table, this will make sure that it's really put on the outside. If
444 // it turns out that it does belong inside it, the normal child insertio n machinery will 444 // it turns out that it does belong inside it, the normal child insertio n machinery will
445 // make sure it ends up there, and at the right place too. We cannot jus t guess that it's 445 // make sure it ends up there, and at the right place too. We cannot jus t guess that it's
446 // going to be right under the parent of |beforeChild|. 446 // going to be right under the parent of |beforeChild|.
447 while (beforeChildParent && !beforeChildParent->isLayoutBlockFlow()) { 447 while (beforeChildParent && !beforeChildParent->isLayoutBlockFlow()) {
448 ASSERT(!beforeChildParent->virtualContinuation()); 448 ASSERT(!beforeChildParent->virtualContinuation());
449 ASSERT(beforeChildParent->isAnonymous()); 449 ASSERT(beforeChildParent->isAnonymous());
450 RELEASE_ASSERT(beforeChildParent != this); 450 RELEASE_ASSERT(beforeChildParent != this);
451 beforeChildParent = toLayoutBoxModelObject(beforeChildParent->parent ()); 451 beforeChildParent = toLayoutBoxModelObject(beforeChildParent->parent ());
452 } 452 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 554
555 LayoutBlockFlow* LayoutBlock::containingColumnsBlock(bool allowAnonymousColumnBl ock) 555 LayoutBlockFlow* LayoutBlock::containingColumnsBlock(bool allowAnonymousColumnBl ock)
556 { 556 {
557 LayoutBlock* firstChildIgnoringAnonymousWrappers = 0; 557 LayoutBlock* firstChildIgnoringAnonymousWrappers = 0;
558 for (LayoutObject* curr = this; curr; curr = curr->parent()) { 558 for (LayoutObject* curr = this; curr; curr = curr->parent()) {
559 if (!curr->isLayoutBlock() || curr->isFloatingOrOutOfFlowPositioned() || curr->isTableCell() || curr->isDocumentElement() || curr->isLayoutView() || cur r->hasOverflowClip() 559 if (!curr->isLayoutBlock() || curr->isFloatingOrOutOfFlowPositioned() || curr->isTableCell() || curr->isDocumentElement() || curr->isLayoutView() || cur r->hasOverflowClip()
560 || curr->isInlineBlockOrInlineTable()) 560 || curr->isInlineBlockOrInlineTable())
561 return 0; 561 return 0;
562 562
563 // FIXME: Renderers that do special management of their children (tables , buttons, 563 // FIXME: LayoutObjects that do special management of their children (ta bles, buttons,
564 // lists, flexboxes, etc.) breaks when the flow is split through them. D isabling 564 // lists, flexboxes, etc.) breaks when the flow is split through them. D isabling
565 // multi-column for them to avoid this problem.) 565 // multi-column for them to avoid this problem.)
566 if (!curr->isLayoutBlockFlow() || curr->isListItem()) 566 if (!curr->isLayoutBlockFlow() || curr->isListItem())
567 return 0; 567 return 0;
568 568
569 LayoutBlockFlow* currBlock = toLayoutBlockFlow(curr); 569 LayoutBlockFlow* currBlock = toLayoutBlockFlow(curr);
570 if (!currBlock->createsAnonymousWrapper()) 570 if (!currBlock->createsAnonymousWrapper())
571 firstChildIgnoringAnonymousWrappers = currBlock; 571 firstChildIgnoringAnonymousWrappers = currBlock;
572 572
573 if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock || !currBlock->isAnonymousColumnsBlock())) 573 if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock || !currBlock->isAnonymousColumnsBlock()))
574 return toLayoutBlockFlow(firstChildIgnoringAnonymousWrappers); 574 return toLayoutBlockFlow(firstChildIgnoringAnonymousWrappers);
575 575
576 if (currBlock->isAnonymousColumnSpanBlock()) 576 if (currBlock->isAnonymousColumnSpanBlock())
577 return 0; 577 return 0;
578 } 578 }
579 return 0; 579 return 0;
580 } 580 }
581 581
582 LayoutBlock* LayoutBlock::clone() const 582 LayoutBlock* LayoutBlock::clone() const
583 { 583 {
584 LayoutBlock* cloneBlock; 584 LayoutBlock* cloneBlock;
585 if (isAnonymousBlock()) { 585 if (isAnonymousBlock()) {
586 cloneBlock = createAnonymousBlock(); 586 cloneBlock = createAnonymousBlock();
587 cloneBlock->setChildrenInline(childrenInline()); 587 cloneBlock->setChildrenInline(childrenInline());
588 } else { 588 } else {
589 LayoutObject* cloneRenderer = toElement(node())->createLayoutObject(styl eRef()); 589 LayoutObject* cloneLayoutObject = toElement(node())->createLayoutObject( styleRef());
590 cloneBlock = toLayoutBlock(cloneRenderer); 590 cloneBlock = toLayoutBlock(cloneLayoutObject);
591 cloneBlock->setStyle(mutableStyle()); 591 cloneBlock->setStyle(mutableStyle());
592 592
593 // This takes care of setting the right value of childrenInline in case 593 // This takes care of setting the right value of childrenInline in case
594 // generated content is added to cloneBlock and 'this' does not have 594 // generated content is added to cloneBlock and 'this' does not have
595 // generated content added yet. 595 // generated content added yet.
596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir stChild()->isInline() : childrenInline()); 596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir stChild()->isInline() : childrenInline());
597 } 597 }
598 cloneBlock->setFlowThreadState(flowThreadState()); 598 cloneBlock->setFlowThreadState(flowThreadState());
599 return cloneBlock; 599 return cloneBlock;
600 } 600 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 LayoutObject* beforeChildContainer = beforeChild->parent(); 808 LayoutObject* beforeChildContainer = beforeChild->parent();
809 while (beforeChildContainer->parent() != this) 809 while (beforeChildContainer->parent() != this)
810 beforeChildContainer = beforeChildContainer->parent(); 810 beforeChildContainer = beforeChildContainer->parent();
811 ASSERT(beforeChildContainer); 811 ASSERT(beforeChildContainer);
812 812
813 if (beforeChildContainer->isAnonymous()) { 813 if (beforeChildContainer->isAnonymous()) {
814 // If the requested beforeChild is not one of our children, then thi s is because 814 // If the requested beforeChild is not one of our children, then thi s is because
815 // there is an anonymous container within this object that contains the beforeChild. 815 // there is an anonymous container within this object that contains the beforeChild.
816 LayoutObject* beforeChildAnonymousContainer = beforeChildContainer; 816 LayoutObject* beforeChildAnonymousContainer = beforeChildContainer;
817 if (beforeChildAnonymousContainer->isAnonymousBlock() 817 if (beforeChildAnonymousContainer->isAnonymousBlock()
818 // Full screen renderers and full screen placeholders act as ano nymous blocks, not tables: 818 // Full screen layoutObjects and full screen placeholders act as anonymous blocks, not tables:
819 || beforeChildAnonymousContainer->isLayoutFullScreen() 819 || beforeChildAnonymousContainer->isLayoutFullScreen()
820 || beforeChildAnonymousContainer->isLayoutFullScreenPlaceholder( ) 820 || beforeChildAnonymousContainer->isLayoutFullScreenPlaceholder( )
821 ) { 821 ) {
822 // Insert the child into the anonymous block box instead of here . 822 // Insert the child into the anonymous block box instead of here .
823 if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPosit ioned() || beforeChild->parent()->slowFirstChild() != beforeChild) 823 if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPosit ioned() || beforeChild->parent()->slowFirstChild() != beforeChild)
824 beforeChild->parent()->addChild(newChild, beforeChild); 824 beforeChild->parent()->addChild(newChild, beforeChild);
825 else 825 else
826 addChild(newChild, beforeChild->parent()); 826 addChild(newChild, beforeChild->parent());
827 return; 827 return;
828 } 828 }
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 // prevent crossing editable boundaries. This would require many tests. 2383 // prevent crossing editable boundaries. This would require many tests.
2384 static PositionWithAffinity positionForPointRespectingEditingBoundaries(LayoutBl ock* parent, LayoutBox* child, const LayoutPoint& pointInParentCoordinates) 2384 static PositionWithAffinity positionForPointRespectingEditingBoundaries(LayoutBl ock* parent, LayoutBox* child, const LayoutPoint& pointInParentCoordinates)
2385 { 2385 {
2386 LayoutPoint childLocation = child->location(); 2386 LayoutPoint childLocation = child->location();
2387 if (child->isRelPositioned()) 2387 if (child->isRelPositioned())
2388 childLocation += child->offsetForInFlowPosition(); 2388 childLocation += child->offsetForInFlowPosition();
2389 2389
2390 // FIXME: This is wrong if the child's writing-mode is different from the pa rent's. 2390 // FIXME: This is wrong if the child's writing-mode is different from the pa rent's.
2391 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation)); 2391 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation));
2392 2392
2393 // If this is an anonymous renderer, we just recur normally 2393 // If this is an anonymous layoutObject, we just recur normally
2394 Node* childNode = child->nonPseudoNode(); 2394 Node* childNode = child->nonPseudoNode();
2395 if (!childNode) 2395 if (!childNode)
2396 return child->positionForPoint(pointInChildCoordinates); 2396 return child->positionForPoint(pointInChildCoordinates);
2397 2397
2398 // Otherwise, first make sure that the editability of the parent and child a gree. 2398 // Otherwise, first make sure that the editability of the parent and child a gree.
2399 // If they don't agree, then we return a visible position just before or aft er the child 2399 // If they don't agree, then we return a visible position just before or aft er the child
2400 LayoutObject* ancestor = parent; 2400 LayoutObject* ancestor = parent;
2401 while (ancestor && !ancestor->nonPseudoNode()) 2401 while (ancestor && !ancestor->nonPseudoNode())
2402 ancestor = ancestor->parent(); 2402 ancestor = ancestor->parent();
2403 2403
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 } 3187 }
3188 3188
3189 // If we're not replaced, we'll only get called with PositionOfInteriorLineB oxes. 3189 // If we're not replaced, we'll only get called with PositionOfInteriorLineB oxes.
3190 // Note that inline-block counts as replaced here. 3190 // Note that inline-block counts as replaced here.
3191 ASSERT(linePositionMode == PositionOfInteriorLineBoxes); 3191 ASSERT(linePositionMode == PositionOfInteriorLineBoxes);
3192 3192
3193 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 3193 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
3194 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 3194 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
3195 } 3195 }
3196 3196
3197 LayoutUnit LayoutBlock::minLineHeightForReplacedRenderer(bool isFirstLine, Layou tUnit replacedHeight) const 3197 LayoutUnit LayoutBlock::minLineHeightForReplacedObject(bool isFirstLine, LayoutU nit replacedHeight) const
3198 { 3198 {
3199 if (!document().inNoQuirksMode() && replacedHeight) 3199 if (!document().inNoQuirksMode() && replacedHeight)
3200 return replacedHeight; 3200 return replacedHeight;
3201 3201
3202 if (!(style(isFirstLine)->lineBoxContain() & LineBoxContainBlock)) 3202 if (!(style(isFirstLine)->lineBoxContain() & LineBoxContainBlock))
3203 return LayoutUnit(); 3203 return LayoutUnit();
3204 3204
3205 return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizo ntalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)) ; 3205 return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizo ntalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)) ;
3206 } 3206 }
3207 3207
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 } 3515 }
3516 3516
3517 void LayoutBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint & additionalOffset) const 3517 void LayoutBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint & additionalOffset) const
3518 { 3518 {
3519 // For blocks inside inlines, we go ahead and include margins so that we run right up to the 3519 // For blocks inside inlines, we go ahead and include margins so that we run right up to the
3520 // inline boxes above and below us (thus getting merged with them to form a single irregular 3520 // inline boxes above and below us (thus getting merged with them to form a single irregular
3521 // shape). 3521 // shape).
3522 if (inlineElementContinuation()) { 3522 if (inlineElementContinuation()) {
3523 // FIXME: This check really isn't accurate. 3523 // FIXME: This check really isn't accurate.
3524 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); 3524 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
3525 // FIXME: This is wrong. The principal renderer may not be the continuat ion preceding this block. 3525 // FIXME: This is wrong. The principal layoutObject may not be the conti nuation preceding this block.
3526 // FIXME: This is wrong for vertical writing-modes. 3526 // FIXME: This is wrong for vertical writing-modes.
3527 // https://bugs.webkit.org/show_bug.cgi?id=46781 3527 // https://bugs.webkit.org/show_bug.cgi?id=46781
3528 bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation()-> node()->layoutObject())->firstLineBox(); 3528 bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation()-> node()->layoutObject())->firstLineBox();
3529 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit(); 3529 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
3530 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit(); 3530 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
3531 LayoutRect rect(additionalOffset, size()); 3531 LayoutRect rect(additionalOffset, size());
3532 rect.expandEdges(topMargin, 0, bottomMargin, 0); 3532 rect.expandEdges(topMargin, 0, bottomMargin, 0);
3533 3533
3534 if (!rect.isEmpty()) 3534 if (!rect.isEmpty())
3535 rects.append(rect); 3535 rects.append(rect);
(...skipping 29 matching lines...) Expand all
3565 // It's common for this rect to be entirely contained in our box, so exclude that simple case. 3565 // It's common for this rect to be entirely contained in our box, so exclude that simple case.
3566 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect)) ) 3566 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect)) )
3567 rects.append(rect); 3567 rects.append(rect);
3568 } 3568 }
3569 } 3569 }
3570 } 3570 }
3571 3571
3572 LayoutBox* LayoutBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par ent) const 3572 LayoutBox* LayoutBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par ent) const
3573 { 3573 {
3574 if (isAnonymousColumnsBlock()) 3574 if (isAnonymousColumnsBlock())
3575 return createAnonymousColumnsWithParentRenderer(parent); 3575 return createAnonymousColumnsWithParent(parent);
3576 if (isAnonymousColumnSpanBlock()) 3576 if (isAnonymousColumnSpanBlock())
3577 return createAnonymousColumnSpanWithParentRenderer(parent); 3577 return createAnonymousColumnSpanWithParent(parent);
3578 return createAnonymousWithParentRendererAndDisplay(parent, style()->display( )); 3578 return createAnonymousWithParentAndDisplay(parent, style()->display());
3579 } 3579 }
3580 3580
3581 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar yRule pageBoundaryRule) const 3581 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar yRule pageBoundaryRule) const
3582 { 3582 {
3583 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 3583 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
3584 if (!pageLogicalHeight) 3584 if (!pageLogicalHeight)
3585 return logicalOffset; 3585 return logicalOffset;
3586 3586
3587 // The logicalOffset is in our coordinate space. We can add in our pushed o ffset. 3587 // The logicalOffset is in our coordinate space. We can add in our pushed o ffset.
3588 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset); 3588 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 // whether or not authors specified quirky ems, since they're an implementat ion detail. 3714 // whether or not authors specified quirky ems, since they're an implementat ion detail.
3715 return false; 3715 return false;
3716 } 3716 }
3717 3717
3718 const char* LayoutBlock::name() const 3718 const char* LayoutBlock::name() const
3719 { 3719 {
3720 ASSERT_NOT_REACHED(); 3720 ASSERT_NOT_REACHED();
3721 return "LayoutBlock"; 3721 return "LayoutBlock";
3722 } 3722 }
3723 3723
3724 LayoutBlock* LayoutBlock::createAnonymousWithParentRendererAndDisplay(const Layo utObject* parent, EDisplay display) 3724 LayoutBlock* LayoutBlock::createAnonymousWithParentAndDisplay(const LayoutObject * parent, EDisplay display)
3725 { 3725 {
3726 // FIXME: Do we need to convert all our inline displays to block-type in the anonymous logic ? 3726 // FIXME: Do we need to convert all our inline displays to block-type in the anonymous logic ?
3727 EDisplay newDisplay; 3727 EDisplay newDisplay;
3728 LayoutBlock* newBox = 0; 3728 LayoutBlock* newBox = 0;
3729 if (display == FLEX || display == INLINE_FLEX) { 3729 if (display == FLEX || display == INLINE_FLEX) {
3730 newBox = LayoutFlexibleBox::createAnonymous(&parent->document()); 3730 newBox = LayoutFlexibleBox::createAnonymous(&parent->document());
3731 newDisplay = FLEX; 3731 newDisplay = FLEX;
3732 } else { 3732 } else {
3733 newBox = LayoutBlockFlow::createAnonymous(&parent->document()); 3733 newBox = LayoutBlockFlow::createAnonymous(&parent->document());
3734 newDisplay = BLOCK; 3734 newDisplay = BLOCK;
3735 } 3735 }
3736 3736
3737 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), newDisplay); 3737 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), newDisplay);
3738 parent->updateAnonymousChildStyle(*newBox, *newStyle); 3738 parent->updateAnonymousChildStyle(*newBox, *newStyle);
3739 newBox->setStyle(newStyle.release()); 3739 newBox->setStyle(newStyle.release());
3740 return newBox; 3740 return newBox;
3741 } 3741 }
3742 3742
3743 LayoutBlockFlow* LayoutBlock::createAnonymousColumnsWithParentRenderer(const Lay outObject* parent) 3743 LayoutBlockFlow* LayoutBlock::createAnonymousColumnsWithParent(const LayoutObjec t* parent)
3744 { 3744 {
3745 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), BLOCK); 3745 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), BLOCK);
3746 newStyle->inheritColumnPropertiesFrom(parent->styleRef()); 3746 newStyle->inheritColumnPropertiesFrom(parent->styleRef());
3747 3747
3748 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&parent->document ()); 3748 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&parent->document ());
3749 parent->updateAnonymousChildStyle(*newBox, *newStyle); 3749 parent->updateAnonymousChildStyle(*newBox, *newStyle);
3750 newBox->setStyle(newStyle.release()); 3750 newBox->setStyle(newStyle.release());
3751 return newBox; 3751 return newBox;
3752 } 3752 }
3753 3753
3754 LayoutBlockFlow* LayoutBlock::createAnonymousColumnSpanWithParentRenderer(const LayoutObject* parent) 3754 LayoutBlockFlow* LayoutBlock::createAnonymousColumnSpanWithParent(const LayoutOb ject* parent)
3755 { 3755 {
3756 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), BLOCK); 3756 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), BLOCK);
3757 newStyle->setColumnSpan(ColumnSpanAll); 3757 newStyle->setColumnSpan(ColumnSpanAll);
3758 3758
3759 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&parent->document ()); 3759 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&parent->document ());
3760 parent->updateAnonymousChildStyle(*newBox, *newStyle); 3760 parent->updateAnonymousChildStyle(*newBox, *newStyle);
3761 newBox->setStyle(newStyle.release()); 3761 newBox->setStyle(newStyle.release());
3762 return newBox; 3762 return newBox;
3763 } 3763 }
3764 3764
3765 static bool recalcNormalFlowChildOverflowIfNeeded(LayoutObject* renderer) 3765 static bool recalcNormalFlowChildOverflowIfNeeded(LayoutObject* layoutObject)
3766 { 3766 {
3767 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter StyleChange()) 3767 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec alcAfterStyleChange())
3768 return false; 3768 return false;
3769 3769
3770 ASSERT(renderer->isLayoutBlock()); 3770 ASSERT(layoutObject->isLayoutBlock());
3771 return toLayoutBlock(renderer)->recalcOverflowAfterStyleChange(); 3771 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange();
3772 } 3772 }
3773 3773
3774 bool LayoutBlock::recalcChildOverflowAfterStyleChange() 3774 bool LayoutBlock::recalcChildOverflowAfterStyleChange()
3775 { 3775 {
3776 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); 3776 ASSERT(childNeedsOverflowRecalcAfterStyleChange());
3777 setChildNeedsOverflowRecalcAfterStyleChange(false); 3777 setChildNeedsOverflowRecalcAfterStyleChange(false);
3778 3778
3779 bool childrenOverflowChanged = false; 3779 bool childrenOverflowChanged = false;
3780 3780
3781 if (childrenInline()) { 3781 if (childrenInline()) {
3782 ListHashSet<RootInlineBox*> lineBoxes; 3782 ListHashSet<RootInlineBox*> lineBoxes;
3783 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { 3783 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
3784 LayoutObject* renderer = walker.current(); 3784 LayoutObject* layoutObject = walker.current();
3785 if (recalcNormalFlowChildOverflowIfNeeded(renderer)) { 3785 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) {
3786 childrenOverflowChanged = true; 3786 childrenOverflowChanged = true;
3787 if (InlineBox* inlineBoxWrapper = toLayoutBlock(renderer)->inlin eBoxWrapper()) 3787 if (InlineBox* inlineBoxWrapper = toLayoutBlock(layoutObject)->i nlineBoxWrapper())
3788 lineBoxes.add(&inlineBoxWrapper->root()); 3788 lineBoxes.add(&inlineBoxWrapper->root());
3789 } 3789 }
3790 } 3790 }
3791 3791
3792 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal. 3792 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal.
3793 GlyphOverflowAndFallbackFontsMap textBoxDataMap; 3793 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
3794 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { 3794 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) {
3795 RootInlineBox* box = *it; 3795 RootInlineBox* box = *it;
3796 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM ap); 3796 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM ap);
3797 } 3797 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 3913 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
3914 { 3914 {
3915 showLayoutObject(); 3915 showLayoutObject();
3916 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3916 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3917 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3917 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3918 } 3918 }
3919 3919
3920 #endif 3920 #endif
3921 3921
3922 } // namespace blink 3922 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698