Changeset 93284 in webkit


Ignore:
Timestamp:
Aug 17, 2011 11:37:30 PM (13 years ago)
Author:
eae@chromium.org
Message:

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

Reviewed by Eric Seidel.

Convert RenderBox to new layout abstraction as a part of the ongoing
conversion work.

No new tests as no new functionality.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::scrollWidth):
(WebCore::RenderBox::scrollHeight):
(WebCore::RenderBox::scrollLeft):
(WebCore::RenderBox::scrollTop):
(WebCore::RenderBox::setScrollLeft):
(WebCore::RenderBox::setScrollTop):
(WebCore::RenderBox::absoluteRects):
(WebCore::RenderBox::absoluteContentBox):
(WebCore::RenderBox::absoluteContentQuad):
(WebCore::RenderBox::outlineBoundsForRepaint):
(WebCore::RenderBox::reflectionBox):
(WebCore::RenderBox::reflectedRect):
(WebCore::RenderBox::verticalScrollbarWidth):
(WebCore::RenderBox::horizontalScrollbarHeight):
(WebCore::RenderBox::computeContentBoxLogicalWidth):
(WebCore::RenderBox::computeContentBoxLogicalHeight):
(WebCore::RenderBox::maskClipRect):
(WebCore::RenderBox::repaintLayerRectsForImage):
(WebCore::RenderBox::pushContentsClip):
(WebCore::RenderBox::overflowClipRect):
(WebCore::RenderBox::clipRect):
(WebCore::RenderBox::containingBlockLogicalWidthForContent):
(WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
(WebCore::RenderBox::positionLineBox):
(WebCore::RenderBox::clippedOverflowRectForRepaint):
(WebCore::RenderBox::computeRectForRepaint):
(WebCore::RenderBox::computeLogicalWidth):
(WebCore::RenderBox::computeInlineDirectionMargins):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeBlockDirectionMargins):
(WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
(WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
(WebCore::computeInlineStaticDistance):
(WebCore::RenderBox::computePositionedLogicalWidth):
(WebCore::computeLogicalLeftPositionedOffset):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::computeBlockStaticDistance):
(WebCore::RenderBox::computePositionedLogicalHeight):
(WebCore::computeLogicalTopPositionedOffset):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::computePositionedLogicalHeightReplaced):
(WebCore::RenderBox::localCaretRect):
(WebCore::RenderBox::lineHeight):
(WebCore::RenderBox::baselinePosition):
(WebCore::RenderBox::logicalVisualOverflowRectForPropagation):
(WebCore::RenderBox::visualOverflowRectForPropagation):
(WebCore::RenderBox::logicalLayoutOverflowRectForPropagation):
(WebCore::RenderBox::layoutOverflowRectForPropagation):
(WebCore::RenderBox::locationOffsetIncludingFlipping):

  • rendering/RenderBox.h:

(WebCore::RenderBox::borderFitAdjust):
(WebCore::RenderBox::intrinsicSize):
(WebCore::RenderBox::intrinsicLogicalWidth):
(WebCore::RenderBox::intrinsicLogicalHeight):
(WebCore::RenderBox::scrollbarLogicalHeight):
(WebCore::RenderBox::controlClipRect):
(WebCore::RenderBox::firstLineBoxBaseline):
(WebCore::RenderBox::lastLineBoxBaseline):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93281 r93284  
     12011-08-17  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch RenderBox to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=66156
     5
     6        Reviewed by Eric Seidel.
     7
     8        Convert RenderBox to new layout abstraction as a part of the ongoing
     9        conversion work.
     10
     11        No new tests as no new functionality.
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::scrollWidth):
     15        (WebCore::RenderBox::scrollHeight):
     16        (WebCore::RenderBox::scrollLeft):
     17        (WebCore::RenderBox::scrollTop):
     18        (WebCore::RenderBox::setScrollLeft):
     19        (WebCore::RenderBox::setScrollTop):
     20        (WebCore::RenderBox::absoluteRects):
     21        (WebCore::RenderBox::absoluteContentBox):
     22        (WebCore::RenderBox::absoluteContentQuad):
     23        (WebCore::RenderBox::outlineBoundsForRepaint):
     24        (WebCore::RenderBox::reflectionBox):
     25        (WebCore::RenderBox::reflectedRect):
     26        (WebCore::RenderBox::verticalScrollbarWidth):
     27        (WebCore::RenderBox::horizontalScrollbarHeight):
     28        (WebCore::RenderBox::computeContentBoxLogicalWidth):
     29        (WebCore::RenderBox::computeContentBoxLogicalHeight):
     30        (WebCore::RenderBox::maskClipRect):
     31        (WebCore::RenderBox::repaintLayerRectsForImage):
     32        (WebCore::RenderBox::pushContentsClip):
     33        (WebCore::RenderBox::overflowClipRect):
     34        (WebCore::RenderBox::clipRect):
     35        (WebCore::RenderBox::containingBlockLogicalWidthForContent):
     36        (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
     37        (WebCore::RenderBox::positionLineBox):
     38        (WebCore::RenderBox::clippedOverflowRectForRepaint):
     39        (WebCore::RenderBox::computeRectForRepaint):
     40        (WebCore::RenderBox::computeLogicalWidth):
     41        (WebCore::RenderBox::computeInlineDirectionMargins):
     42        (WebCore::RenderBox::computeLogicalHeight):
     43        (WebCore::RenderBox::computeLogicalHeightUsing):
     44        (WebCore::RenderBox::computePercentageLogicalHeight):
     45        (WebCore::RenderBox::computeBlockDirectionMargins):
     46        (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
     47        (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
     48        (WebCore::computeInlineStaticDistance):
     49        (WebCore::RenderBox::computePositionedLogicalWidth):
     50        (WebCore::computeLogicalLeftPositionedOffset):
     51        (WebCore::RenderBox::computePositionedLogicalWidthUsing):
     52        (WebCore::computeBlockStaticDistance):
     53        (WebCore::RenderBox::computePositionedLogicalHeight):
     54        (WebCore::computeLogicalTopPositionedOffset):
     55        (WebCore::RenderBox::computePositionedLogicalHeightUsing):
     56        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
     57        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
     58        (WebCore::RenderBox::localCaretRect):
     59        (WebCore::RenderBox::lineHeight):
     60        (WebCore::RenderBox::baselinePosition):
     61        (WebCore::RenderBox::logicalVisualOverflowRectForPropagation):
     62        (WebCore::RenderBox::visualOverflowRectForPropagation):
     63        (WebCore::RenderBox::logicalLayoutOverflowRectForPropagation):
     64        (WebCore::RenderBox::layoutOverflowRectForPropagation):
     65        (WebCore::RenderBox::locationOffsetIncludingFlipping):
     66        * rendering/RenderBox.h:
     67        (WebCore::RenderBox::borderFitAdjust):
     68        (WebCore::RenderBox::intrinsicSize):
     69        (WebCore::RenderBox::intrinsicLogicalWidth):
     70        (WebCore::RenderBox::intrinsicLogicalHeight):
     71        (WebCore::RenderBox::scrollbarLogicalHeight):
     72        (WebCore::RenderBox::controlClipRect):
     73        (WebCore::RenderBox::firstLineBoxBaseline):
     74        (WebCore::RenderBox::lastLineBoxBaseline):
     75
    1762011-08-17  Annie Sullivan  <sullivan@chromium.org>
    277
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r92631 r93284  
    417417}
    418418
    419 int RenderBox::scrollWidth() const
     419LayoutUnit RenderBox::scrollWidth() const
    420420{
    421421    if (hasOverflowClip())
     
    425425    if (style()->isLeftToRightDirection())
    426426        return max(clientWidth(), maxXLayoutOverflow() - borderLeft());
    427     return clientWidth() - min(0, minXLayoutOverflow() - borderLeft());
    428 }
    429 
    430 int RenderBox::scrollHeight() const
     427    return clientWidth() - min<LayoutUnit>(0, minXLayoutOverflow() - borderLeft());
     428}
     429
     430LayoutUnit RenderBox::scrollHeight() const
    431431{
    432432    if (hasOverflowClip())
     
    437437}
    438438
    439 int RenderBox::scrollLeft() const
     439LayoutUnit RenderBox::scrollLeft() const
    440440{
    441441    return hasOverflowClip() ? layer()->scrollXOffset() : 0;
    442442}
    443443
    444 int RenderBox::scrollTop() const
     444LayoutUnit RenderBox::scrollTop() const
    445445{
    446446    return hasOverflowClip() ? layer()->scrollYOffset() : 0;
    447447}
    448448
    449 void RenderBox::setScrollLeft(int newLeft)
     449void RenderBox::setScrollLeft(LayoutUnit newLeft)
    450450{
    451451    if (hasOverflowClip())
     
    453453}
    454454
    455 void RenderBox::setScrollTop(int newTop)
     455void RenderBox::setScrollTop(LayoutUnit newTop)
    456456{
    457457    if (hasOverflowClip())
     
    459459}
    460460
    461 void RenderBox::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
     461void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset)
    462462{
    463463    rects.append(LayoutRect(accumulatedOffset, size()));
     
    476476}
    477477
    478 IntRect RenderBox::absoluteContentBox() const
    479 {
    480     IntRect rect = contentBoxRect();
     478LayoutRect RenderBox::absoluteContentBox() const
     479{
     480    LayoutRect rect = contentBoxRect();
    481481    FloatPoint absPos = localToAbsolute(FloatPoint());
    482482    rect.move(absPos.x(), absPos.y());
     
    486486FloatQuad RenderBox::absoluteContentQuad() const
    487487{
    488     IntRect rect = contentBoxRect();
     488    LayoutRect rect = contentBoxRect();
    489489    return localToAbsoluteQuad(FloatRect(rect));
    490490}
    491491
    492 IntRect RenderBox::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint* cachedOffsetToRepaintContainer) const
    493 {
    494     IntRect box = borderBoundingBox();
     492LayoutRect RenderBox::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, LayoutPoint* cachedOffsetToRepaintContainer) const
     493{
     494    LayoutRect box = borderBoundingBox();
    495495    adjustRectForOutlineAndShadow(box);
    496496
     
    516516}
    517517
    518 IntRect RenderBox::reflectionBox() const
    519 {
    520     IntRect result;
     518LayoutRect RenderBox::reflectionBox() const
     519{
     520    LayoutRect result;
    521521    if (!style()->boxReflect())
    522522        return result;
    523     IntRect box = borderBoxRect();
     523    LayoutRect box = borderBoxRect();
    524524    result = box;
    525525    switch (style()->boxReflect()->direction()) {
     
    549549}
    550550
    551 IntRect RenderBox::reflectedRect(const IntRect& r) const
     551LayoutRect RenderBox::reflectedRect(const LayoutRect& r) const
    552552{
    553553    if (!style()->boxReflect())
    554         return IntRect();
    555 
    556     IntRect box = borderBoxRect();
    557     IntRect result = r;
     554        return LayoutRect();
     555
     556    LayoutRect box = borderBoxRect();
     557    LayoutRect result = r;
    558558    switch (style()->boxReflect()->direction()) {
    559559        case ReflectionBelow:
     
    585585}
    586586
    587 int RenderBox::verticalScrollbarWidth() const
     587LayoutUnit RenderBox::verticalScrollbarWidth() const
    588588{
    589589    return includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0;
    590590}
    591591
    592 int RenderBox::horizontalScrollbarHeight() const
     592LayoutUnit RenderBox::horizontalScrollbarHeight() const
    593593{
    594594    return includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0;
     
    739739    if (style()->boxSizing() == BORDER_BOX)
    740740        width -= borderAndPaddingLogicalWidth();
    741     return max(0, width);
     741    return max<LayoutUnit>(0, width);
    742742}
    743743
     
    746746    if (style()->boxSizing() == BORDER_BOX)
    747747        height -= borderAndPaddingLogicalHeight();
    748     return max(0, height);
     748    return max<LayoutUnit>(0, height);
    749749}
    750750
     
    970970}
    971971
    972 IntRect RenderBox::maskClipRect()
    973 {
    974     IntRect bbox = borderBoxRect();
     972LayoutRect RenderBox::maskClipRect()
     973{
     974    LayoutRect bbox = borderBoxRect();
    975975    if (style()->maskBoxImage().image())
    976976        return bbox;
    977977   
    978     IntRect result;
     978    LayoutRect result;
    979979    for (const FillLayer* maskLayer = style()->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
    980980        if (maskLayer->image()) {
     
    10391039bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground)
    10401040{
    1041     IntRect rendererRect;
     1041    LayoutRect rendererRect;
    10421042    RenderBox* layerRenderer = 0;
    10431043
     
    10511051                    layerRenderer = view();
    10521052
    1053                     int rw;
    1054                     int rh;
     1053                    LayoutUnit rw;
     1054                    LayoutUnit rh;
    10551055
    10561056                    if (FrameView* frameView = toRenderView(layerRenderer)->frameView()) {
     
    10611061                        rh = layerRenderer->height();
    10621062                    }
    1063                     rendererRect = IntRect(-layerRenderer->marginLeft(),
     1063                    rendererRect = LayoutRect(-layerRenderer->marginLeft(),
    10641064                        -layerRenderer->marginTop(),
    10651065                        max(layerRenderer->width() + layerRenderer->marginLeft() + layerRenderer->marginRight() + layerRenderer->borderLeft() + layerRenderer->borderRight(), rw),
     
    11271127    paintInfo.context->save();
    11281128    if (style()->hasBorderRadius())
    1129         paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(accumulatedOffset, size())));
     1129        paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(LayoutRect(accumulatedOffset, size())));
    11301130    paintInfo.context->clip(clipRect);
    11311131    return true;
     
    11451145}
    11461146
    1147 IntRect RenderBox::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy)
     1147LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, OverlayScrollbarSizeRelevancy relevancy)
    11481148{
    11491149    // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
    11501150    // here.
    1151     IntRect clipRect(location + IntSize(borderLeft(), borderTop()),
    1152         size() - IntSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
     1151    LayoutRect clipRect(location + LayoutSize(borderLeft(), borderTop()),
     1152        size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
    11531153
    11541154    // Subtract out scrollbars if we have them.
     
    11591159}
    11601160
    1161 IntRect RenderBox::clipRect(const IntPoint& location)
    1162 {
    1163     IntRect clipRect(location, size());
     1161LayoutRect RenderBox::clipRect(const LayoutPoint& location)
     1162{
     1163    LayoutRect clipRect(location, size());
    11641164    if (!style()->clipLeft().isAuto()) {
    1165         int c = style()->clipLeft().calcValue(width());
     1165        LayoutUnit c = style()->clipLeft().calcValue(width());
    11661166        clipRect.move(c, 0);
    11671167        clipRect.contract(c, 0);
     
    11721172
    11731173    if (!style()->clipTop().isAuto()) {
    1174         int c = style()->clipTop().calcValue(height());
     1174        LayoutUnit c = style()->clipTop().calcValue(height());
    11751175        clipRect.move(0, c);
    11761176        clipRect.contract(0, c);
     
    11831183}
    11841184
    1185 int RenderBox::containingBlockLogicalWidthForContent() const
     1185LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
    11861186{
    11871187    RenderBlock* cb = containingBlock();
     
    11911191}
    11921192
    1193 int RenderBox::perpendicularContainingBlockLogicalHeight() const
     1193LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const
    11941194{
    11951195    RenderBlock* cb = containingBlock();
     
    13671367        box->destroy(renderArena());
    13681368    } else if (isReplaced()) {
    1369         setLocation(roundedIntPoint(FloatPoint(box->x(), box->y())));
     1369        setLocation(roundedLayoutPoint(FloatPoint(box->x(), box->y())));
    13701370        m_inlineBoxWrapper = box;
    13711371    }
     
    13821382}
    13831383
    1384 IntRect RenderBox::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const
     1384LayoutRect RenderBox::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const
    13851385{
    13861386    if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent())
    1387         return IntRect();
    1388 
    1389     IntRect r = visualOverflowRect();
     1387        return LayoutRect();
     1388
     1389    LayoutRect r = visualOverflowRect();
    13901390
    13911391    RenderView* v = view();
     
    14131413}
    14141414
    1415 void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed) const
     1415void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
    14161416{
    14171417    // The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space.
     
    14581458    if (isWritingModeRoot() && !isPositioned())
    14591459        flipForWritingMode(rect);
    1460     IntPoint topLeft = rect.location();
     1460    LayoutPoint topLeft = rect.location();
    14611461    topLeft.move(x(), y());
    14621462
     
    14861486        RenderBlock* cb = toRenderBlock(o);
    14871487        if (cb->hasColumns()) {
    1488             IntRect repaintRect(topLeft, rect.size());
     1488            LayoutRect repaintRect(topLeft, rect.size());
    14891489            cb->adjustRectForColumns(repaintRect);
    14901490            topLeft = repaintRect.location();
     
    15031503        topLeft -= containerBox->layer()->scrolledContentOffset(); // For overflow:auto/scroll/hidden.
    15041504
    1505         IntRect repaintRect(topLeft, rect.size());
    1506         IntRect boxRect(IntPoint(), containerBox->layer()->size());
     1505        LayoutRect repaintRect(topLeft, rect.size());
     1506        LayoutRect boxRect(LayoutPoint(), containerBox->layer()->size());
    15071507        rect = intersection(repaintRect, boxRect);
    15081508        if (rect.isEmpty())
     
    15131513    if (containerSkipped) {
    15141514        // If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates.
    1515         IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
     1515        LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
    15161516        rect.move(-containerOffset);
    15171517        return;
     
    15781578
    15791579    RenderBlock* cb = containingBlock();
    1580     int containerLogicalWidth = max(0, containingBlockLogicalWidthForContent());
     1580    LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContent());
    15811581    bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHorizontalWritingMode();
    1582     int containerWidthInInlineDirection = containerLogicalWidth;
     1582    LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
    15831583    if (hasPerpendicularContainingBlock)
    15841584        containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
     
    15891589        setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
    15901590        if (treatAsReplaced)
    1591             setLogicalWidth(max(logicalWidthLength.value() + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
     1591            setLogicalWidth(max<LayoutUnit>(logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
    15921592        return;
    15931593    }
     
    16021602        // Calculate MaxLogicalWidth
    16031603        if (!style()->logicalMaxWidth().isUndefined()) {
    1604             int maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection);
     1604            LayoutUnit maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection);
    16051605            if (logicalWidth() > maxLogicalWidth) {
    16061606                setLogicalWidth(maxLogicalWidth);
     
    16101610
    16111611        // Calculate MinLogicalWidth
    1612         int minLogicalWidth = computeLogicalWidthUsing(MinLogicalWidth, containerWidthInInlineDirection);
     1612        LayoutUnit minLogicalWidth = computeLogicalWidthUsing(MinLogicalWidth, containerWidthInInlineDirection);
    16131613        if (logicalWidth() < minLogicalWidth) {
    16141614            setLogicalWidth(minLogicalWidth);
     
    17211721    if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth)
    17221722        || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) {
    1723         containingBlock->setMarginStartForChild(this, max(0, (containerWidth - childWidth) / 2));
     1723        containingBlock->setMarginStartForChild(this, max<LayoutUnit>(0, (containerWidth - childWidth) / 2));
    17241724        containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this));
    17251725        return;
     
    18061806        if (checkMinMaxHeight) {
    18071807            heightResult = computeLogicalHeightUsing(style()->logicalHeight());
     1808            // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    18081809            if (heightResult == -1)
    18091810                heightResult = logicalHeight();
     
    18641865        else if (h.isPercent())
    18651866            logicalHeight = computePercentageLogicalHeight(h);
     1867        // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    18661868        if (logicalHeight != -1) {
    18671869            logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
     
    19281930        // We need to recur and compute the percentage height for our containing block.
    19291931        result = cb->computePercentageLogicalHeight(cb->style()->logicalHeight());
     1932        // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    19301933        if (result != -1)
    19311934            result = cb->computeContentBoxLogicalHeight(result);
     
    19421945        result = cb->computeContentBoxLogicalHeight(cb->availableLogicalHeight());
    19431946
     1947    // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    19441948    if (result != -1) {
    19451949        result = height.calcValue(result);
     
    21102114    // Margins are calculated with respect to the logical width of
    21112115    // the containing block (8.3)
    2112     int cw = containingBlockLogicalWidthForContent();
     2116    LayoutUnit cw = containingBlockLogicalWidthForContent();
    21132117
    21142118    RenderStyle* containingBlockStyle = containingBlock->style();
     
    21352139        return 0;
    21362140
    2137     int fromLeft;
    2138     int fromRight;
     2141    LayoutUnit fromLeft;
     2142    LayoutUnit fromRight;
    21392143    if (containingBlock->style()->isLeftToRightDirection()) {
    21402144        fromLeft = first->logicalLeft() + first->borderLogicalLeft();
     
    21452149    }
    21462150
    2147     return max(0, (fromRight - fromLeft));
     2151    return max<LayoutUnit>(0, fromRight - fromLeft);
    21482152}
    21492153
     
    21662170        return 0;
    21672171
    2168     int heightResult;
    2169     IntRect boundingBox = flow->linesBoundingBox();
     2172    LayoutUnit heightResult;
     2173    LayoutRect boundingBox = flow->linesBoundingBox();
    21702174    if (containingBlock->isHorizontalWritingMode())
    21712175        heightResult = boundingBox.height();
     
    21842188    // FIXME: The static distance computation has not been patched for mixed writing modes yet.
    21852189    if (containerDirection == LTR) {
    2186         int staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft();
     2190        LayoutUnit staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft();
    21872191        for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) {
    21882192            if (curr->isBox())
     
    21922196    } else {
    21932197        RenderBox* enclosingBox = child->parent()->enclosingBox();
    2194         int staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalRight();
     2198        LayoutUnit staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalRight();
    21952199        staticPosition -= enclosingBox->logicalWidth();
    21962200        for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->container()) {
     
    22382242    const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
    22392243   
    2240     const int containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
     2244    const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
    22412245
    22422246    // To match WinIE, in quirks mode use the parent's 'direction' property
     
    22452249
    22462250    bool isHorizontal = isHorizontalWritingMode();
    2247     const int bordersPlusPadding = borderAndPaddingLogicalWidth();
     2251    const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
    22482252    const Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop();
    22492253    const Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom();
    2250     int& marginLogicalLeftAlias = isHorizontal ? m_marginLeft : m_marginTop;
    2251     int& marginLogicalRightAlias = isHorizontal ? m_marginRight : m_marginBottom;
     2254    LayoutUnit& marginLogicalLeftAlias = isHorizontal ? m_marginLeft : m_marginTop;
     2255    LayoutUnit& marginLogicalRightAlias = isHorizontal ? m_marginRight : m_marginBottom;
    22522256
    22532257    Length logicalLeft = style()->logicalLeft();
     
    22832287   
    22842288    // Calculate constraint equation values for 'width' case.
    2285     int logicalWidthResult;
    2286     int logicalLeftResult;
     2289    LayoutUnit logicalWidthResult;
     2290    LayoutUnit logicalLeftResult;
    22872291    computePositionedLogicalWidthUsing(style()->logicalWidth(), containerBlock, containerDirection,
    22882292                                       containerLogicalWidth, bordersPlusPadding,
     
    22942298    // Calculate constraint equation values for 'max-width' case.
    22952299    if (!style()->logicalMaxWidth().isUndefined()) {
    2296         int maxLogicalWidth;
    2297         int maxMarginLogicalLeft;
    2298         int maxMarginLogicalRight;
    2299         int maxLogicalLeftPos;
     2300        LayoutUnit maxLogicalWidth;
     2301        LayoutUnit maxMarginLogicalLeft;
     2302        LayoutUnit maxMarginLogicalRight;
     2303        LayoutUnit maxLogicalLeftPos;
    23002304
    23012305        computePositionedLogicalWidthUsing(style()->logicalMaxWidth(), containerBlock, containerDirection,
     
    23142318    // Calculate constraint equation values for 'min-width' case.
    23152319    if (!style()->logicalMinWidth().isZero()) {
    2316         int minLogicalWidth;
    2317         int minMarginLogicalLeft;
    2318         int minMarginLogicalRight;
    2319         int minLogicalLeftPos;
     2320        LayoutUnit minLogicalWidth;
     2321        LayoutUnit minMarginLogicalLeft;
     2322        LayoutUnit minMarginLogicalRight;
     2323        LayoutUnit minLogicalLeftPos;
    23202324
    23212325        computePositionedLogicalWidthUsing(style()->logicalMinWidth(), containerBlock, containerDirection,
     
    23452349}
    23462350
    2347 static void computeLogicalLeftPositionedOffset(int& logicalLeftPos, const RenderBox* child, int logicalWidthValue, const RenderBoxModelObject* containerBlock, int containerLogicalWidth)
     2351static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth)
    23482352{
    23492353    // Deal with differing writing modes here.  Our offset needs to be in the containing block's coordinate space. If the containing block is flipped
     
    23572361
    23582362void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
    2359                                                    int containerLogicalWidth, int bordersPlusPadding,
     2363                                                   LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
    23602364                                                   Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
    2361                                                    int& logicalWidthValue, int& marginLogicalLeftValue, int& marginLogicalRightValue, int& logicalLeftPos)
     2365                                                   LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos)
    23622366{
    23632367    // 'left' and 'right' cannot both be 'auto' because one would of been
     
    23652369    ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
    23662370
    2367     int logicalLeftValue = 0;
     2371    LayoutUnit logicalLeftValue = 0;
    23682372
    23692373    bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto();
     
    23902394        logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
    23912395
    2392         const int availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + logicalRight.calcValue(containerLogicalWidth) + bordersPlusPadding);
     2396        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + logicalRight.calcValue(containerLogicalWidth) + bordersPlusPadding);
    23932397
    23942398        // Margins are now the only unknown
     
    24712475        marginLogicalRightValue = marginLogicalRight.calcMinValue(containerLogicalWidth);
    24722476
    2473         const int availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
     2477        const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
    24742478
    24752479        // FIXME: Is there a faster way to find the correct case?
     
    24772481        if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
    24782482            // RULE 1: (use shrink-to-fit for width, and solve of left)
    2479             int logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     2483            LayoutUnit logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
    24802484
    24812485            // FIXME: would it be better to have shrink-to-fit in one step?
    2482             int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
    2483             int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
    2484             int availableWidth = availableSpace - logicalRightValue;
     2486            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
     2487            LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
     2488            LayoutUnit availableWidth = availableSpace - logicalRightValue;
    24852489            logicalWidthValue = min(max(preferredMinWidth, availableWidth), preferredWidth);
    24862490            logicalLeftValue = availableSpace - (logicalWidthValue + logicalRightValue);
     
    24902494
    24912495            // FIXME: would it be better to have shrink-to-fit in one step?
    2492             int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
    2493             int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
    2494             int availableWidth = availableSpace - logicalLeftValue;
     2496            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
     2497            LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
     2498            LayoutUnit availableWidth = availableSpace - logicalLeftValue;
    24952499            logicalWidthValue = min(max(preferredMinWidth, availableWidth), preferredWidth);
    24962500        } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
     
    25352539   
    25362540    // FIXME: The static distance computation has not been patched for mixed writing modes.
    2537     int staticLogicalTop = child->layer()->staticBlockPosition() - containerBlock->borderBefore();
     2541    LayoutUnit staticLogicalTop = child->layer()->staticBlockPosition() - containerBlock->borderBefore();
    25382542    for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) {
    25392543        if (curr->isBox() && !curr->isTableRow())
     
    25602564    const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
    25612565
    2562     const int containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock);
     2566    const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock);
    25632567
    25642568    bool isHorizontal = isHorizontalWritingMode();
    25652569    bool isFlipped = style()->isFlippedBlocksWritingMode();
    2566     const int bordersPlusPadding = borderAndPaddingLogicalHeight();
     2570    const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
    25672571    const Length marginBefore = style()->marginBefore();
    25682572    const Length marginAfter = style()->marginAfter();
    2569     int& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft);
    2570     int& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight);
     2573    LayoutUnit& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft);
     2574    LayoutUnit& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight);
    25712575
    25722576    Length logicalTop = style()->logicalTop();
     
    25942598    computeBlockStaticDistance(logicalTop, logicalBottom, this, containerBlock);
    25952599
    2596     int logicalHeightResult; // Needed to compute overflow.
    2597     int logicalTopPos;
     2600    LayoutUnit logicalHeightResult; // Needed to compute overflow.
     2601    LayoutUnit logicalTopPos;
    25982602
    25992603    // Calculate constraint equation values for 'height' case.
     
    26082612    // Calculate constraint equation values for 'max-height' case.
    26092613    if (!style()->logicalMaxHeight().isUndefined()) {
    2610         int maxLogicalHeight;
    2611         int maxMarginBefore;
    2612         int maxMarginAfter;
    2613         int maxLogicalTopPos;
     2614        LayoutUnit maxLogicalHeight;
     2615        LayoutUnit maxMarginBefore;
     2616        LayoutUnit maxMarginAfter;
     2617        LayoutUnit maxLogicalTopPos;
    26142618
    26152619        computePositionedLogicalHeightUsing(style()->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
     
    26272631    // Calculate constraint equation values for 'min-height' case.
    26282632    if (!style()->logicalMinHeight().isZero()) {
    2629         int minLogicalHeight;
    2630         int minMarginBefore;
    2631         int minMarginAfter;
    2632         int minLogicalTopPos;
     2633        LayoutUnit minLogicalHeight;
     2634        LayoutUnit minMarginBefore;
     2635        LayoutUnit minMarginAfter;
     2636        LayoutUnit minLogicalTopPos;
    26332637
    26342638        computePositionedLogicalHeightUsing(style()->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
     
    26482652}
    26492653
    2650 static void computeLogicalTopPositionedOffset(int& logicalTopPos, const RenderBox* child, int logicalHeightValue, const RenderBoxModelObject* containerBlock, int containerLogicalHeight)
     2654static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const RenderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight)
    26512655{
    26522656    // Deal with differing writing modes here.  Our offset needs to be in the containing block's coordinate space. If the containing block is flipped
     
    26712675
    26722676void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
    2673                                                     int containerLogicalHeight, int bordersPlusPadding,
     2677                                                    LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding,
    26742678                                                    Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter,
    2675                                                     int& logicalHeightValue, int& marginBeforeValue, int& marginAfterValue, int& logicalTopPos)
     2679                                                    LayoutUnit& logicalHeightValue, LayoutUnit& marginBeforeValue, LayoutUnit& marginAfterValue, LayoutUnit& logicalTopPos)
    26762680{
    26772681    // 'top' and 'bottom' cannot both be 'auto' because 'top would of been
     
    26792683    ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto()));
    26802684
    2681     int contentLogicalHeight = logicalHeight() - bordersPlusPadding;
    2682 
    2683     int logicalTopValue = 0;
     2685    LayoutUnit contentLogicalHeight = logicalHeight() - bordersPlusPadding;
     2686
     2687    LayoutUnit logicalTopValue = 0;
    26842688
    26852689    bool logicalHeightIsAuto = logicalHeightLength.isAuto();
     
    27082712        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    27092713
    2710         const int availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight) + bordersPlusPadding);
     2714        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight) + bordersPlusPadding);
    27112715
    27122716        // Margins are now the only unknown
     
    27592763        marginAfterValue = marginAfter.calcMinValue(containerLogicalHeight);
    27602764
    2761         const int availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding);
     2765        const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding);
    27622766
    27632767        // Use rule/case that applies.
     
    27772781            // RULE 5: (solve of height)
    27782782            logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    2779             logicalHeightValue = max(0, availableSpace - (logicalTopValue + logicalBottom.calcValue(containerLogicalHeight)));
     2783            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + logicalBottom.calcValue(containerLogicalHeight)));
    27802784        } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
    27812785            // RULE 6: (no need solve of bottom)
     
    28022806    const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
    28032807
    2804     const int containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
     2808    const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
    28052809
    28062810    // To match WinIE, in quirks mode use the parent's 'direction' property
     
    28142818    Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop();
    28152819    Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom();
    2816     int& marginLogicalLeftAlias = isHorizontal ? m_marginLeft : m_marginTop;
    2817     int& marginLogicalRightAlias = isHorizontal ? m_marginRight : m_marginBottom;
     2820    LayoutUnit& marginLogicalLeftAlias = isHorizontal ? m_marginLeft : m_marginTop;
     2821    LayoutUnit& marginLogicalRightAlias = isHorizontal ? m_marginRight : m_marginBottom;
    28182822
    28192823    /*-----------------------------------------------------------------------*\
     
    28252829    // correct max/min in the non-replaced version, are not necessary.
    28262830    setLogicalWidth(computeReplacedLogicalWidth() + borderAndPaddingLogicalWidth());
    2827     const int availableSpace = containerLogicalWidth - logicalWidth();
     2831    const LayoutUnit availableSpace = containerLogicalWidth - logicalWidth();
    28282832
    28292833    /*-----------------------------------------------------------------------*\
     
    28542858     *    'margin-right' ('margin-left').
    28552859    \*-----------------------------------------------------------------------*/
    2856     int logicalLeftValue = 0;
    2857     int logicalRightValue = 0;
     2860    LayoutUnit logicalLeftValue = 0;
     2861    LayoutUnit logicalRightValue = 0;
    28582862
    28592863    if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
     
    28642868        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
    28652869
    2866         int difference = availableSpace - (logicalLeftValue + logicalRightValue);
     2870        LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
    28672871        if (difference > 0) {
    28682872            marginLogicalLeftAlias = difference / 2; // split the difference
     
    29272931    // NOTE:  It is not necessary to solve for 'right' when the direction is
    29282932    // LTR because the value is not used.
    2929     int totalLogicalWidth = logicalWidth() + logicalLeftValue + logicalRightValue +  marginLogicalLeftAlias + marginLogicalRightAlias;
     2933    LayoutUnit totalLogicalWidth = logicalWidth() + logicalLeftValue + logicalRightValue +  marginLogicalLeftAlias + marginLogicalRightAlias;
    29302934    if (totalLogicalWidth > containerLogicalWidth && (containerDirection == RTL))
    29312935        logicalLeftValue = containerLogicalWidth - (totalLogicalWidth - logicalLeftValue);
     
    29502954    }
    29512955
    2952     int logicalLeftPos = logicalLeftValue + marginLogicalLeftAlias;
     2956    LayoutUnit logicalLeftPos = logicalLeftValue + marginLogicalLeftAlias;
    29532957    computeLogicalLeftPositionedOffset(logicalLeftPos, this, logicalWidth(), containerBlock, containerLogicalWidth);   
    29542958    setLogicalLeft(logicalLeftPos);
     
    29662970    const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
    29672971
    2968     const int containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock);
     2972    const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock);
    29692973
    29702974    // Variables to solve.
     
    29732977    Length marginBefore = style()->marginBefore();
    29742978    Length marginAfter = style()->marginAfter();
    2975     int& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft);
    2976     int& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight);
     2979    LayoutUnit& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft);
     2980    LayoutUnit& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight);
    29772981
    29782982    Length logicalTop = style()->logicalTop();
     
    29872991    // correct max/min in the non-replaced version, are not necessary.
    29882992    setLogicalHeight(computeReplacedLogicalHeight() + borderAndPaddingLogicalHeight());
    2989     const int availableSpace = containerLogicalHeight - logicalHeight();
     2993    const LayoutUnit availableSpace = containerLogicalHeight - logicalHeight();
    29902994
    29912995    /*-----------------------------------------------------------------------*\
     
    30143018     *    margins must get equal values.
    30153019    \*-----------------------------------------------------------------------*/
    3016     int logicalTopValue = 0;
    3017     int logicalBottomValue = 0;
     3020    LayoutUnit logicalTopValue = 0;
     3021    LayoutUnit logicalBottomValue = 0;
    30183022
    30193023    if (marginBefore.isAuto() && marginAfter.isAuto()) {
     
    30243028        logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
    30253029
    3026         int difference = availableSpace - (logicalTopValue + logicalBottomValue);
     3030        LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
    30273031        // NOTE: This may result in negative values.
    30283032        marginBeforeAlias =  difference / 2; // split the difference
     
    30803084
    30813085    // Use computed values to calculate the vertical position.
    3082     int logicalTopPos = logicalTopValue + marginBeforeAlias;
     3086    LayoutUnit logicalTopPos = logicalTopValue + marginBeforeAlias;
    30833087    computeLogicalTopPositionedOffset(logicalTopPos, this, logicalHeight(), containerBlock, containerLogicalHeight);
    30843088    setLogicalTop(logicalTopPos);
    30853089}
    30863090
    3087 IntRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, int* extraWidthToEndOfLine)
     3091LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
    30883092{
    30893093    // VisiblePositions at offsets inside containers either a) refer to the positions before/after
     
    30933097
    30943098    // FIXME: What about border and padding?
    3095     IntRect rect(x(), y(), caretWidth, height());
     3099    LayoutRect rect(x(), y(), caretWidth, height());
    30963100    bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection();
    30973101
    30983102    if ((!caretOffset) ^ ltr)
    3099         rect.move(IntSize(width() - caretWidth, 0));
     3103        rect.move(LayoutSize(width() - caretWidth, 0));
    31003104
    31013105    if (box) {
    31023106        RootInlineBox* rootBox = box->root();
    3103         int top = rootBox->lineTop();
     3107        LayoutUnit top = rootBox->lineTop();
    31043108        rect.setY(top);
    31053109        rect.setHeight(rootBox->lineBottom() - top);
     
    31143118    //
    31153119    // FIXME: ignoring :first-line, missing good reason to take care of
    3116     int fontHeight = style()->fontMetrics().height();
     3120    LayoutUnit fontHeight = style()->fontMetrics().height();
    31173121    if (fontHeight > rect.height() || (!isReplaced() && !isTable()))
    31183122        rect.setHeight(fontHeight);
     
    33203324}
    33213325
    3322 int RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
     3326LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
    33233327{
    33243328    if (isReplaced())
     
    33273331}
    33283332
    3329 int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
     3333LayoutUnit RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
    33303334{
    33313335    if (isReplaced()) {
    3332         int result = direction == HorizontalLine ? m_marginTop + height() + m_marginBottom : m_marginRight + width() + m_marginLeft;
     3336        LayoutUnit result = direction == HorizontalLine ? m_marginTop + height() + m_marginBottom : m_marginRight + width() + m_marginLeft;
    33333337        if (baselineType == AlphabeticBaseline)
    33343338            return result;
     
    33513355}
    33523356
    3353 IntRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* parentStyle) const
    3354 {
    3355     IntRect rect = visualOverflowRectForPropagation(parentStyle);
     3357LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* parentStyle) const
     3358{
     3359    LayoutRect rect = visualOverflowRectForPropagation(parentStyle);
    33563360    if (!parentStyle->isHorizontalWritingMode())
    33573361        return rect.transposedRect();
     
    33593363}
    33603364
    3361 IntRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle) const
     3365LayoutRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle) const
    33623366{
    33633367    // If the writing modes of the child and parent match, then we don't have to
    33643368    // do anything fancy. Just return the result.
    3365     IntRect rect = visualOverflowRect();
     3369    LayoutRect rect = visualOverflowRect();
    33663370    if (parentStyle->writingMode() == style()->writingMode())
    33673371        return rect;
     
    33773381}
    33783382
    3379 IntRect RenderBox::logicalLayoutOverflowRectForPropagation(RenderStyle* parentStyle) const
    3380 {
    3381     IntRect rect = layoutOverflowRectForPropagation(parentStyle);
     3383LayoutRect RenderBox::logicalLayoutOverflowRectForPropagation(RenderStyle* parentStyle) const
     3384{
     3385    LayoutRect rect = layoutOverflowRectForPropagation(parentStyle);
    33823386    if (!parentStyle->isHorizontalWritingMode())
    33833387        return rect.transposedRect();
     
    33853389}
    33863390
    3387 IntRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) const
     3391LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) const
    33883392{
    33893393    // Only propagate interior layout overflow if we don't clip it.
    3390     IntRect rect = borderBoxRect();
     3394    LayoutRect rect = borderBoxRect();
    33913395    if (!hasOverflowClip())
    33923396        rect.unite(layoutOverflowRect());
     
    34933497}
    34943498
    3495 IntSize RenderBox::locationOffsetIncludingFlipping() const
     3499LayoutSize RenderBox::locationOffsetIncludingFlipping() const
    34963500{
    34973501    RenderBlock* containerBlock = containingBlock();
     
    34993503        return locationOffset();
    35003504   
    3501     IntRect rect(frameRect());
     3505    LayoutRect rect(frameRect());
    35023506    containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object enclosed by a relative-positioned inline.
    3503     return IntSize(rect.x(), rect.y());
     3507    return LayoutSize(rect.x(), rect.y());
    35043508}
    35053509
  • trunk/Source/WebCore/rendering/RenderBox.h

    r92438 r93284  
    128128
    129129    // Bounds of the outline box in absolute coords. Respects transforms
    130     virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, IntPoint* cachedOffsetToRepaintContainer) const;
     130    virtual LayoutRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, LayoutPoint* cachedOffsetToRepaintContainer) const;
    131131    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
    132132
     
    193193    // textareas can scroll shadow content (but pretend that they are the objects that are
    194194    // scrolling).
    195     virtual int scrollLeft() const;
    196     virtual int scrollTop() const;
    197     virtual int scrollWidth() const;
    198     virtual int scrollHeight() const;
    199     virtual void setScrollLeft(int);
    200     virtual void setScrollTop(int);
     195    virtual LayoutUnit scrollLeft() const;
     196    virtual LayoutUnit scrollTop() const;
     197    virtual LayoutUnit scrollWidth() const;
     198    virtual LayoutUnit scrollHeight() const;
     199    virtual void setScrollLeft(LayoutUnit);
     200    virtual void setScrollTop(LayoutUnit);
    201201
    202202    virtual LayoutUnit marginTop() const { return m_marginTop; }
     
    234234    int reflectionOffset() const;
    235235    // Given a rect in the object's coordinate space, returns the corresponding rect in the reflection.
    236     IntRect reflectedRect(const IntRect&) const;
     236    LayoutRect reflectedRect(const LayoutRect&) const;
    237237
    238238    virtual void layout();
     
    256256    LayoutUnit computeContentBoxLogicalHeight(LayoutUnit height) const;
    257257
    258     virtual void borderFitAdjust(IntRect&) const { } // Shrink the box in which the border paints if border-fit is set.
     258    virtual void borderFitAdjust(LayoutRect&) const { } // Shrink the box in which the border paints if border-fit is set.
    259259
    260260    // Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end
     
    277277    void deleteLineBoxWrapper();
    278278
    279     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
    280     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;
     279    virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     280    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
    281281
    282282    virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
    283283
    284     virtual int containingBlockLogicalWidthForContent() const;
    285     int perpendicularContainingBlockLogicalHeight() const;
     284    virtual LayoutUnit containingBlockLogicalWidthForContent() const;
     285    LayoutUnit perpendicularContainingBlockLogicalHeight() const;
    286286   
    287287    virtual void computeLogicalWidth();
     
    293293    }
    294294
    295     virtual IntSize intrinsicSize() const { return IntSize(); }
    296     int intrinsicLogicalWidth() const { return style()->isHorizontalWritingMode() ? intrinsicSize().width() : intrinsicSize().height(); }
    297     int intrinsicLogicalHeight() const { return style()->isHorizontalWritingMode() ? intrinsicSize().height() : intrinsicSize().width(); }
     295    virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
     296    LayoutUnit intrinsicLogicalWidth() const { return style()->isHorizontalWritingMode() ? intrinsicSize().width() : intrinsicSize().height(); }
     297    LayoutUnit intrinsicLogicalHeight() const { return style()->isHorizontalWritingMode() ? intrinsicSize().height() : intrinsicSize().width(); }
    298298
    299299    // Whether or not the element shrinks to its intrinsic width (rather than filling the width
     
    324324    LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode() ? availableLogicalHeight() : availableLogicalWidth(); }
    325325
    326     virtual int verticalScrollbarWidth() const;
    327     int horizontalScrollbarHeight() const;
    328     int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
     326    virtual LayoutUnit verticalScrollbarWidth() const;
     327    LayoutUnit horizontalScrollbarHeight() const;
     328    LayoutUnit scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
    329329    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0);
    330330    virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0);
     
    340340    bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
    341341   
    342     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    343 
    344     virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
    345     IntRect clipRect(const IntPoint& location);
     342    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
     343
     344    virtual LayoutRect overflowClipRect(const LayoutPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
     345    LayoutRect clipRect(const LayoutPoint& location);
    346346    virtual bool hasControlClip() const { return false; }
    347     virtual IntRect controlClipRect(const IntPoint&) const { return IntRect(); }
     347    virtual LayoutRect controlClipRect(const LayoutPoint&) const { return LayoutRect(); }
    348348    bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset);
    349349    void popContentsClip(PaintInfo&, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset);
     
    367367    }
    368368
    369     IntRect maskClipRect();
     369    LayoutRect maskClipRect();
    370370
    371371    virtual VisiblePosition positionForPoint(const LayoutPoint&);
     
    375375    RenderLayer* enclosingFloatPaintingLayer() const;
    376376   
    377     virtual int firstLineBoxBaseline() const { return -1; }
    378     virtual int lastLineBoxBaseline() const { return -1; }
     377    virtual LayoutUnit firstLineBoxBaseline() const { return -1; }
     378    virtual LayoutUnit lastLineBoxBaseline() const { return -1; }
    379379
    380380    bool shrinkToAvoidFloats() const;
     
    387387    bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
    388388   
    389     virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    390     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     389    virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     390    virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    391391
    392392    enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment };
     
    399399    FloatPoint flipForWritingMode(const FloatPoint&) const;
    400400    void flipForWritingMode(FloatRect&) const;
    401     IntSize locationOffsetIncludingFlipping() const;
    402 
    403     IntRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
    404     IntRect visualOverflowRectForPropagation(RenderStyle*) const;
    405     IntRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
    406     IntRect layoutOverflowRectForPropagation(RenderStyle*) const;
     401    LayoutSize locationOffsetIncludingFlipping() const;
     402
     403    LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
     404    LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
     405    LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
     406    LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const;
    407407
    408408    RenderOverflow* hasRenderOverflow() const { return m_overflow.get(); }
     
    451451    void computePositionedLogicalHeight();
    452452    void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
    453                                             int containerLogicalWidth, int bordersPlusPadding,
     453                                            LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
    454454                                            Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
    455                                             int& logicalWidthValue, int& marginLogicalLeftValue, int& marginLogicalRightValue, int& logicalLeftPos);
     455                                            LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos);
    456456    void computePositionedLogicalHeightUsing(Length logicalHeight, const RenderBoxModelObject* containerBlock,
    457                                              int containerLogicalHeight, int bordersPlusPadding,
     457                                             LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding,
    458458                                             Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom,
    459                                              int& logicalHeightValue, int& marginLogicalTopValue, int& marginLogicalBottomValue, int& logicalTopPos);
     459                                             LayoutUnit& logicalHeightValue, LayoutUnit& marginLogicalTopValue, LayoutUnit& marginLogicalBottomValue, LayoutUnit& logicalTopPos);
    460460
    461461    void computePositionedLogicalHeightReplaced();
Note: See TracChangeset for help on using the changeset viewer.