Changeset 155377 in webkit


Ignore:
Timestamp:
Sep 9, 2013 1:23:21 PM (11 years ago)
Author:
hyatt@apple.com
Message:

Move layoutBlock and layoutBlockChildren into RenderBlockFlow
https://bugs.webkit.org/show_bug.cgi?id=121036

Reviewed by Dean Jackson.

Move layoutBlock into RenderBlockFlow and make the base class version of
the method ASSERT_NOT_REACHED. Begin the process of moving block layout
into RenderBlockFlow by putting layoutBlockChildren there as well.

This patch also puts clearFloats into RenderBlockFlow and just ditches the
SVG-specific forceLayoutInlineChildren by letting RenderSVGText do what it
needs in its own file.

Convert RenderListBox to be a RenderBlockFlow, since this is necessary for it
to get the correct layoutBlock method.

Patch RenderRegion to call RenderBlockFlow::layoutBlock rather than RenderBlock::layoutBlock.

Fix run-ins so that they create block flows rather than blocks, and restrict run-ins to
only be block flows.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::createReplacementRunIn):
(WebCore::RenderBlock::moveRunInUnderSiblingBlockIfNeeded):

  • rendering/RenderBlock.h:
  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::clearFloats):
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::layoutBlockChildren):

  • rendering/RenderBlockFlow.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlockFlow::layoutInlineChildren):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::RenderListBox):
(WebCore::RenderListBox::layout):
(WebCore::RenderListBox::paintObject):
(WebCore::RenderListBox::addFocusRingRects):
(WebCore::RenderListBox::nodeAtPoint):

  • rendering/RenderListBox.h:
  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::paintObject):
(WebCore::RenderRegion::styleDidChange):
(WebCore::RenderRegion::layoutBlock):
(WebCore::RenderRegion::insertedIntoTree):
(WebCore::RenderRegion::willBeRemovedFromTree):
(WebCore::RenderRegion::computeIntrinsicLogicalWidths):
(WebCore::RenderRegion::computePreferredLogicalWidths):
(WebCore::RenderRegion::updateLogicalHeight):

  • rendering/RenderTextControlSingleLine.cpp:

(WebCore::RenderTextControlSingleLine::layout):

  • rendering/svg/RenderSVGText.cpp:

(WebCore::RenderSVGText::layout):

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155375 r155377  
     12013-09-09  David Hyatt  <hyatt@apple.com>
     2
     3        Move layoutBlock and layoutBlockChildren into RenderBlockFlow
     4        https://bugs.webkit.org/show_bug.cgi?id=121036
     5
     6        Reviewed by Dean Jackson.
     7
     8        Move layoutBlock into RenderBlockFlow and make the base class version of
     9        the method ASSERT_NOT_REACHED. Begin the process of moving block layout
     10        into RenderBlockFlow by putting layoutBlockChildren there as well.
     11       
     12        This patch also puts clearFloats into RenderBlockFlow and just ditches the
     13        SVG-specific forceLayoutInlineChildren by letting RenderSVGText do what it
     14        needs in its own file.
     15
     16        Convert RenderListBox to be a RenderBlockFlow, since this is necessary for it
     17        to get the correct layoutBlock method.
     18       
     19        Patch RenderRegion to call RenderBlockFlow::layoutBlock rather than RenderBlock::layoutBlock.
     20       
     21        Fix run-ins so that they create block flows rather than blocks, and restrict run-ins to
     22        only be block flows.
     23
     24        * rendering/RenderBlock.cpp:
     25        (WebCore::RenderBlock::layoutBlock):
     26        (WebCore::RenderBlock::createReplacementRunIn):
     27        (WebCore::RenderBlock::moveRunInUnderSiblingBlockIfNeeded):
     28        * rendering/RenderBlock.h:
     29        * rendering/RenderBlockFlow.cpp:
     30        (WebCore::RenderBlockFlow::clearFloats):
     31        (WebCore::RenderBlockFlow::layoutBlock):
     32        (WebCore::RenderBlockFlow::layoutBlockChildren):
     33        * rendering/RenderBlockFlow.h:
     34        * rendering/RenderBlockLineLayout.cpp:
     35        (WebCore::RenderBlockFlow::layoutInlineChildren):
     36        * rendering/RenderListBox.cpp:
     37        (WebCore::RenderListBox::RenderListBox):
     38        (WebCore::RenderListBox::layout):
     39        (WebCore::RenderListBox::paintObject):
     40        (WebCore::RenderListBox::addFocusRingRects):
     41        (WebCore::RenderListBox::nodeAtPoint):
     42        * rendering/RenderListBox.h:
     43        * rendering/RenderRegion.cpp:
     44        (WebCore::RenderRegion::paintObject):
     45        (WebCore::RenderRegion::styleDidChange):
     46        (WebCore::RenderRegion::layoutBlock):
     47        (WebCore::RenderRegion::insertedIntoTree):
     48        (WebCore::RenderRegion::willBeRemovedFromTree):
     49        (WebCore::RenderRegion::computeIntrinsicLogicalWidths):
     50        (WebCore::RenderRegion::computePreferredLogicalWidths):
     51        (WebCore::RenderRegion::updateLogicalHeight):
     52        * rendering/RenderTextControlSingleLine.cpp:
     53        (WebCore::RenderTextControlSingleLine::layout):
     54        * rendering/svg/RenderSVGText.cpp:
     55        (WebCore::RenderSVGText::layout):
     56
    1572013-09-09  Antti Koivisto  <antti@apple.com>
    258
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r155374 r155377  
    16311631}
    16321632
    1633 void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight)
    1634 {
    1635     ASSERT(needsLayout());
    1636 
    1637     if (isInline() && !isInlineBlockOrInlineTable()) // Inline <form>s inside various table elements can
    1638         return;                                      // cause us to come in here.  Just bail.
    1639 
    1640     if (!relayoutChildren && simplifiedLayout())
    1641         return;
    1642 
    1643     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
    1644 
    1645     if (updateLogicalWidthAndColumnWidth())
    1646         relayoutChildren = true;
    1647 
    1648     clearFloats();
    1649 
    1650     LayoutUnit previousHeight = logicalHeight();
    1651     // FIXME: should this start out as borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(),
    1652     // for consistency with other render classes?
    1653     setLogicalHeight(0);
    1654 
    1655     bool pageLogicalHeightChanged = false;
    1656     bool hasSpecifiedPageLogicalHeight = false;
    1657     checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightChanged, hasSpecifiedPageLogicalHeight);
    1658 
    1659     RenderStyle* styleToUse = style();
    1660     LayoutStateMaintainer statePusher(&view(), this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo());
    1661 
    1662     // Regions changing widths can force us to relayout our children.
    1663     RenderFlowThread* flowThread = flowThreadContainingBlock();
    1664     if (logicalWidthChangedInRegions(flowThread))
    1665         relayoutChildren = true;
    1666     if (updateShapesBeforeBlockLayout())
    1667         relayoutChildren = true;
    1668 
    1669     // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track
    1670     // our current maximal positive and negative margins.  These values are used when we
    1671     // are collapsed with adjacent blocks, so for example, if you have block A and B
    1672     // collapsing together, then you'd take the maximal positive margin from both A and B
    1673     // and subtract it from the maximal negative margin from both A and B to get the
    1674     // true collapsed margin.  This algorithm is recursive, so when we finish layout()
    1675     // our block knows its current maximal positive/negative values.
    1676     //
    1677     // Start out by setting our margin values to our current margins.  Table cells have
    1678     // no margins, so we don't fill in the values for table cells.
    1679     bool isCell = isTableCell();
    1680     if (!isCell) {
    1681         initMaxMarginValues();
    1682        
    1683         setHasMarginBeforeQuirk(styleToUse->hasMarginBeforeQuirk());
    1684         setHasMarginAfterQuirk(styleToUse->hasMarginAfterQuirk());
    1685         setPaginationStrut(0);
    1686     }
    1687 
    1688     LayoutUnit repaintLogicalTop = 0;
    1689     LayoutUnit repaintLogicalBottom = 0;
    1690     LayoutUnit maxFloatLogicalBottom = 0;
    1691     if (!firstChild() && !isAnonymousBlock())
    1692         setChildrenInline(true);
    1693     if (childrenInline())
    1694         layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
    1695     else
    1696         layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
    1697 
    1698     // Expand our intrinsic height to encompass floats.
    1699     LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight();
    1700     if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats())
    1701         setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
    1702    
    1703     if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher) || relayoutToAvoidWidows(statePusher)) {
    1704         ASSERT(!shouldBreakAtLineToAvoidWidow());
    1705         return;
    1706     }
    1707 
    1708     // Calculate our new height.
    1709     LayoutUnit oldHeight = logicalHeight();
    1710     LayoutUnit oldClientAfterEdge = clientLogicalBottom();
    1711 
    1712     // Before updating the final size of the flow thread make sure a forced break is applied after the content.
    1713     // This ensures the size information is correctly computed for the last auto-height region receiving content.
    1714     if (isRenderFlowThread())
    1715         toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge);
    1716 
    1717     updateLogicalHeight();
    1718     LayoutUnit newHeight = logicalHeight();
    1719     if (oldHeight != newHeight) {
    1720         if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
    1721             // One of our children's floats may have become an overhanging float for us. We need to look for it.
    1722             for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    1723                 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPositioned()) {
    1724                     RenderBlock* block = toRenderBlock(child);
    1725                     if (block->lowestFloatLogicalBottom() + block->logicalTop() > newHeight)
    1726                         addOverhangingFloats(block, false);
    1727                 }
    1728             }
    1729         }
    1730     }
    1731 
    1732     bool heightChanged = (previousHeight != newHeight);
    1733     if (heightChanged)
    1734         relayoutChildren = true;
    1735 
    1736     layoutPositionedObjects(relayoutChildren || isRoot());
    1737 
    1738     updateShapesAfterBlockLayout(heightChanged);
    1739 
    1740     // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
    1741     computeOverflow(oldClientAfterEdge);
    1742    
    1743     statePusher.pop();
    1744 
    1745     fitBorderToLinesIfNeeded();
    1746 
    1747     if (view().layoutState()->m_pageLogicalHeight)
    1748         setPageLogicalOffset(view().layoutState()->pageLogicalOffset(this, logicalTop()));
    1749 
    1750     updateLayerTransform();
    1751 
    1752     // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
    1753     // we overflow or not.
    1754     updateScrollInfoAfterLayout();
    1755 
    1756     // FIXME: This repaint logic should be moved into a separate helper function!
    1757     // Repaint with our new bounds if they are different from our old bounds.
    1758     bool didFullRepaint = repainter.repaintAfterLayout();
    1759     if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (styleToUse->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
    1760         // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines
    1761         // it had to lay out.  We wouldn't need the hasOverflowClip() hack in that case either.
    1762         LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow();
    1763         LayoutUnit repaintLogicalRight = logicalRightVisualOverflow();
    1764         if (hasOverflowClip()) {
    1765             // If we have clipped overflow, we should use layout overflow as well, since visual overflow from lines didn't propagate to our block's overflow.
    1766             // Note the old code did this as well but even for overflow:visible.  The addition of hasOverflowClip() at least tightens up the hack a bit.
    1767             // layoutInlineChildren should be patched to compute the entire repaint rect.
    1768             repaintLogicalLeft = min(repaintLogicalLeft, logicalLeftLayoutOverflow());
    1769             repaintLogicalRight = max(repaintLogicalRight, logicalRightLayoutOverflow());
    1770         }
    1771        
    1772         LayoutRect repaintRect;
    1773         if (isHorizontalWritingMode())
    1774             repaintRect = LayoutRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);
    1775         else
    1776             repaintRect = LayoutRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
    1777 
    1778         // The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union.
    1779         adjustRectForColumns(repaintRect);
    1780 
    1781         repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline));
    1782        
    1783         if (hasOverflowClip()) {
    1784             // Adjust repaint rect for scroll offset
    1785             repaintRect.move(-scrolledContentOffset());
    1786 
    1787             // Don't allow this rect to spill out of our overflow box.
    1788             repaintRect.intersect(LayoutRect(LayoutPoint(), size()));
    1789         }
    1790 
    1791         // Make sure the rect is still non-empty after intersecting for overflow above
    1792         if (!repaintRect.isEmpty()) {
    1793             repaintRectangle(repaintRect); // We need to do a partial repaint of our content.
    1794             if (hasReflection())
    1795                 repaintRectangle(reflectedRect(repaintRect));
    1796         }
    1797     }
    1798 
     1633void RenderBlock::layoutBlock(bool, LayoutUnit)
     1634{
     1635    ASSERT_NOT_REACHED();
    17991636    setNeedsLayout(false);
    18001637}
     
    20181855
    20191856    RenderBoxModelObject* newRunIn = 0;
    2020     if (!runIn->isRenderBlock())
    2021         newRunIn = new (renderArena()) RenderBlock(runIn->element());
     1857    if (!runIn->isRenderBlockFlow())
     1858        newRunIn = new (renderArena()) RenderBlockFlow(runIn->element());
    20221859    else
    20231860        newRunIn = new (renderArena()) RenderInline(runIn->element());
     
    20411878
    20421879    // FIXME: We don't handle non-block elements with run-in for now.
    2043     if (!runIn->isRenderBlock())
     1880    if (!runIn->isRenderBlockFlow())
    20441881        return;
    20451882
     
    25972434        }
    25982435    }
    2599 }
    2600 
    2601 void RenderBlock::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom)
    2602 {
    2603     dirtyForLayoutFromPercentageHeightDescendants();
    2604 
    2605     LayoutUnit beforeEdge = borderAndPaddingBefore();
    2606     LayoutUnit afterEdge = borderAndPaddingAfter() + scrollbarLogicalHeight();
    2607 
    2608     setLogicalHeight(beforeEdge);
    2609    
    2610     // Lay out our hypothetical grid line as though it occurs at the top of the block.
    2611     if (view().layoutState()->lineGrid() == this)
    2612         layoutLineGridBox();
    2613 
    2614     // The margin struct caches all our current margin collapsing state.  The compact struct caches state when we encounter compacts,
    2615     MarginInfo marginInfo(this, beforeEdge, afterEdge);
    2616 
    2617     // Fieldsets need to find their legend and position it inside the border of the object.
    2618     // The legend then gets skipped during normal layout.  The same is true for ruby text.
    2619     // It doesn't get included in the normal layout process but is instead skipped.
    2620     RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren);
    2621 
    2622     LayoutUnit previousFloatLogicalBottom = 0;
    2623     maxFloatLogicalBottom = 0;
    2624 
    2625     RenderBox* next = firstChildBox();
    2626 
    2627     while (next) {
    2628         RenderBox* child = next;
    2629         next = child->nextSiblingBox();
    2630 
    2631         if (childToExclude == child)
    2632             continue; // Skip this child, since it will be positioned by the specialized subclass (fieldsets and ruby runs).
    2633 
    2634         updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
    2635 
    2636         if (child->isOutOfFlowPositioned()) {
    2637             child->containingBlock()->insertPositionedObject(child);
    2638             adjustPositionedBlock(child, marginInfo);
    2639             continue;
    2640         }
    2641         if (child->isFloating()) {
    2642             insertFloatingObject(child);
    2643             adjustFloatingBlock(marginInfo);
    2644             continue;
    2645         }
    2646 
    2647         // Lay out the child.
    2648         layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloatLogicalBottom);
    2649     }
    2650    
    2651     // Now do the handling of the bottom of the block, adding in our bottom border/padding and
    2652     // determining the correct collapsed bottom margin information.
    2653     handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
    26542436}
    26552437
     
    46984480        afterLowest->markDirty();
    46994481        afterLowest = afterLowest->prevRootBox();
    4700     }
    4701 }
    4702 
    4703 void RenderBlock::clearFloats()
    4704 {
    4705     if (m_floatingObjects)
    4706         m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
    4707 
    4708     HashSet<RenderBox*> oldIntrudingFloatSet;
    4709     if (!childrenInline() && m_floatingObjects) {
    4710         const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    4711         FloatingObjectSetIterator end = floatingObjectSet.end();
    4712         for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
    4713             FloatingObject* floatingObject = *it;
    4714             if (!floatingObject->isDescendant())
    4715                 oldIntrudingFloatSet.add(floatingObject->renderer());
    4716         }
    4717     }
    4718 
    4719     // Inline blocks are covered by the isReplaced() check in the avoidFloats method.
    4720     if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrOutOfFlowPositioned() || isTableCell()) {
    4721         if (m_floatingObjects) {
    4722             deleteAllValues(m_floatingObjects->set());
    4723             m_floatingObjects->clear();
    4724         }
    4725         if (!oldIntrudingFloatSet.isEmpty())
    4726             markAllDescendantsWithFloatsForLayout();
    4727         return;
    4728     }
    4729 
    4730     typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap;
    4731     RendererToFloatInfoMap floatMap;
    4732 
    4733     if (m_floatingObjects) {
    4734         const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    4735         if (childrenInline()) {
    4736             FloatingObjectSetIterator end = floatingObjectSet.end();
    4737             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
    4738                 FloatingObject* f = *it;
    4739                 floatMap.add(f->renderer(), f);
    4740             }
    4741         } else
    4742             deleteAllValues(floatingObjectSet);
    4743         m_floatingObjects->clear();
    4744     }
    4745 
    4746     // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add
    4747     // floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
    4748     // See <rdar://problem/8049753>, where float property is applied on a text node in a SVG.
    4749     if (!parent() || !parent()->isRenderBlock())
    4750         return;
    4751 
    4752     // Attempt to locate a previous sibling with overhanging floats.  We skip any elements that are
    4753     // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
    4754     // to avoid floats.
    4755     RenderBlock* parentBlock = toRenderBlock(parent());
    4756     bool parentHasFloats = false;
    4757     RenderObject* prev = previousSibling();
    4758     while (prev && (prev->isFloatingOrOutOfFlowPositioned() || !prev->isBox() || !prev->isRenderBlock() || toRenderBlock(prev)->avoidsFloats())) {
    4759         if (prev->isFloating())
    4760             parentHasFloats = true;
    4761         prev = prev->previousSibling();
    4762     }
    4763 
    4764     // First add in floats from the parent.
    4765     LayoutUnit logicalTopOffset = logicalTop();
    4766     if (parentHasFloats)
    4767         addIntrudingFloats(parentBlock, parentBlock->logicalLeftOffsetForContent(), logicalTopOffset);
    4768    
    4769     LayoutUnit logicalLeftOffset = 0;
    4770     if (prev)
    4771         logicalTopOffset -= toRenderBox(prev)->logicalTop();
    4772     else {
    4773         prev = parentBlock;
    4774         logicalLeftOffset += parentBlock->logicalLeftOffsetForContent();
    4775     }
    4776 
    4777     // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.   
    4778     RenderBlock* block = toRenderBlock(prev);
    4779     if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTopOffset)
    4780         addIntrudingFloats(block, logicalLeftOffset, logicalTopOffset);
    4781 
    4782     if (childrenInline()) {
    4783         LayoutUnit changeLogicalTop = LayoutUnit::max();
    4784         LayoutUnit changeLogicalBottom = LayoutUnit::min();
    4785         if (m_floatingObjects) {
    4786             const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    4787             FloatingObjectSetIterator end = floatingObjectSet.end();
    4788             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
    4789                 FloatingObject* f = *it;
    4790                 FloatingObject* oldFloatingObject = floatMap.get(f->renderer());
    4791                 LayoutUnit logicalBottom = f->logicalBottom(isHorizontalWritingMode());
    4792                 if (oldFloatingObject) {
    4793                     LayoutUnit oldLogicalBottom = oldFloatingObject->logicalBottom(isHorizontalWritingMode());
    4794                     if (f->logicalWidth(isHorizontalWritingMode()) != oldFloatingObject->logicalWidth(isHorizontalWritingMode()) || f->logicalLeft(isHorizontalWritingMode()) != oldFloatingObject->logicalLeft(isHorizontalWritingMode())) {
    4795                         changeLogicalTop = 0;
    4796                         changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom));
    4797                     } else {
    4798                         if (logicalBottom != oldLogicalBottom) {
    4799                             changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom));
    4800                             changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom));
    4801                         }
    4802                         LayoutUnit logicalTop = f->logicalTop(isHorizontalWritingMode());
    4803                         LayoutUnit oldLogicalTop = oldFloatingObject->logicalTop(isHorizontalWritingMode());
    4804                         if (logicalTop != oldLogicalTop) {
    4805                             changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop));
    4806                             changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop));
    4807                         }
    4808                     }
    4809 
    4810                     floatMap.remove(f->renderer());
    4811                     if (oldFloatingObject->originatingLine() && !selfNeedsLayout()) {
    4812                         ASSERT(&oldFloatingObject->originatingLine()->renderer() == this);
    4813                         oldFloatingObject->originatingLine()->markDirty();
    4814                     }
    4815                     delete oldFloatingObject;
    4816                 } else {
    4817                     changeLogicalTop = 0;
    4818                     changeLogicalBottom = max(changeLogicalBottom, logicalBottom);
    4819                 }
    4820             }
    4821         }
    4822 
    4823         RendererToFloatInfoMap::iterator end = floatMap.end();
    4824         for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end; ++it) {
    4825             FloatingObject* floatingObject = (*it).value;
    4826             if (!floatingObject->isDescendant()) {
    4827                 changeLogicalTop = 0;
    4828                 changeLogicalBottom = max(changeLogicalBottom, floatingObject->logicalBottom(isHorizontalWritingMode()));
    4829             }
    4830         }
    4831         deleteAllValues(floatMap);
    4832 
    4833         markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom);
    4834     } else if (!oldIntrudingFloatSet.isEmpty()) {
    4835         // If there are previously intruding floats that no longer intrude, then children with floats
    4836         // should also get layout because they might need their floating object lists cleared.
    4837         if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size())
    4838             markAllDescendantsWithFloatsForLayout();
    4839         else {
    4840             const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    4841             FloatingObjectSetIterator end = floatingObjectSet.end();
    4842             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it)
    4843                 oldIntrudingFloatSet.remove((*it)->renderer());
    4844             if (!oldIntrudingFloatSet.isEmpty())
    4845                 markAllDescendantsWithFloatsForLayout();
    4846         }
    48474482    }
    48484483}
     
    82037838}
    82047839
    8205 inline void RenderBlock::FloatingObjects::clear()
     7840// FIXME: Re-inline this once floats move into RenderBlockFlow.
     7841void RenderBlock::FloatingObjects::clear()
    82067842{
    82077843    // FIXME: This should call deleteAllValues, except RenderBlock::clearFloats
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r155374 r155377  
    588588    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
    589589
    590 #if ENABLE(SVG)
    591     // Only used by RenderSVGText, which explicitely overrides RenderBlock::layoutBlock(), do NOT use for anything else.
    592     void forceLayoutInlineChildren()
    593     {
    594         LayoutUnit repaintLogicalTop = 0;
    595         LayoutUnit repaintLogicalBottom = 0;
    596         clearFloats();
    597         layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom);
    598     }
    599 #endif
    600 
    601590    bool updateShapesBeforeBlockLayout();
    602591    void updateShapesAfterBlockLayout(bool heightChanged = false);
     
    652641    virtual void repaintOverhangingFloats(bool paintAllDescendants) OVERRIDE FINAL;
    653642
    654     void layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom);
    655     void layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
    656643    BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*);
    657644
     
    927914    bool positionNewFloats();
    928915
    929     void clearFloats();
    930 
    931916    LayoutUnit getClearDelta(RenderBox* child, LayoutUnit yPos);
    932917
     
    11911176    virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const;
    11921177    RenderRegion* regionAtBlockOffset(LayoutUnit) const;
     1178
     1179    // FIXME: This is temporary to allow us to move code from RenderBlock into RenderBlockFlow that accesses member variables that we haven't moved out of
     1180    // RenderBlock yet.
     1181    friend class RenderBlockFlow;
    11931182
    11941183protected:
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r155374 r155377  
    2525#include "RenderBlockFlow.h"
    2626
     27#include "LayoutRepainter.h"
     28#include "RenderFlowThread.h"
     29#include "RenderLayer.h"
     30#include "RenderView.h"
     31
     32using namespace std;
     33
    2734namespace WebCore {
    2835
     
    3643}
    3744
     45void RenderBlockFlow::clearFloats()
     46{
     47    if (m_floatingObjects)
     48        m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
     49
     50    HashSet<RenderBox*> oldIntrudingFloatSet;
     51    if (!childrenInline() && m_floatingObjects) {
     52        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
     53        FloatingObjectSetIterator end = floatingObjectSet.end();
     54        for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
     55            FloatingObject* floatingObject = *it;
     56            if (!floatingObject->isDescendant())
     57                oldIntrudingFloatSet.add(floatingObject->renderer());
     58        }
     59    }
     60
     61    // Inline blocks are covered by the isReplaced() check in the avoidFloats method.
     62    if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrOutOfFlowPositioned() || isTableCell()) {
     63        if (m_floatingObjects) {
     64            deleteAllValues(m_floatingObjects->set());
     65            m_floatingObjects->clear();
     66        }
     67        if (!oldIntrudingFloatSet.isEmpty())
     68            markAllDescendantsWithFloatsForLayout();
     69        return;
     70    }
     71
     72    typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap;
     73    RendererToFloatInfoMap floatMap;
     74
     75    if (m_floatingObjects) {
     76        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
     77        if (childrenInline()) {
     78            FloatingObjectSetIterator end = floatingObjectSet.end();
     79            for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
     80                FloatingObject* f = *it;
     81                floatMap.add(f->renderer(), f);
     82            }
     83        } else
     84            deleteAllValues(floatingObjectSet);
     85        m_floatingObjects->clear();
     86    }
     87
     88    // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add
     89    // floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
     90    // See <rdar://problem/8049753>, where float property is applied on a text node in a SVG.
     91    if (!parent() || !parent()->isRenderBlock())
     92        return;
     93
     94    // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are
     95    // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
     96    // to avoid floats.
     97    RenderBlock* parentBlock = toRenderBlock(parent());
     98    bool parentHasFloats = false;
     99    RenderObject* prev = previousSibling();
     100    while (prev && (prev->isFloatingOrOutOfFlowPositioned() || !prev->isBox() || !prev->isRenderBlock() || toRenderBlock(prev)->avoidsFloats())) {
     101        if (prev->isFloating())
     102            parentHasFloats = true;
     103        prev = prev->previousSibling();
     104    }
     105
     106    // First add in floats from the parent.
     107    LayoutUnit logicalTopOffset = logicalTop();
     108    if (parentHasFloats)
     109        addIntrudingFloats(parentBlock, parentBlock->logicalLeftOffsetForContent(), logicalTopOffset);
     110   
     111    LayoutUnit logicalLeftOffset = 0;
     112    if (prev)
     113        logicalTopOffset -= toRenderBox(prev)->logicalTop();
     114    else {
     115        prev = parentBlock;
     116        logicalLeftOffset += parentBlock->logicalLeftOffsetForContent();
     117    }
     118
     119    // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.   
     120    RenderBlock* block = toRenderBlock(prev);
     121    if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTopOffset)
     122        addIntrudingFloats(block, logicalLeftOffset, logicalTopOffset);
     123
     124    if (childrenInline()) {
     125        LayoutUnit changeLogicalTop = LayoutUnit::max();
     126        LayoutUnit changeLogicalBottom = LayoutUnit::min();
     127        if (m_floatingObjects) {
     128            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
     129            FloatingObjectSetIterator end = floatingObjectSet.end();
     130            for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
     131                FloatingObject* f = *it;
     132                FloatingObject* oldFloatingObject = floatMap.get(f->renderer());
     133                LayoutUnit logicalBottom = f->logicalBottom(isHorizontalWritingMode());
     134                if (oldFloatingObject) {
     135                    LayoutUnit oldLogicalBottom = oldFloatingObject->logicalBottom(isHorizontalWritingMode());
     136                    if (f->logicalWidth(isHorizontalWritingMode()) != oldFloatingObject->logicalWidth(isHorizontalWritingMode()) || f->logicalLeft(isHorizontalWritingMode()) != oldFloatingObject->logicalLeft(isHorizontalWritingMode())) {
     137                        changeLogicalTop = 0;
     138                        changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom));
     139                    } else {
     140                        if (logicalBottom != oldLogicalBottom) {
     141                            changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom));
     142                            changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom));
     143                        }
     144                        LayoutUnit logicalTop = f->logicalTop(isHorizontalWritingMode());
     145                        LayoutUnit oldLogicalTop = oldFloatingObject->logicalTop(isHorizontalWritingMode());
     146                        if (logicalTop != oldLogicalTop) {
     147                            changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop));
     148                            changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop));
     149                        }
     150                    }
     151
     152                    floatMap.remove(f->renderer());
     153                    if (oldFloatingObject->originatingLine() && !selfNeedsLayout()) {
     154                        ASSERT(&oldFloatingObject->originatingLine()->renderer() == this);
     155                        oldFloatingObject->originatingLine()->markDirty();
     156                    }
     157                    delete oldFloatingObject;
     158                } else {
     159                    changeLogicalTop = 0;
     160                    changeLogicalBottom = max(changeLogicalBottom, logicalBottom);
     161                }
     162            }
     163        }
     164
     165        RendererToFloatInfoMap::iterator end = floatMap.end();
     166        for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end; ++it) {
     167            FloatingObject* floatingObject = (*it).value;
     168            if (!floatingObject->isDescendant()) {
     169                changeLogicalTop = 0;
     170                changeLogicalBottom = max(changeLogicalBottom, floatingObject->logicalBottom(isHorizontalWritingMode()));
     171            }
     172        }
     173        deleteAllValues(floatMap);
     174
     175        markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom);
     176    } else if (!oldIntrudingFloatSet.isEmpty()) {
     177        // If there are previously intruding floats that no longer intrude, then children with floats
     178        // should also get layout because they might need their floating object lists cleared.
     179        if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size())
     180            markAllDescendantsWithFloatsForLayout();
     181        else {
     182            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
     183            FloatingObjectSetIterator end = floatingObjectSet.end();
     184            for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it)
     185                oldIntrudingFloatSet.remove((*it)->renderer());
     186            if (!oldIntrudingFloatSet.isEmpty())
     187                markAllDescendantsWithFloatsForLayout();
     188        }
     189    }
     190}
     191
     192void RenderBlockFlow::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight)
     193{
     194    ASSERT(needsLayout());
     195
     196    if (!relayoutChildren && simplifiedLayout())
     197        return;
     198
     199    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     200
     201    if (updateLogicalWidthAndColumnWidth())
     202        relayoutChildren = true;
     203
     204    clearFloats();
     205
     206    LayoutUnit previousHeight = logicalHeight();
     207    // FIXME: should this start out as borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(),
     208    // for consistency with other render classes?
     209    setLogicalHeight(0);
     210
     211    bool pageLogicalHeightChanged = false;
     212    bool hasSpecifiedPageLogicalHeight = false;
     213    checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightChanged, hasSpecifiedPageLogicalHeight);
     214
     215    RenderStyle* styleToUse = style();
     216    LayoutStateMaintainer statePusher(&view(), this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo());
     217
     218    // Regions changing widths can force us to relayout our children.
     219    RenderFlowThread* flowThread = flowThreadContainingBlock();
     220    if (logicalWidthChangedInRegions(flowThread))
     221        relayoutChildren = true;
     222    if (updateShapesBeforeBlockLayout())
     223        relayoutChildren = true;
     224
     225    // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track
     226    // our current maximal positive and negative margins. These values are used when we
     227    // are collapsed with adjacent blocks, so for example, if you have block A and B
     228    // collapsing together, then you'd take the maximal positive margin from both A and B
     229    // and subtract it from the maximal negative margin from both A and B to get the
     230    // true collapsed margin. This algorithm is recursive, so when we finish layout()
     231    // our block knows its current maximal positive/negative values.
     232    //
     233    // Start out by setting our margin values to our current margins. Table cells have
     234    // no margins, so we don't fill in the values for table cells.
     235    bool isCell = isTableCell();
     236    if (!isCell) {
     237        initMaxMarginValues();
     238       
     239        setHasMarginBeforeQuirk(styleToUse->hasMarginBeforeQuirk());
     240        setHasMarginAfterQuirk(styleToUse->hasMarginAfterQuirk());
     241        setPaginationStrut(0);
     242    }
     243
     244    LayoutUnit repaintLogicalTop = 0;
     245    LayoutUnit repaintLogicalBottom = 0;
     246    LayoutUnit maxFloatLogicalBottom = 0;
     247    if (!firstChild() && !isAnonymousBlock())
     248        setChildrenInline(true);
     249    if (childrenInline())
     250        layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
     251    else
     252        layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
     253
     254    // Expand our intrinsic height to encompass floats.
     255    LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight();
     256    if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats())
     257        setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
     258   
     259    if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher) || relayoutToAvoidWidows(statePusher)) {
     260        ASSERT(!shouldBreakAtLineToAvoidWidow());
     261        return;
     262    }
     263
     264    // Calculate our new height.
     265    LayoutUnit oldHeight = logicalHeight();
     266    LayoutUnit oldClientAfterEdge = clientLogicalBottom();
     267
     268    // Before updating the final size of the flow thread make sure a forced break is applied after the content.
     269    // This ensures the size information is correctly computed for the last auto-height region receiving content.
     270    if (isRenderFlowThread())
     271        toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge);
     272
     273    updateLogicalHeight();
     274    LayoutUnit newHeight = logicalHeight();
     275    if (oldHeight != newHeight) {
     276        if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
     277            // One of our children's floats may have become an overhanging float for us. We need to look for it.
     278            for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     279                if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPositioned()) {
     280                    RenderBlock* block = toRenderBlock(child);
     281                    if (block->lowestFloatLogicalBottom() + block->logicalTop() > newHeight)
     282                        addOverhangingFloats(block, false);
     283                }
     284            }
     285        }
     286    }
     287
     288    bool heightChanged = (previousHeight != newHeight);
     289    if (heightChanged)
     290        relayoutChildren = true;
     291
     292    layoutPositionedObjects(relayoutChildren || isRoot());
     293
     294    updateShapesAfterBlockLayout(heightChanged);
     295
     296    // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
     297    computeOverflow(oldClientAfterEdge);
     298   
     299    statePusher.pop();
     300
     301    fitBorderToLinesIfNeeded();
     302
     303    if (view().layoutState()->m_pageLogicalHeight)
     304        setPageLogicalOffset(view().layoutState()->pageLogicalOffset(this, logicalTop()));
     305
     306    updateLayerTransform();
     307
     308    // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
     309    // we overflow or not.
     310    updateScrollInfoAfterLayout();
     311
     312    // FIXME: This repaint logic should be moved into a separate helper function!
     313    // Repaint with our new bounds if they are different from our old bounds.
     314    bool didFullRepaint = repainter.repaintAfterLayout();
     315    if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (styleToUse->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
     316        // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines
     317        // it had to lay out. We wouldn't need the hasOverflowClip() hack in that case either.
     318        LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow();
     319        LayoutUnit repaintLogicalRight = logicalRightVisualOverflow();
     320        if (hasOverflowClip()) {
     321            // If we have clipped overflow, we should use layout overflow as well, since visual overflow from lines didn't propagate to our block's overflow.
     322            // Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit.
     323            // layoutInlineChildren should be patched to compute the entire repaint rect.
     324            repaintLogicalLeft = min(repaintLogicalLeft, logicalLeftLayoutOverflow());
     325            repaintLogicalRight = max(repaintLogicalRight, logicalRightLayoutOverflow());
     326        }
     327       
     328        LayoutRect repaintRect;
     329        if (isHorizontalWritingMode())
     330            repaintRect = LayoutRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);
     331        else
     332            repaintRect = LayoutRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
     333
     334        // The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union.
     335        adjustRectForColumns(repaintRect);
     336
     337        repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline));
     338       
     339        if (hasOverflowClip()) {
     340            // Adjust repaint rect for scroll offset
     341            repaintRect.move(-scrolledContentOffset());
     342
     343            // Don't allow this rect to spill out of our overflow box.
     344            repaintRect.intersect(LayoutRect(LayoutPoint(), size()));
     345        }
     346
     347        // Make sure the rect is still non-empty after intersecting for overflow above
     348        if (!repaintRect.isEmpty()) {
     349            repaintRectangle(repaintRect); // We need to do a partial repaint of our content.
     350            if (hasReflection())
     351                repaintRectangle(reflectedRect(repaintRect));
     352        }
     353    }
     354
     355    setNeedsLayout(false);
     356}
     357
     358void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom)
     359{
     360    dirtyForLayoutFromPercentageHeightDescendants();
     361
     362    LayoutUnit beforeEdge = borderAndPaddingBefore();
     363    LayoutUnit afterEdge = borderAndPaddingAfter() + scrollbarLogicalHeight();
     364
     365    setLogicalHeight(beforeEdge);
     366   
     367    // Lay out our hypothetical grid line as though it occurs at the top of the block.
     368    if (view().layoutState()->lineGrid() == this)
     369        layoutLineGridBox();
     370
     371    // The margin struct caches all our current margin collapsing state.
     372    MarginInfo marginInfo(this, beforeEdge, afterEdge);
     373
     374    // Fieldsets need to find their legend and position it inside the border of the object.
     375    // The legend then gets skipped during normal layout. The same is true for ruby text.
     376    // It doesn't get included in the normal layout process but is instead skipped.
     377    RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren);
     378
     379    LayoutUnit previousFloatLogicalBottom = 0;
     380    maxFloatLogicalBottom = 0;
     381
     382    RenderBox* next = firstChildBox();
     383
     384    while (next) {
     385        RenderBox* child = next;
     386        next = child->nextSiblingBox();
     387
     388        if (childToExclude == child)
     389            continue; // Skip this child, since it will be positioned by the specialized subclass (fieldsets and ruby runs).
     390
     391        updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
     392
     393        if (child->isOutOfFlowPositioned()) {
     394            child->containingBlock()->insertPositionedObject(child);
     395            adjustPositionedBlock(child, marginInfo);
     396            continue;
     397        }
     398        if (child->isFloating()) {
     399            insertFloatingObject(child);
     400            adjustFloatingBlock(marginInfo);
     401            continue;
     402        }
     403
     404        // Lay out the child.
     405        layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloatLogicalBottom);
     406    }
     407   
     408    // Now do the handling of the bottom of the block, adding in our bottom border/padding and
     409    // determining the correct collapsed bottom margin information.
     410    handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
     411}
     412
    38413} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r155374 r155377  
    3434   
    3535    virtual bool isRenderBlockFlow() const OVERRIDE FINAL { return true; }
     36   
     37    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE;
     38   
     39protected:
     40    // This method is called at the start of layout to wipe away all of the floats in our floating objects list. It also
     41    // repopulates the list with any floats that intrude from previous siblings or parents. Floats that were added by
     42    // descendants are gone when this call completes and will get added back later on after the children have gotten
     43    // a relayout.
     44    void clearFloats();
     45
     46    // RenderBlockFlow always contains either lines or paragraphs. When the children are all blocks (e.g. paragraphs), we call layoutBlockChildren.
     47    // When the children are are all inline (e.g., lines), we call layoutInlineChildren.
     48    void layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom);
     49    void layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
    3650};
    3751
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r155374 r155377  
    21102110}
    21112111
    2112 void RenderBlock::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
     2112void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
    21132113{
    21142114    setLogicalHeight(borderAndPaddingBefore());
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r155374 r155377  
    8484
    8585RenderListBox::RenderListBox(Element* element)
    86     : RenderBlock(element)
     86    : RenderBlockFlow(element)
    8787    , m_optionsChanged(true)
    8888    , m_scrollToRevealSelectionAfterLayout(false)
     
    172172{
    173173    StackStats::LayoutCheckPoint layoutCheckPoint;
    174     RenderBlock::layout();
     174    RenderBlockFlow::layout();
    175175
    176176    if (m_vBar) {
     
    299299
    300300    // Paint the children.
    301     RenderBlock::paintObject(paintInfo, paintOffset);
     301    RenderBlockFlow::paintObject(paintInfo, paintOffset);
    302302
    303303    switch (paintInfo.phase) {
     
    329329{
    330330    if (!isSpatialNavigationEnabled(&frame()))
    331         return RenderBlock::addFocusRingRects(rects, additionalOffset, paintContainer);
     331        return RenderBlockFlow::addFocusRingRects(rects, additionalOffset, paintContainer);
    332332
    333333    HTMLSelectElement* select = selectElement();
     
    698698bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
    699699{
    700     if (!RenderBlock::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction))
     700    if (!RenderBlockFlow::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction))
    701701        return false;
    702702    const Vector<HTMLElement*>& listItems = selectElement()->listItems();
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r154871 r155377  
    3232#define RenderListBox_h
    3333
    34 #include "RenderBlock.h"
     34#include "RenderBlockFlow.h"
    3535#include "ScrollableArea.h"
    3636
     
    3939class HTMLSelectElement;
    4040
    41 class RenderListBox FINAL : public RenderBlock, private ScrollableArea {
     41class RenderListBox FINAL : public RenderBlockFlow, private ScrollableArea {
    4242public:
    4343    explicit RenderListBox(Element*);
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r155211 r155377  
    187187        return;
    188188
    189     RenderBlock::paintObject(paintInfo, paintOffset);
     189    RenderBlockFlow::paintObject(paintInfo, paintOffset);
    190190
    191191    if (!isValid())
     
    277277void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
    278278{
    279     RenderBlock::styleDidChange(diff, oldStyle);
     279    RenderBlockFlow::styleDidChange(diff, oldStyle);
    280280
    281281    // If the region is not attached to any thread, there is no need to check
     
    297297{
    298298    StackStats::LayoutCheckPoint layoutCheckPoint;
    299     RenderBlock::layoutBlock(relayoutChildren);
     299    RenderBlockFlow::layoutBlock(relayoutChildren);
    300300
    301301    if (isValid()) {
     
    554554void RenderRegion::insertedIntoTree()
    555555{
    556     RenderBlock::insertedIntoTree();
     556    RenderBlockFlow::insertedIntoTree();
    557557
    558558    attachRegion();
     
    561561void RenderRegion::willBeRemovedFromTree()
    562562{
    563     RenderBlock::willBeRemovedFromTree();
     563    RenderBlockFlow::willBeRemovedFromTree();
    564564
    565565    detachRegion();
     
    640640{
    641641    if (!isValid()) {
    642         RenderBlock::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
     642        RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
    643643        return;
    644644    }
     
    653653
    654654    if (!isValid()) {
    655         RenderBlock::computePreferredLogicalWidths();
     655        RenderBlockFlow::computePreferredLogicalWidths();
    656656        return;
    657657    }
     
    691691void RenderRegion::updateLogicalHeight()
    692692{
    693     RenderBlock::updateLogicalHeight();
     693    RenderBlockFlow::updateLogicalHeight();
    694694
    695695    if (!hasAutoLogicalHeight())
     
    715715        // Recalculate position of the render block after new logical height is set.
    716716        // (needed in absolute positioning case with bottom alignment for example)
    717         RenderBlock::updateLogicalHeight();
     717        RenderBlockFlow::updateLogicalHeight();
    718718    }
    719719}
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r155374 r155377  
    137137    }
    138138
    139     RenderBlock::layoutBlock(false);
     139    RenderBlockFlow::layoutBlock(false);
    140140
    141141    HTMLElement* container = containerElement();
     
    174174    // If we need another layout pass, we have changed one of children's height so we need to relayout them.
    175175    if (needsLayout())
    176         RenderBlock::layoutBlock(true);
     176        RenderBlockFlow::layoutBlock(true);
    177177
    178178    // Center the child block in the block progression direction (vertical centering for horizontal text fields).
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r155374 r155377  
    415415    FloatRect oldBoundaries = objectBoundingBox();
    416416    ASSERT(childrenInline());
    417     forceLayoutInlineChildren();
     417    LayoutUnit repaintLogicalTop = 0;
     418    LayoutUnit repaintLogicalBottom = 0;
     419    clearFloats();
     420    layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom);
    418421
    419422    if (m_needsReordering)
Note: See TracChangeset for help on using the changeset viewer.