Changeset 92712 in webkit


Ignore:
Timestamp:
Aug 9, 2011 2:52:39 PM (13 years ago)
Author:
eae@chromium.org
Message:

Switch RenderBlock to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=65396

Reviewed by Eric Seidel.

No new tests, no new functionality.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::MarginInfo::MarginInfo):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::addOverflowFromChildren):
(WebCore::RenderBlock::computeOverflow):
(WebCore::RenderBlock::adjustPositionedBlock):
(WebCore::RenderBlock::adjustFloatingBlock):
(WebCore::RenderBlock::collapseMargins):
(WebCore::RenderBlock::clearFloatsIfNeeded):
(WebCore::RenderBlock::estimateLogicalTopPosition):
(WebCore::RenderBlock::determineLogicalLeftPositionForChild):
(WebCore::RenderBlock::setLogicalLeftForChild):
(WebCore::RenderBlock::setLogicalTopForChild):
(WebCore::RenderBlock::layoutBlockChildren):
(WebCore::RenderBlock::layoutBlockChild):
(WebCore::RenderBlock::flipFloatForWritingMode):
(WebCore::RenderBlock::isPointInOverflowControl):
(WebCore::RenderBlock::hitTestFloats):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::logicalTopForFloat):
(WebCore::RenderBlock::logicalBottomForFloat):
(WebCore::RenderBlock::logicalLeftForFloat):
(WebCore::RenderBlock::logicalRightForFloat):
(WebCore::RenderBlock::logicalWidthForFloat):
(WebCore::RenderBlock::setLogicalTopForFloat):
(WebCore::RenderBlock::setLogicalLeftForFloat):
(WebCore::RenderBlock::setLogicalHeightForFloat):
(WebCore::RenderBlock::setLogicalWidthForFloat):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92709 r92712  
     12011-08-09  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch RenderBlock to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=65396
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests, no new functionality.
     9
     10        * rendering/RenderBlock.cpp:
     11        (WebCore::RenderBlock::MarginInfo::MarginInfo):
     12        (WebCore::RenderBlock::layoutBlock):
     13        (WebCore::RenderBlock::addOverflowFromChildren):
     14        (WebCore::RenderBlock::computeOverflow):
     15        (WebCore::RenderBlock::adjustPositionedBlock):
     16        (WebCore::RenderBlock::adjustFloatingBlock):
     17        (WebCore::RenderBlock::collapseMargins):
     18        (WebCore::RenderBlock::clearFloatsIfNeeded):
     19        (WebCore::RenderBlock::estimateLogicalTopPosition):
     20        (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
     21        (WebCore::RenderBlock::setLogicalLeftForChild):
     22        (WebCore::RenderBlock::setLogicalTopForChild):
     23        (WebCore::RenderBlock::layoutBlockChildren):
     24        (WebCore::RenderBlock::layoutBlockChild):
     25        (WebCore::RenderBlock::flipFloatForWritingMode):
     26        (WebCore::RenderBlock::isPointInOverflowControl):
     27        (WebCore::RenderBlock::hitTestFloats):
     28        * rendering/RenderBlock.h:
     29        (WebCore::RenderBlock::logicalTopForFloat):
     30        (WebCore::RenderBlock::logicalBottomForFloat):
     31        (WebCore::RenderBlock::logicalLeftForFloat):
     32        (WebCore::RenderBlock::logicalRightForFloat):
     33        (WebCore::RenderBlock::logicalWidthForFloat):
     34        (WebCore::RenderBlock::setLogicalTopForFloat):
     35        (WebCore::RenderBlock::setLogicalLeftForFloat):
     36        (WebCore::RenderBlock::setLogicalHeightForFloat):
     37        (WebCore::RenderBlock::setLogicalWidthForFloat):
     38
    1392011-08-09  Jeffrey Pfau  <jpfau@apple.com>
    240
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r92696 r92712  
    8282
    8383// Our MarginInfo state used when laying out block children.
    84 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding)
     84RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding)
    8585    : m_atBeforeSideOfBlock(true)
    8686    , m_atAfterSideOfBlock(false)
     
    11671167}
    11681168
    1169 void RenderBlock::layoutBlock(bool relayoutChildren, int pageLogicalHeight, BlockLayoutPass layoutPass)
     1169void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass)
    11701170{
    11711171    ASSERT(needsLayout());
     
    11791179    LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
    11801180
    1181     int oldWidth = logicalWidth();
    1182     int oldColumnWidth = desiredColumnWidth();
     1181    LayoutUnit oldWidth = logicalWidth();
     1182    LayoutUnit oldColumnWidth = desiredColumnWidth();
    11831183
    11841184    computeLogicalWidth();
     
    11971197    clearFloats(floatsLayoutPass);
    11981198
    1199     int previousHeight = logicalHeight();
     1199    LayoutUnit previousHeight = logicalHeight();
    12001200    setLogicalHeight(0);
    12011201    bool hasSpecifiedPageLogicalHeight = false;
     
    12601260    }
    12611261
    1262     int repaintLogicalTop = 0;
    1263     int repaintLogicalBottom = 0;
    1264     int maxFloatLogicalBottom = 0;
     1262    LayoutUnit repaintLogicalTop = 0;
     1263    LayoutUnit repaintLogicalBottom = 0;
     1264    LayoutUnit maxFloatLogicalBottom = 0;
    12651265    if (!firstChild() && !isAnonymousBlock())
    12661266        setChildrenInline(true);
     
    12711271
    12721272    // Expand our intrinsic height to encompass floats.
    1273     int toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight();
     1273    LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight();
    12741274    if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats())
    12751275        setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
     
    12791279 
    12801280    // Calculate our new height.
    1281     int oldHeight = logicalHeight();
    1282     int oldClientAfterEdge = clientLogicalBottom();
     1281    LayoutUnit oldHeight = logicalHeight();
     1282    LayoutUnit oldClientAfterEdge = clientLogicalBottom();
    12831283    computeLogicalHeight();
    1284     int newHeight = logicalHeight();
     1284    LayoutUnit newHeight = logicalHeight();
    12851285    if (oldHeight != newHeight) {
    12861286        if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
     
    13211321        // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines
    13221322        // it had to lay out.  We wouldn't need the hasOverflowClip() hack in that case either.
    1323         int repaintLogicalLeft = logicalLeftVisualOverflow();
    1324         int repaintLogicalRight = logicalRightVisualOverflow();
     1323        LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow();
     1324        LayoutUnit repaintLogicalRight = logicalRightVisualOverflow();
    13251325        if (hasOverflowClip()) {
    13261326            // 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.
     
    13311331        }
    13321332       
    1333         IntRect repaintRect;
     1333        LayoutRect repaintRect;
    13341334        if (isHorizontalWritingMode())
    1335             repaintRect = IntRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);
     1335            repaintRect = LayoutRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);
    13361336        else
    1337             repaintRect = IntRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
     1337            repaintRect = LayoutRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
    13381338
    13391339        // The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union.
     
    13521352        // Make sure the rect is still non-empty after intersecting for overflow above
    13531353        if (!repaintRect.isEmpty()) {
     1354            // FIXME: Might need rounding once we switch to float, see https://bugs.webkit.org/show_bug.cgi?id=64021
    13541355            repaintRectangle(repaintRect); // We need to do a partial repaint of our content.
    13551356            if (hasReflection())
     
    13771378            LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
    13781379            if (isHorizontalWritingMode()) {
    1379                 int overflowLeft = !style()->isLeftToRightDirection() ? min(0, lastRect.x()) : 0;
    1380                 int overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.maxX()) : 0;
    1381                 int overflowHeight = borderBefore() + paddingBefore() + colInfo->columnHeight();
    1382                 addLayoutOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
     1380                LayoutUnit overflowLeft = !style()->isLeftToRightDirection() ? min<LayoutUnit>(0, lastRect.x()) : 0;
     1381                LayoutUnit overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.maxX()) : 0;
     1382                LayoutUnit overflowHeight = borderBefore() + paddingBefore() + colInfo->columnHeight();
     1383                addLayoutOverflow(LayoutRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
    13831384                if (!hasOverflowClip())
    1384                     addVisualOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
     1385                    addVisualOverflow(LayoutRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
    13851386            } else {
    13861387                LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
    1387                 int overflowTop = !style()->isLeftToRightDirection() ? min(0, lastRect.y()) : 0;
    1388                 int overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0;
    1389                 int overflowWidth = borderBefore() + paddingBefore() + colInfo->columnHeight();
    1390                 addLayoutOverflow(IntRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));
     1388                LayoutUnit overflowTop = !style()->isLeftToRightDirection() ? min<LayoutUnit>(0, lastRect.y()) : 0;
     1389                LayoutUnit overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0;
     1390                LayoutUnit overflowWidth = borderBefore() + paddingBefore() + colInfo->columnHeight();
     1391                addLayoutOverflow(LayoutRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));
    13911392                if (!hasOverflowClip())
    1392                     addVisualOverflow(IntRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));
     1393                    addVisualOverflow(LayoutRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));
    13931394            }
    13941395        }
     
    13961397}
    13971398
    1398 void RenderBlock::computeOverflow(int oldClientAfterEdge, bool recomputeFloats)
     1399void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats)
    13991400{
    14001401    // Add overflow from children.
     
    14111412        // and bottom padding.  Set the axis we don't care about to be 1, since we want this overflow to always
    14121413        // be considered reachable.
    1413         IntRect clientRect(clientBoxRect());
    1414         IntRect rectToApply;
     1414        LayoutRect clientRect(clientBoxRect());
     1415        LayoutRect rectToApply;
    14151416        if (isHorizontalWritingMode())
    1416             rectToApply = IntRect(clientRect.x(), clientRect.y(), 1, max(0, oldClientAfterEdge - clientRect.y()));
     1417            rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max(0, oldClientAfterEdge - clientRect.y()));
    14171418        else
    1418             rectToApply = IntRect(clientRect.x(), clientRect.y(), max(0, oldClientAfterEdge - clientRect.x()), 1);
     1419            rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max(0, oldClientAfterEdge - clientRect.x()), 1);
    14191420        addLayoutOverflow(rectToApply);
    14201421    }
     
    14771478    childLayer->setStaticInlinePosition(borderAndPaddingStart());
    14781479
    1479     int logicalTop = logicalHeight();
     1480    LayoutUnit logicalTop = logicalHeight();
    14801481    if (!marginInfo.canCollapseWithMarginBefore()) {
    14811482        child->computeBlockDirectionMargins(this);
    1482         int marginBefore = marginBeforeForChild(child);
    1483         int collapsedBeforePos = marginInfo.positiveMargin();
    1484         int collapsedBeforeNeg = marginInfo.negativeMargin();
     1483        LayoutUnit marginBefore = marginBeforeForChild(child);
     1484        LayoutUnit collapsedBeforePos = marginInfo.positiveMargin();
     1485        LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin();
    14851486        if (marginBefore > 0) {
    14861487            if (marginBefore > collapsedBeforePos)
     
    15141515    // http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for
    15151516    // an example of this scenario.
    1516     int marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin();
     1517    LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin();
    15171518    setLogicalHeight(logicalHeight() + marginOffset);
    15181519    positionNewFloats();
     
    16101611}
    16111612
    1612 int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
     1613LayoutUnit RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
    16131614{
    16141615    // Get the four margin values for the child and cache them.
     
    16161617
    16171618    // Get our max pos and neg top margins.
    1618     int posTop = childMargins.positiveMarginBefore();
    1619     int negTop = childMargins.negativeMarginBefore();
     1619    LayoutUnit posTop = childMargins.positiveMarginBefore();
     1620    LayoutUnit negTop = childMargins.negativeMarginBefore();
    16201621
    16211622    // For self-collapsing blocks, collapse our bottom margins into our
     
    16581659        marginInfo.setMarginBeforeQuirk(topQuirk);
    16591660
    1660     int beforeCollapseLogicalTop = logicalHeight();
    1661     int logicalTop = beforeCollapseLogicalTop;
     1661    LayoutUnit beforeCollapseLogicalTop = logicalHeight();
     1662    LayoutUnit logicalTop = beforeCollapseLogicalTop;
    16621663    if (child->isSelfCollapsingBlock()) {
    16631664        // This child has no height.  We need to compute our
    16641665        // position before we collapse the child's margins together,
    16651666        // so that we can get an accurate position for the zero-height block.
    1666         int collapsedBeforePos = max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore());
    1667         int collapsedBeforeNeg = max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore());
     1667        LayoutUnit collapsedBeforePos = max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore());
     1668        LayoutUnit collapsedBeforeNeg = max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore());
    16681669        marginInfo.setMargin(collapsedBeforePos, collapsedBeforeNeg);
    16691670       
     
    17051706    LayoutState* layoutState = view()->layoutState();
    17061707    if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTop > beforeCollapseLogicalTop) {
    1707         int oldLogicalTop = logicalTop;
     1708        LayoutUnit oldLogicalTop = logicalTop;
    17081709        logicalTop = min(logicalTop, nextPageLogicalTopExcludingBoundaryPoint(beforeCollapseLogicalTop));
    17091710        setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop));
     
    17121713}
    17131714
    1714 int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin, int yPos)
    1715 {
    1716     int heightIncrease = getClearDelta(child, yPos);
     1715LayoutUnit RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin, int yPos)
     1716{
     1717    LayoutUnit heightIncrease = getClearDelta(child, yPos);
    17171718    if (!heightIncrease)
    17181719        return yPos;
     
    17431744        // Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom
    17441745        // of the parent block).
    1745         setLogicalHeight(child->y() - max(0, marginInfo.margin()));
     1746        setLogicalHeight(child->y() - max<LayoutUnit>(0, marginInfo.margin()));
    17461747    } else
    17471748        // Increase our height by the amount we had to clear.
     
    17611762}
    17621763
    1763 int RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo& marginInfo)
     1764LayoutUnit RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo& marginInfo)
    17641765{
    17651766    // FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological
    17661767    // relayout if there are intruding floats.
    1767     int logicalTopEstimate = logicalHeight();
     1768    LayoutUnit logicalTopEstimate = logicalHeight();
    17681769    if (!marginInfo.canCollapseWithMarginBefore()) {
    1769         int childMarginBefore = child->selfNeedsLayout() ? marginBeforeForChild(child) : collapsedMarginBeforeForChild(child);
     1770        LayoutUnit childMarginBefore = child->selfNeedsLayout() ? marginBeforeForChild(child) : collapsedMarginBeforeForChild(child);
    17701771        logicalTopEstimate += max(marginInfo.margin(), childMarginBefore);
    17711772    }
     
    17951796void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
    17961797{
    1797     int startPosition = borderStart() + paddingStart();
    1798     int totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
     1798    LayoutUnit startPosition = borderStart() + paddingStart();
     1799    LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
    17991800
    18001801    // Add in our start margin.
    1801     int childMarginStart = marginStartForChild(child);
    1802     int newPosition = startPosition + childMarginStart;
     1802    LayoutUnit childMarginStart = marginStartForChild(child);
     1803    LayoutUnit newPosition = startPosition + childMarginStart;
    18031804       
    18041805    // Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats.  They need
    18051806    // to shift over as necessary to dodge any floats that might get in the way.
    18061807    if (child->avoidsFloats()) {
    1807         int startOff = style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false);
     1808        LayoutUnit startOff = style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false);
    18081809        if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) {
    18091810            if (childMarginStart < 0)
    18101811                startOff += childMarginStart;
    18111812            newPosition = max(newPosition, startOff); // Let the float sit in the child's margin if it can fit.
     1813        // FIXME: Needs to use epsilon once we switch to float, see https://bugs.webkit.org/show_bug.cgi?id=64021
    18121814        } else if (startOff != startPosition) {
    18131815            // The object is shifting to the "end" side of the block. The object might be centered, so we need to
     
    18621864}
    18631865
    1864 void RenderBlock::setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode applyDelta)
     1866void RenderBlock::setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode applyDelta)
    18651867{
    18661868    if (isHorizontalWritingMode()) {
    18671869        if (applyDelta == ApplyLayoutDelta)
    1868             view()->addLayoutDelta(IntSize(child->x() - logicalLeft, 0));
     1870            view()->addLayoutDelta(LayoutSize(child->x() - logicalLeft, 0));
    18691871        child->setX(logicalLeft);
    18701872    } else {
    18711873        if (applyDelta == ApplyLayoutDelta)
    1872             view()->addLayoutDelta(IntSize(0, child->y() - logicalLeft));
     1874            view()->addLayoutDelta(LayoutSize(0, child->y() - logicalLeft));
    18731875        child->setY(logicalLeft);
    18741876    }
    18751877}
    18761878
    1877 void RenderBlock::setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode applyDelta)
     1879void RenderBlock::setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode applyDelta)
    18781880{
    18791881    if (isHorizontalWritingMode()) {
    18801882        if (applyDelta == ApplyLayoutDelta)
    1881             view()->addLayoutDelta(IntSize(0, child->y() - logicalTop));
     1883            view()->addLayoutDelta(LayoutSize(0, child->y() - logicalTop));
    18821884        child->setY(logicalTop);
    18831885    } else {
    18841886        if (applyDelta == ApplyLayoutDelta)
    1885             view()->addLayoutDelta(IntSize(child->x() - logicalTop, 0));
     1887            view()->addLayoutDelta(LayoutSize(child->x() - logicalTop, 0));
    18861888        child->setX(logicalTop);
    18871889    }
    18881890}
    18891891
    1890 void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatLogicalBottom)
     1892void RenderBlock::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom)
    18911893{
    18921894    if (gPercentHeightDescendantsMap) {
     
    19081910    }
    19091911
    1910     int beforeEdge = borderBefore() + paddingBefore();
    1911     int afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeight();
     1912    LayoutUnit beforeEdge = borderBefore() + paddingBefore();
     1913    LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeight();
    19121914
    19131915    setLogicalHeight(beforeEdge);
     
    19211923    RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren);
    19221924
    1923     int previousFloatLogicalBottom = 0;
     1925    LayoutUnit previousFloatLogicalBottom = 0;
    19241926    maxFloatLogicalBottom = 0;
    19251927
     
    19571959}
    19581960
    1959 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatLogicalBottom, int& maxFloatLogicalBottom)
    1960 {
    1961     int oldPosMarginBefore = maxPositiveMarginBefore();
    1962     int oldNegMarginBefore = maxNegativeMarginBefore();
     1961void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
     1962{
     1963    LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
     1964    LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore();
    19631965
    19641966    // The child is a normal flow object.  Compute the margins we will use for collapsing now.
     
    19741976    // be correct.  Only if we're wrong (when we compute the real logical top position)
    19751977    // will we have to potentially relayout.
    1976     int logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo);
     1978    LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo);
    19771979
    19781980    // Cache our old rect so that we can dirty the proper repaint rects if the child moves.
    1979     IntRect oldRect(child->x(), child->y() , child->width(), child->height());
    1980     int oldLogicalTop = logicalTopForChild(child);
     1981    LayoutRect oldRect(child->x(), child->y() , child->width(), child->height());
     1982    LayoutUnit oldLogicalTop = logicalTopForChild(child);
    19811983
    19821984#ifndef NDEBUG
    1983     IntSize oldLayoutDelta = view()->layoutDelta();
     1985    LayoutSize oldLayoutDelta = view()->layoutDelta();
    19841986#endif
    19851987    // Go ahead and position the child as though it didn't collapse with the top.
     
    19931995        // If an element might be affected by the presence of floats, then always mark it for
    19941996        // layout.
    1995         int fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottomIncludingPositionedFloats());
     1997        LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottomIncludingPositionedFloats());
    19961998        if (fb > logicalTopEstimate)
    19971999            markDescendantsWithFloats = true;
     
    20182020    // Now determine the correct ypos based off examination of collapsing margin
    20192021    // values.
    2020     int logicalTopBeforeClear = collapseMargins(child, marginInfo);
     2022    LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo);
    20212023
    20222024    // Now check for clear.
    2023     int logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
     2025    LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
    20242026   
    20252027    bool paginated = view()->layoutState()->isPaginated();
    20262028    if (paginated) {
    2027         int oldTop = logicalTopAfterClear;
     2029        LayoutUnit oldTop = logicalTopAfterClear;
    20282030       
    20292031        // If the object has a page or column break value of "before", then we should shift to the top of the next page.
     
    20312033   
    20322034        // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one.
    2033         int logicalTopBeforeUnsplittableAdjustment = logicalTopAfterClear;
    2034         int logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, logicalTopAfterClear);
     2035        LayoutUnit logicalTopBeforeUnsplittableAdjustment = logicalTopAfterClear;
     2036        LayoutUnit logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, logicalTopAfterClear);
    20352037       
    2036         int paginationStrut = 0;
    2037         int unsplittableAdjustmentDelta = logicalTopAfterUnsplittableAdjustment - logicalTopBeforeUnsplittableAdjustment;
     2038        LayoutUnit paginationStrut = 0;
     2039        LayoutUnit unsplittableAdjustmentDelta = logicalTopAfterUnsplittableAdjustment - logicalTopBeforeUnsplittableAdjustment;
    20382040        if (unsplittableAdjustmentDelta)
    20392041            paginationStrut = unsplittableAdjustmentDelta;
     
    21002102        maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats(toRenderBlock(child), -child->logicalLeft(), -child->logicalTop(), !childNeededLayout));
    21012103
    2102     IntSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y());
     2104    LayoutSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y());
    21032105    if (childOffset.width() || childOffset.height()) {
    21042106        view()->addLayoutDelta(childOffset);
     
    21182120    if (paginated) {
    21192121        // Check for an after page/column break.
    2120         int newHeight = applyAfterBreak(child, logicalHeight(), marginInfo);
     2122        LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInfo);
    21212123        if (newHeight != height())
    21222124            setLogicalHeight(newHeight);
    21232125    }
    21242126
     2127    // FIXME: Needs to use epsilon once we move to float, see https://bugs.webkit.org/show_bug.cgi?id=64021
    21252128    ASSERT(oldLayoutDelta == view()->layoutDelta());
    21262129}
     
    26102613}
    26112614
    2612 IntPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const IntPoint& point) const
     2615LayoutPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const LayoutPoint& point) const
    26132616{
    26142617    if (!style()->isFlippedBlocksWritingMode())
     
    26192622    // case.
    26202623    if (isHorizontalWritingMode())
    2621         return IntPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child));
    2622     return IntPoint(point.x() + width() - child->width() - 2 * xPositionForFloatIncludingMargin(child), point.y());
     2624        return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child));
     2625    return LayoutPoint(point.x() + width() - child->width() - 2 * xPositionForFloatIncludingMargin(child), point.y());
    26232626}
    26242627
     
    40094012        return false;
    40104013
    4011     return layer()->hitTestOverflowControls(result, pointInContainer - toSize(accumulatedOffset));
     4014    return layer()->hitTestOverflowControls(result, pointInContainer - toLayoutSize(accumulatedOffset));
    40124015}
    40134016
     
    40784081    LayoutPoint adjustedLocation = accumulatedOffset;
    40794082    if (isRenderView()) {
    4080         adjustedLocation += toSize(toRenderView(this)->frameView()->scrollPosition());
     4083        adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scrollPosition());
    40814084    }
    40824085
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r92696 r92712  
    9898
    9999    enum BlockLayoutPass { NormalLayoutPass, PositionedFloatLayoutPass };
    100     virtual void layoutBlock(bool relayoutChildren, int pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
     100    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
    101101
    102102    void insertPositionedObject(RenderBox*);
     
    208208    int logicalTopForChild(RenderBox* child) { return isHorizontalWritingMode() ? child->y() : child->x(); }
    209209    int logicalLeftForChild(RenderBox* child) { return isHorizontalWritingMode() ? child->x() : child->y(); }
    210     void setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
    211     void setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     210    void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     211    void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
    212212    LayoutUnit marginBeforeForChild(RenderBoxModelObject* child) const;
    213213    LayoutUnit marginAfterForChild(RenderBoxModelObject* child) const;
     
    343343    void simplifiedNormalFlowLayout();
    344344
    345     void computeOverflow(int oldClientAfterEdge, bool recomputeFloats = false);
     345    void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
    346346    virtual void addOverflowFromChildren();
    347347    void addOverflowFromFloats();
     
    389389    virtual void repaintOverhangingFloats(bool paintAllDescendants);
    390390
    391     void layoutBlockChildren(bool relayoutChildren, int& maxFloatLogicalBottom);
     391    void layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom);
    392392    void layoutInlineChildren(bool relayoutChildren, int& repaintLogicalTop, int& repaintLogicalBottom);
    393393    BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*);
     
    496496    };
    497497
    498     IntPoint flipFloatForWritingMode(const FloatingObject*, const IntPoint&) const;
    499 
    500     int logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); }
    501     int logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); }
    502     int logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); }
    503     int logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }
    504     int logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
    505     void setLogicalTopForFloat(FloatingObject* child, int logicalTop)
     498    LayoutPoint flipFloatForWritingMode(const FloatingObject*, const LayoutPoint&) const;
     499
     500    LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); }
     501    LayoutUnit logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); }
     502    LayoutUnit logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); }
     503    LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }
     504    LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
     505    void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop)
    506506    {
    507507        if (isHorizontalWritingMode())
     
    510510            child->setX(logicalTop);
    511511    }
    512     void setLogicalLeftForFloat(FloatingObject* child, int logicalLeft)
     512    void setLogicalLeftForFloat(FloatingObject* child, LayoutUnit logicalLeft)
    513513    {
    514514        if (isHorizontalWritingMode())
     
    517517            child->setY(logicalLeft);
    518518    }
    519     void setLogicalHeightForFloat(FloatingObject* child, int logicalHeight)
     519    void setLogicalHeightForFloat(FloatingObject* child, LayoutUnit logicalHeight)
    520520    {
    521521        if (isHorizontalWritingMode())
     
    524524            child->setWidth(logicalHeight);
    525525    }
    526     void setLogicalWidthForFloat(FloatingObject* child, int logicalWidth)
     526    void setLogicalWidthForFloat(FloatingObject* child, LayoutUnit logicalWidth)
    527527    {
    528528        if (isHorizontalWritingMode())
     
    743743
    744744    public:
    745         MarginInfo(RenderBlock* b, int beforeBorderPadding, int afterBorderPadding);
     745        MarginInfo(RenderBlock*, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding);
    746746
    747747        void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; }
     
    772772    };
    773773
    774     void layoutBlockChild(RenderBox* child, MarginInfo&, int& previousFloatLogicalBottom, int& maxFloatLogicalBottom);
     774    void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom);
    775775    void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
    776776    void adjustFloatingBlock(const MarginInfo&);
     
    779779    bool handlePositionedChild(RenderBox* child, const MarginInfo&);
    780780    bool handleRunInChild(RenderBox* child);
    781     int collapseMargins(RenderBox* child, MarginInfo&);
    782     int clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin, int yPos);
    783     int estimateLogicalTopPosition(RenderBox* child, const MarginInfo&);
     781    LayoutUnit collapseMargins(RenderBox* child, MarginInfo&);
     782    LayoutUnit clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin, int yPos);
     783    LayoutUnit estimateLogicalTopPosition(RenderBox* child, const MarginInfo&);
    784784    void determineLogicalLeftPositionForChild(RenderBox* child);
    785785    void handleAfterSideOfBlock(int top, int bottom, MarginInfo&);
Note: See TracChangeset for help on using the changeset viewer.