Changeset 40142 in webkit


Ignore:
Timestamp:
Jan 22, 2009 7:42:12 PM (15 years ago)
Author:
hyatt@apple.com
Message:

2009-01-22 David Hyatt <hyatt@apple.com>

Fix for https://bugs.webkit.org/show_bug.cgi?id=23487.

This patch completely reworks vertical alignment of table cells. The current system uses methods called borderTopExtra() and borderBottomExtra() to
add extra space above and below the content of a cell. This system was not confined to the table code and spilled out into all the other RenderObjects.
The y-position of the table cell box was set to the outer edge of the cell, but the y() method of RenderBox lied and added in borderTopExtra(). height()
also excluded the extra space, so did not accurately reflect the true size of the cell.


With the new system, the table cell box is completely accurate. The extra space becomes part of the padding of the cell. Padding has been reworked so that
additional intrinsic padding can be added on to the specified padding from style. Only the table code has to deal with the extra cell padding.

localToAbsoluteForContent has now been removed, since there no longer has to be a special hacked content box.

A number of table layout tests progress with this change, since the new layout system actually fixes existing bugs in baseline alignment of cells.

Reviewed by Oliver Hunt

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Make CSSComputedStyleDeclaration ask for padding values that exclude the built-in intrinsic padding. This ensures that getComputedStyle continues to give the right answer.


  • dom/ContainerNode.cpp: (WebCore::ContainerNode::getLowerRightCorner):
  • editing/visible_units.cpp: (WebCore::previousLinePosition): (WebCore::nextLinePosition):
  • rendering/LayoutState.cpp: (WebCore::LayoutState::LayoutState): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::overflowRect): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::expandsToEncloseOverhangingFloats):
The expandsToEncloseOverhangingFloats logic has been reworked. Table cells and fieldsets did not properly handle floats that spilled into the bottom padding. The
resulting box needed to not only expand to encompass the float, but also needed to place the full bottom padding after the float. The switch to make the extra table cell
space into padding exposed this issue. No extra layout test is required, since an existing table layout test exposes this issue and progresses to match Firefox with
this change.


(WebCore::RenderBlock::selectionGapRects):
(WebCore::RenderBlock::paintSelection):
(WebCore::RenderBlock::fillSelectionGaps):
(WebCore::RenderBlock::nodeAtPoint):
(WebCore::RenderBlock::positionForCoordinates):
(WebCore::RenderBlock::offsetForContents):
Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


  • rendering/RenderBlock.h: Add the new simplified method for expanding to encompass overhanging floats. The method has been devirtualized and made to include all of the cases (and not just a subset).
  • rendering/RenderBox.cpp: (WebCore::RenderBox::absoluteRects): (WebCore::RenderBox::absoluteQuads): (WebCore::RenderBox::absoluteContentBox): (WebCore::RenderBox::paintBoxDecorations): (WebCore::RenderBox::paintMask): (WebCore::RenderBox::getOverflowClipRect): (WebCore::RenderBox::localToAbsolute): (WebCore::RenderBox::absoluteToLocal): (WebCore::RenderBox::localToAbsoluteQuad): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


  • rendering/RenderBox.h: (WebCore::RenderBox::y): (WebCore::RenderBox::location): (WebCore::RenderBox::borderBoxRect): (WebCore::RenderBox::offsetHeight): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
  • rendering/RenderContainer.cpp: (WebCore::RenderContainer::addLineBoxRects):
  • rendering/RenderFieldset.cpp: (WebCore::RenderFieldset::paintBoxDecorations): (WebCore::RenderFieldset::paintMask):
  • rendering/RenderFieldset.h: (WebCore::RenderFieldset::avoidsFloats):
  • rendering/RenderFlow.cpp: (WebCore::RenderFlow::localCaretRect):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPosition): (WebCore::RenderLayer::paintLayer): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::boundingBox):
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::isPointInOverflowControl):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::localToAbsolute): (WebCore::RenderObject::absoluteToLocal): (WebCore::RenderObject::localToAbsoluteQuad): (WebCore::RenderObject::offsetFromContainer): (WebCore::RenderObject::paddingTop): (WebCore::RenderObject::paddingBottom): (WebCore::RenderObject::paddingLeft): (WebCore::RenderObject::paddingRight):
  • rendering/RenderObject.h: (WebCore::RenderObject::hasOverhangingFloats):
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::selectionRect): (WebCore::RenderReplaced::localSelectionRect): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls. Also modifed paddingLeft/Top/Right/Bottom to take an argument indicating whether or not the intrinsic padding of an object should be included (by default it is). getComputedStyle needs to exclude it, which is why this argument is necessary.
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::RenderTableCell): (WebCore::RenderTableCell::paddingTop): (WebCore::RenderTableCell::paddingBottom): The new paddingTop() and paddingBottom() methods on table cells include the extra intrinsic padding.


(WebCore::RenderTableCell::setOverrideSize):
When a table's override size gets altered, the intrinsic padding needs to be cleared.


(WebCore::RenderTableCell::absoluteClippedOverflowRect):
(WebCore::RenderTableCell::computeAbsoluteRepaintRect):
(WebCore::RenderTableCell::baselinePosition):
(WebCore::RenderTableCell::paint):
(WebCore::RenderTableCell::paintBackgroundsBehindCell):
(WebCore::RenderTableCell::paintBoxDecorations):
(WebCore::RenderTableCell::paintMask):
Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


  • rendering/RenderTableCell.h: (WebCore::RenderTableCell::setIntrinsicPaddingTop): (WebCore::RenderTableCell::setIntrinsicPaddingBottom): (WebCore::RenderTableCell::setIntrinsicPadding): (WebCore::RenderTableCell::clearIntrinsicPadding): (WebCore::RenderTableCell::intrinsicPaddingTop): (WebCore::RenderTableCell::intrinsicPaddingBottom): Add new helper methods for getting/setting a cell's intrinsic padding.


  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::calcRowHeight): calcRowHeight has been modified to exclude the intrinsic padding when calculating the base height of rows prior to flexing. Because a cell now includes that extra space, it has to be subtracted out in this method.


(WebCore::RenderTableSection::layoutRows):
Modify the code that sets up the intrinsic padding so that it does a relayout if the intrinsic padding changes. There was also an error where the baseline
position mismatched leading to negative intrinsic padding being added in (this error exists in ToT). The code now properly ignores cells that don't establish
a baseline. A number of tests progress with this change.


  • rendering/RenderText.cpp: (WebCore::RenderText::addLineBoxRects): Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.


  • rendering/RenderTreeAsText.cpp: (WebCore::operator<<): (WebCore::writeTextRun): Modify the render tree dumping code to continue to produce the same results as before. This is really a hack, since we're now capable of indicating the correct position for the descendants of cells with intrinsic padding (and also indicating what the correct cell box is). A future patch can remove these hacks so that the layout test results can all be regenerated.
Location:
trunk/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r40139 r40142  
     12009-01-22  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for https://bugs.webkit.org/show_bug.cgi?id=23487.
     4
     5        This patch completely reworks vertical alignment of table cells.  The current system uses methods called borderTopExtra() and borderBottomExtra() to
     6        add extra space above and below the content of a cell.  This system was not confined to the table code and spilled out into all the other RenderObjects.
     7        The y-position of the table cell box was set to the outer edge of the cell, but the y() method of RenderBox lied and added in borderTopExtra().  height()
     8        also excluded the extra space, so did not accurately reflect the true size of the cell.
     9       
     10        With the new system, the table cell box is completely accurate.  The extra space becomes part of the padding of the cell.  Padding has been reworked so that
     11        additional intrinsic padding can be added on to the specified padding from style.  Only the table code has to deal with the extra cell padding.
     12
     13        localToAbsoluteForContent has now been removed, since there no longer has to be a special hacked content box.
     14
     15        A number of table layout tests progress with this change, since the new layout system actually fixes existing bugs in baseline alignment of cells.
     16
     17        Reviewed by Oliver Hunt
     18
     19        * css/CSSComputedStyleDeclaration.cpp:
     20        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     21        Make CSSComputedStyleDeclaration ask for padding values that exclude the built-in intrinsic padding.  This ensures that getComputedStyle continues
     22        to give the right answer.
     23   
     24        * dom/ContainerNode.cpp:
     25        (WebCore::ContainerNode::getLowerRightCorner):
     26        * editing/visible_units.cpp:
     27        (WebCore::previousLinePosition):
     28        (WebCore::nextLinePosition):
     29        * rendering/LayoutState.cpp:
     30        (WebCore::LayoutState::LayoutState):
     31        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     32       
     33        * rendering/RenderBlock.cpp:
     34        (WebCore::RenderBlock::overflowRect):
     35        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     36       
     37        (WebCore::RenderBlock::layoutBlock):
     38        (WebCore::RenderBlock::expandsToEncloseOverhangingFloats):
     39        The expandsToEncloseOverhangingFloats logic has been reworked.  Table cells and fieldsets did not properly handle floats that spilled into the bottom padding.  The
     40        resulting box needed to not only expand to encompass the float, but also needed to place the full bottom padding after the float.  The switch to make the extra table cell
     41        space into padding exposed this issue.  No extra layout test is required, since an existing table layout test exposes this issue and progresses to match Firefox with
     42        this change.
     43   
     44        (WebCore::RenderBlock::selectionGapRects):
     45        (WebCore::RenderBlock::paintSelection):
     46        (WebCore::RenderBlock::fillSelectionGaps):
     47        (WebCore::RenderBlock::nodeAtPoint):
     48        (WebCore::RenderBlock::positionForCoordinates):
     49        (WebCore::RenderBlock::offsetForContents):
     50        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     51   
     52        * rendering/RenderBlock.h:
     53        Add the new simplified method for expanding to encompass overhanging floats.  The method has been devirtualized and made to include all of the cases (and not just a subset).
     54
     55        * rendering/RenderBox.cpp:
     56        (WebCore::RenderBox::absoluteRects):
     57        (WebCore::RenderBox::absoluteQuads):
     58        (WebCore::RenderBox::absoluteContentBox):
     59        (WebCore::RenderBox::paintBoxDecorations):
     60        (WebCore::RenderBox::paintMask):
     61        (WebCore::RenderBox::getOverflowClipRect):
     62        (WebCore::RenderBox::localToAbsolute):
     63        (WebCore::RenderBox::absoluteToLocal):
     64        (WebCore::RenderBox::localToAbsoluteQuad):
     65        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     66       
     67        * rendering/RenderBox.h:
     68        (WebCore::RenderBox::y):
     69        (WebCore::RenderBox::location):
     70        (WebCore::RenderBox::borderBoxRect):
     71        (WebCore::RenderBox::offsetHeight):
     72        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     73
     74        * rendering/RenderContainer.cpp:
     75        (WebCore::RenderContainer::addLineBoxRects):
     76        * rendering/RenderFieldset.cpp:
     77        (WebCore::RenderFieldset::paintBoxDecorations):
     78        (WebCore::RenderFieldset::paintMask):
     79        * rendering/RenderFieldset.h:
     80        (WebCore::RenderFieldset::avoidsFloats):
     81        * rendering/RenderFlow.cpp:
     82        (WebCore::RenderFlow::localCaretRect):
     83        * rendering/RenderLayer.cpp:
     84        (WebCore::RenderLayer::updateLayerPosition):
     85        (WebCore::RenderLayer::paintLayer):
     86        (WebCore::RenderLayer::hitTestLayer):
     87        (WebCore::RenderLayer::boundingBox):
     88        * rendering/RenderListBox.cpp:
     89        (WebCore::RenderListBox::isPointInOverflowControl):
     90        * rendering/RenderObject.cpp:
     91        (WebCore::RenderObject::localToAbsolute):
     92        (WebCore::RenderObject::absoluteToLocal):
     93        (WebCore::RenderObject::localToAbsoluteQuad):
     94        (WebCore::RenderObject::offsetFromContainer):
     95        (WebCore::RenderObject::paddingTop):
     96        (WebCore::RenderObject::paddingBottom):
     97        (WebCore::RenderObject::paddingLeft):
     98        (WebCore::RenderObject::paddingRight):
     99        * rendering/RenderObject.h:
     100        (WebCore::RenderObject::hasOverhangingFloats):
     101        * rendering/RenderReplaced.cpp:
     102        (WebCore::RenderReplaced::selectionRect):
     103        (WebCore::RenderReplaced::localSelectionRect):
     104        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.  Also modifed paddingLeft/Top/Right/Bottom to take an argument indicating
     105        whether or not the intrinsic padding of an object should be included (by default it is).  getComputedStyle needs to exclude it, which is why this argument is
     106        necessary.
     107
     108        * rendering/RenderTableCell.cpp:
     109        (WebCore::RenderTableCell::RenderTableCell):
     110        (WebCore::RenderTableCell::paddingTop):
     111        (WebCore::RenderTableCell::paddingBottom):
     112        The new paddingTop() and paddingBottom() methods on table cells include the extra intrinsic padding.
     113   
     114        (WebCore::RenderTableCell::setOverrideSize):
     115        When a table's override size gets altered, the intrinsic padding needs to be cleared.
     116       
     117        (WebCore::RenderTableCell::absoluteClippedOverflowRect):
     118        (WebCore::RenderTableCell::computeAbsoluteRepaintRect):
     119        (WebCore::RenderTableCell::baselinePosition):
     120        (WebCore::RenderTableCell::paint):
     121        (WebCore::RenderTableCell::paintBackgroundsBehindCell):
     122        (WebCore::RenderTableCell::paintBoxDecorations):
     123        (WebCore::RenderTableCell::paintMask):
     124        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     125       
     126        * rendering/RenderTableCell.h:
     127        (WebCore::RenderTableCell::setIntrinsicPaddingTop):
     128        (WebCore::RenderTableCell::setIntrinsicPaddingBottom):
     129        (WebCore::RenderTableCell::setIntrinsicPadding):
     130        (WebCore::RenderTableCell::clearIntrinsicPadding):
     131        (WebCore::RenderTableCell::intrinsicPaddingTop):
     132        (WebCore::RenderTableCell::intrinsicPaddingBottom):
     133        Add new helper methods for getting/setting a cell's intrinsic padding.
     134   
     135        * rendering/RenderTableSection.cpp:
     136        (WebCore::RenderTableSection::calcRowHeight):
     137        calcRowHeight has been modified to exclude the intrinsic padding when calculating the base height of rows prior to flexing.  Because a cell now includes that
     138        extra space, it has to be subtracted out in this method.
     139       
     140        (WebCore::RenderTableSection::layoutRows):
     141        Modify the code that sets up the intrinsic padding so that it does a relayout if the intrinsic padding changes.   There was also an error where the baseline
     142        position mismatched leading to negative intrinsic padding being added in (this error exists in ToT).  The code now properly ignores cells that don't establish
     143        a baseline.  A number of tests progress with this change.
     144       
     145        * rendering/RenderText.cpp:
     146        (WebCore::RenderText::addLineBoxRects):
     147        Remove borderTopExtra()/borderBottomExtra() hacks and localToAbsoluteForContent calls.
     148       
     149        * rendering/RenderTreeAsText.cpp:
     150        (WebCore::operator<<):
     151        (WebCore::writeTextRun):
     152        Modify the render tree dumping code to continue to produce the same results as before.  This is really a hack, since we're now capable of indicating the correct
     153        position for the descendants of cells with intrinsic padding (and also indicating what the correct cell box is).  A future patch can remove these hacks so that the
     154        layout test results can all be regenerated.
     155
    11562009-01-22  Eric Seidel  <eric@webkit.org>
    2157
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r40107 r40142  
    864864        case CSSPropertyPaddingTop:
    865865            if (renderer)
    866                 return CSSPrimitiveValue::create(renderer->paddingTop(), CSSPrimitiveValue::CSS_PX);
     866                return CSSPrimitiveValue::create(renderer->paddingTop(false), CSSPrimitiveValue::CSS_PX);
    867867            return CSSPrimitiveValue::create(style->paddingTop());
    868868        case CSSPropertyPaddingRight:
    869869            if (renderer)
    870                 return CSSPrimitiveValue::create(renderer->paddingRight(), CSSPrimitiveValue::CSS_PX);
     870                return CSSPrimitiveValue::create(renderer->paddingRight(false), CSSPrimitiveValue::CSS_PX);
    871871            return CSSPrimitiveValue::create(style->paddingRight());
    872872        case CSSPropertyPaddingBottom:
    873873            if (renderer)
    874                 return CSSPrimitiveValue::create(renderer->paddingBottom(), CSSPrimitiveValue::CSS_PX);
     874                return CSSPrimitiveValue::create(renderer->paddingBottom(false), CSSPrimitiveValue::CSS_PX);
    875875            return CSSPrimitiveValue::create(style->paddingBottom());
    876876        case CSSPropertyPaddingLeft:
    877877            if (renderer)
    878                 return CSSPrimitiveValue::create(renderer->paddingLeft(), CSSPrimitiveValue::CSS_PX);
     878                return CSSPrimitiveValue::create(renderer->paddingLeft(false), CSSPrimitiveValue::CSS_PX);
    879879            return CSSPrimitiveValue::create(style->paddingLeft());
    880880        case CSSPropertyPageBreakAfter:
  • trunk/WebCore/dom/ContainerNode.cpp

    r40107 r40142  
    723723        RenderBox* box = RenderBox::toRenderBox(o);
    724724        point = o->localToAbsolute();
    725         point.move(box->width(),
    726                    box->height() + box->borderTopExtra() + box->borderBottomExtra());
     725        point.move(box->width(), box->height());
    727726        return true;
    728727    }
  • trunk/WebCore/editing/visible_units.cpp

    r38304 r40142  
    495495    if (root) {
    496496        // FIXME: Can be wrong for multi-column layout and with transforms.
    497         FloatPoint absPos = containingBlock->localToAbsoluteForContent(FloatPoint());
     497        FloatPoint absPos = containingBlock->localToAbsolute(FloatPoint());
    498498        if (containingBlock->hasOverflowClip())
    499499            absPos -= containingBlock->layer()->scrolledContentOffset();
     
    596596    if (root) {
    597597        // FIXME: Can be wrong for multi-column layout and with transforms.
    598         FloatPoint absPos = containingBlock->localToAbsoluteForContent(FloatPoint());
     598        FloatPoint absPos = containingBlock->localToAbsolute(FloatPoint());
    599599        if (containingBlock->hasOverflowClip())
    600600            absPos -= containingBlock->layer()->scrolledContentOffset();
  • trunk/WebCore/rendering/LayoutState.cpp

    r39834 r40142  
    8989{
    9090    RenderObject* container = root->container();
    91     FloatPoint absContentPoint = container->localToAbsoluteForContent(FloatPoint(), false, true);
     91    FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true);
    9292    m_offset = IntSize(absContentPoint.x(), absContentPoint.y());
    9393}
  • trunk/WebCore/rendering/RenderBlock.cpp

    r40107 r40142  
    511511        return borderBoxRect();
    512512    int l = overflowLeft(includeInterior);
    513     int t = min(overflowTop(includeInterior), -borderTopExtra());
    514     return IntRect(l, t, overflowWidth(includeInterior) - l, max(overflowHeight(includeInterior), height() + borderBottomExtra()) - t);
     513    int t = overflowTop(includeInterior);
     514    return IntRect(l, t, overflowWidth(includeInterior) - l, max(overflowHeight(includeInterior), height()) - t);
    515515}
    516516
     
    660660    // Expand our intrinsic height to encompass floats.
    661661    int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
    662     if (floatBottom() > (height() - toAdd) && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() ||
    663                                     (parent() && parent()->isFlexibleBox() || m_hasColumns)))
     662    if (floatBottom() > (height() - toAdd) && expandsToEncloseOverhangingFloats())
    664663        setHeight(floatBottom() + toAdd);
    665664   
     
    694693        relayoutChildren = true;
    695694
    696     // Some classes of objects (floats and fieldsets with no specified heights and table cells) expand to encompass
    697     // overhanging floats.
    698     if (hasOverhangingFloats() && expandsToEncloseOverhangingFloats())
    699         setHeight(floatBottom() + borderBottom() + paddingBottom());
    700 
    701695    if ((isCell || isInline() || isFloatingOrPositioned() || isRoot()) && !hasOverflowClip() && !hasControlClip())
    702696        addVisualOverflow(floatRect());
     
    763757    }
    764758    setNeedsLayout(false);
     759}
     760
     761bool RenderBlock::expandsToEncloseOverhangingFloats() const
     762{
     763    return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || m_hasColumns || isTableCell() || isFieldset();
    765764}
    766765
     
    18971896
    18981897    // FIXME: this is broken with transforms
    1899     FloatPoint absContentPoint = localToAbsoluteForContent(FloatPoint());
     1898    FloatPoint absContentPoint = localToAbsolute(FloatPoint());
    19001899    if (hasOverflowClip())
    19011900        absContentPoint -= layer()->scrolledContentOffset();
    19021901
    1903     int lastTop = -borderTopExtra();
     1902    int lastTop = 0;
    19041903    int lastLeft = leftSelectionOffset(this, lastTop);
    19051904    int lastRight = rightSelectionOffset(this, lastTop);
     
    19111910{
    19121911    if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) {
    1913         int lastTop = -borderTopExtra();
     1912        int lastTop = 0;
    19141913        int lastLeft = leftSelectionOffset(this, lastTop);
    19151914        int lastRight = rightSelectionOffset(this, lastTop);
     
    19741973    // Go ahead and fill the vertical gap all the way to the bottom of our block if the selection extends past our block.
    19751974    if (rootBlock == this && (m_selectionState != SelectionBoth && m_selectionState != SelectionEnd))
    1976         result.uniteCenter(fillVerticalSelectionGap(lastTop, lastLeft, lastRight, ty + height() + borderBottomExtra(),
     1975        result.uniteCenter(fillVerticalSelectionGap(lastTop, lastLeft, lastRight, ty + height(),
    19771976                                                    rootBlock, blockX, blockY, paintInfo));
    19781977    return result;
     
    31653164    // Now hit test our background
    31663165    if (!inlineFlow && (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground)) {
    3167         int topExtra = borderTopExtra();
    3168         IntRect boundsRect(tx, ty - topExtra, width(), height() + topExtra + borderBottomExtra());
     3166        IntRect boundsRect(tx, ty, width(), height());
    31693167        if (visibleToHitTesting() && boundsRect.contains(_x, _y)) {
    3170             updateHitTestResult(result, IntPoint(_x - tx, _y - ty + topExtra));
     3168            updateHitTestResult(result, IntPoint(_x - tx, _y - ty));
    31713169            return true;
    31723170        }
     
    32763274
    32773275    int top = borderTop();
    3278     int bottom = top + borderTopExtra() + paddingTop() + contentHeight() + paddingBottom() + borderBottomExtra();
     3276    int bottom = top + paddingTop() + contentHeight() + paddingBottom();
    32793277
    32803278    int left = borderLeft();
     
    33873385void RenderBlock::offsetForContents(int& tx, int& ty) const
    33883386{
    3389     ty -= borderTopExtra();
    3390    
    33913387    if (hasOverflowClip())
    33923388        m_layer->addScrolledContentOffset(tx, ty);
  • trunk/WebCore/rendering/RenderBlock.h

    r40107 r40142  
    332332    int layoutColumns(int endOfContent = -1);
    333333
     334    bool expandsToEncloseOverhangingFloats() const;
     335
    334336protected:
    335337    struct FloatingObject {
  • trunk/WebCore/rendering/RenderBox.cpp

    r40126 r40142  
    357357                                    ty - y() + continuation->containingBlock()->y(), topLevel);
    358358    } else
    359         rects.append(IntRect(tx, ty, width(), height() + borderTopExtra() + borderBottomExtra()));
     359        rects.append(IntRect(tx, ty, width(), height()));
    360360}
    361361
     
    372372        continuation->absoluteQuads(quads, topLevel);
    373373    } else
    374         quads.append(localToAbsoluteQuad(FloatRect(0, 0, width(), height() + borderTopExtra() + borderBottomExtra())));
     374        quads.append(localToAbsoluteQuad(FloatRect(0, 0, width(), height())));
    375375}
    376376
     
    378378{
    379379    IntRect rect = contentBoxRect();
    380     FloatPoint absPos = localToAbsoluteForContent(FloatPoint());
     380    FloatPoint absPos = localToAbsolute(FloatPoint());
    381381    rect.move(absPos.x(), absPos.y());
    382382    return rect;
     
    652652
    653653    int w = width();
    654     int h = height() + borderTopExtra() + borderBottomExtra();
    655     ty -= borderTopExtra();
     654    int h = height();
    656655
    657656    // border-fit can adjust where we paint our border and background.  If set, we snugly fit our line box descendants.  (The iChat
     
    694693
    695694    int w = width();
    696     int h = height() + borderTopExtra() + borderBottomExtra();
    697     ty -= borderTopExtra();
     695    int h = height();
    698696
    699697    // border-fit can adjust where we paint our border and background.  If set, we snugly fit our line box descendants.  (The iChat
     
    11591157    int clipY = ty + bTop;
    11601158    int clipWidth = width() - bLeft - borderRight();
    1161     int clipHeight = height() - bTop - borderBottom() + borderTopExtra() + borderBottomExtra();
     1159    int clipHeight = height() - bTop - borderBottom();
    11621160
    11631161    // Subtract out scrollbars if we have them.
     
    12711269        localPoint += offsetFromContainer(o);
    12721270
    1273         return o->localToAbsoluteForContent(localPoint, fixed, useTransforms);
     1271        return o->localToAbsolute(localPoint, fixed, useTransforms);
    12741272    }
    12751273   
     
    12911289    if (o) {
    12921290        FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTransforms);
    1293 
    1294         // Take into account space above a vertically aligned table cell
    1295         // (see localToAbsoluteForContent())
    1296         localPoint.move(0.0f, -static_cast<float>(borderTopExtra()));
    1297 
    12981291        localPoint -= offsetFromContainer(o);
    1299 
    13001292        if (useTransforms && m_layer && m_layer->transform())
    13011293            localPoint = m_layer->transform()->inverse().mapPoint(localPoint);
    1302        
    13031294        return localPoint;
    13041295    }
     
    13191310            quad = m_layer->transform()->mapQuad(quad);
    13201311        }
    1321 
    13221312        quad += offsetFromContainer(o);
    1323 
    1324         // Take into account space above a vertically aligned table cell
    1325         // (see localToAbsoluteForContent())
    1326         quad.move(0.0f, static_cast<float>(o->borderTopExtra()));
    1327 
    13281313        return o->localToAbsoluteQuad(quad, fixed);
    13291314    }
  • trunk/WebCore/rendering/RenderBox.h

    r40107 r40142  
    4141   
    4242    int x() const { return m_frameRect.x(); }
    43     int y() const { return m_frameRect.y() + borderTopExtra(); } // FIXME: Need to deal with the borderTopExtra() lie in a sane way.
     43    int y() const { return m_frameRect.y(); }
    4444    int width() const { return m_frameRect.width(); }
    4545    int height() const { return m_frameRect.height(); }
     
    5050    void setHeight(int height) { m_frameRect.setHeight(height); }
    5151   
    52     IntPoint location() const { return m_frameRect.location(); } // FIXME: Be aware that this is not equivalent to x(), y() because of y()'s borderTopExtra() lie!
     52    IntPoint location() const { return m_frameRect.location(); }
    5353    IntSize size() const { return m_frameRect.size(); }
    5454
     
    6262    void setFrameRect(const IntRect& rect) { m_frameRect = rect; }
    6363
    64     IntRect borderBoxRect() const { return IntRect(0, -borderTopExtra(), width(), height() + borderTopExtra() + borderBottomExtra()); }
     64    IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }
    6565   
    6666    // The content area of the box (excludes padding and border).
     
    9797    // to return the remaining width on a given line (and the height of a single line).
    9898    virtual int offsetWidth() const { return width(); }
    99     virtual int offsetHeight() const { return height() + borderTopExtra() + borderBottomExtra(); }
     99    virtual int offsetHeight() const { return height(); }
    100100    virtual int offsetLeft() const;
    101101    virtual int offsetTop() const;
  • trunk/WebCore/rendering/RenderContainer.cpp

    r40107 r40142  
    672672{
    673673    if (!m_firstChild && (isInline() || isAnonymousBlock())) {
    674         FloatPoint absPos = localToAbsoluteForContent(FloatPoint());
     674        FloatPoint absPos = localToAbsolute(FloatPoint());
    675675        absoluteRects(rects, absPos.x(), absPos.y());
    676676        return;
     
    683683    for (RenderObject* child = childAt(start); child && offset < end; child = child->nextSibling(), ++offset) {
    684684        if (child->isText() || child->isInline() || child->isAnonymousBlock()) {
    685             FloatPoint absPos = child->localToAbsoluteForContent(FloatPoint());
     685            FloatPoint absPos = child->localToAbsolute(FloatPoint());
    686686            child->absoluteRects(rects, absPos.x(), absPos.y());
    687687        }
  • trunk/WebCore/rendering/RenderFieldset.cpp

    r40107 r40142  
    122122{
    123123    int w = width();
    124     int h = height() + borderTopExtra() + borderBottomExtra();
     124    int h = height();
    125125    RenderBox* legend = findLegend();
    126126    if (!legend)
     
    130130    int legendBottom = ty + legend->y() + legend->height();
    131131    h -= yOff;
    132     ty += yOff - borderTopExtra();
     132    ty += yOff;
    133133
    134134    int my = max(ty, paintInfo.rect.y());
     
    168168
    169169    int w = width();
    170     int h = height() + borderTopExtra() + borderBottomExtra();
     170    int h = height();
    171171    RenderBox* legend = findLegend();
    172172    if (!legend)
     
    175175    int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
    176176    h -= yOff;
    177     ty += yOff - borderTopExtra();
     177    ty += yOff;
    178178
    179179    int my = max(ty, paintInfo.rect.y());
  • trunk/WebCore/rendering/RenderFieldset.h

    r40107 r40142  
    4242    virtual void calcPrefWidths();
    4343    virtual bool avoidsFloats() const { return true; }
    44     virtual bool expandsToEncloseOverhangingFloats() const { return style()->height().isAuto(); }
    4544    virtual bool stretchesToMinIntrinsicWidth() const { return true; }
    4645
  • trunk/WebCore/rendering/RenderFlow.cpp

    r40107 r40142  
    687687            int myRight = x + caretWidth;
    688688            // FIXME: why call localToAbsoluteForContent() twice here, too?
    689             FloatPoint absRightPoint = localToAbsoluteForContent(FloatPoint(myRight, 0));
     689            FloatPoint absRightPoint = localToAbsolute(FloatPoint(myRight, 0));
    690690
    691691            int containerRight = containingBlock()->x() + containingBlockWidth();
    692             FloatPoint absContainerPoint = localToAbsoluteForContent(FloatPoint(containerRight, 0));
     692            FloatPoint absContainerPoint = localToAbsolute(FloatPoint(containerRight, 0));
    693693
    694694            *extraWidthToEndOfLine = absContainerPoint.x() - absRightPoint.x();
  • trunk/WebCore/rendering/RenderLayer.cpp

    r40107 r40142  
    379379
    380380    int x = renderer()->x();
    381     int y = renderer()->y() - renderer()->borderTopExtra();
     381    int y = renderer()->y();
    382382
    383383    if (!renderer()->isPositioned() && renderer()->parent()) {
     
    394394            curr = curr->parentBox();
    395395        }
    396         y += curr->borderTopExtra();
    397396        if (curr->isTableRow()) {
    398397            // Put ourselves into the row coordinate space.
     
    434433    } else {
    435434        setWidth(renderer()->width());
    436         setHeight(renderer()->height() + renderer()->borderTopExtra() + renderer()->borderBottomExtra());
     435        setHeight(renderer()->height());
    437436    }
    438437
     
    17341733    int y = layerBounds.y();
    17351734    int tx = x - renderer()->x();
    1736     int ty = y - renderer()->y() + renderer()->borderTopExtra();
     1735    int ty = y - renderer()->y();
    17371736                             
    17381737    // Ensure our lists are up-to-date.
     
    19581957        renderer()->hitTest(request, result, hitTestPoint,
    19591958                            layerBounds.x() - renderer()->x(),
    1960                             layerBounds.y() - renderer()->y() + renderer()->borderTopExtra(),
     1959                            layerBounds.y() - renderer()->y(),
    19611960                            HitTestDescendants)) {
    19621961        // For positioned generated content, we might still not have a
     
    19881987        renderer()->hitTest(request, result, hitTestPoint,
    19891988                            layerBounds.x() - renderer()->x(),
    1990                             layerBounds.y() - renderer()->y() + renderer()->borderTopExtra(),
     1989                            layerBounds.y() - renderer()->y(),
    19911990                            HitTestSelf)) {
    19921991        if (!result.innerNode() || !result.innerNonSharedNode()) {
     
    22322231            if (child->isTableCell()) {
    22332232                IntRect bbox = RenderBox::toRenderBox(child)->borderBoxRect();
    2234                 bbox.move(0, child->borderTopExtra());
    22352233                result.unite(bbox);
    22362234                IntRect overflowRect = renderer()->overflowRect(false);
    2237                 overflowRect.move(0, child->borderTopExtra());
    22382235                if (bbox != overflowRect)
    22392236                    result.unite(overflowRect);
     
    22532250
    22542251        // We have to adjust the x/y of this result so that it is in the coordinate space of the layer.
    2255         // We also have to add in intrinsicPaddingTop here, since borderBoxRect(), in order to play well with methods like
    2256         // floatRect that deal with child content, uses an origin of (0,0) that is at the child content box (so
    2257         // border box returns a y coord of -borderTopExtra().  The layer, however, uses the outer box.  This is all
    2258         // really confusing.
    2259         result.move(m_x, m_y + renderer()->borderTopExtra());
     2252        result.move(m_x, m_y);
    22602253    }
    22612254   
  • trunk/WebCore/rendering/RenderListBox.cpp

    r40137 r40142  
    371371
    372372    IntRect vertRect(_tx + width() - borderRight() - m_vBar->width(),
    373                    _ty + borderTop() - borderTopExtra(),
    374                    m_vBar->width(),
    375                    height() + borderTopExtra() + borderBottomExtra() - borderTop() - borderBottom());
     373                     _ty,
     374                     m_vBar->width(),
     375                     height() - borderTop() - borderBottom());
    376376
    377377    if (vertRect.contains(_x, _y)) {
  • trunk/WebCore/rendering/RenderObject.cpp

    r40118 r40142  
    22572257    RenderObject* o = parent();
    22582258    if (o) {
    2259         localPoint.move(0.0f, static_cast<float>(o->borderTopExtra()));
    22602259        if (o->hasOverflowClip())
    22612260            localPoint -= o->layer()->scrolledContentOffset();
     
    22712270    if (o) {
    22722271        FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTransforms);
    2273         localPoint.move(0.0f, -static_cast<float>(o->borderTopExtra()));
    22742272        if (o->hasOverflowClip())
    22752273            localPoint += o->layer()->scrolledContentOffset();
     
    22842282    if (o) {
    22852283        FloatQuad quad = localQuad;
    2286         quad.move(0.0f, static_cast<float>(o->borderTopExtra()));
    22872284        if (o->hasOverflowClip())
    22882285            quad -= o->layer()->scrolledContentOffset();
     
    22982295
    22992296    IntSize offset;
    2300     offset.expand(0, o->borderTopExtra());
    2301 
    23022297    if (o->hasOverflowClip())
    23032298        offset -= o->layer()->scrolledContentOffset();
     
    23142309}
    23152310
    2316 int RenderObject::paddingTop() const
     2311int RenderObject::paddingTop(bool) const
    23172312{
    23182313    int w = 0;
     
    23232318}
    23242319
    2325 int RenderObject::paddingBottom() const
     2320int RenderObject::paddingBottom(bool) const
    23262321{
    23272322    int w = 0;
     
    23322327}
    23332328
    2334 int RenderObject::paddingLeft() const
     2329int RenderObject::paddingLeft(bool) const
    23352330{
    23362331    int w = 0;
     
    23412336}
    23422337
    2343 int RenderObject::paddingRight() const
     2338int RenderObject::paddingRight(bool) const
    23442339{
    23452340    int w = 0;
  • trunk/WebCore/rendering/RenderObject.h

    r40118 r40142  
    568568    virtual FloatPoint absoluteToLocal(FloatPoint, bool fixed = false, bool useTransforms = false) const;
    569569
    570     // This function is used to deal with the extra top space that can occur in table cells (called intrinsicPaddingTop).
    571     // The children of the cell do not factor this space in, so we have to add it in.  Any code that wants to
    572     // accurately deal with the contents of a cell must call this function instad of absolutePosition.
    573     FloatPoint localToAbsoluteForContent(FloatPoint localPoint = FloatPoint(), bool fixed = false, bool useTransforms = false) const
    574     {
    575         localPoint.move(0.0f, static_cast<float>(borderTopExtra()));
    576         return localToAbsolute(localPoint, fixed, useTransforms);
    577     }
    578 
    579570    // Convert a local quad to an absolute quad, taking transforms into account.
    580571    virtual FloatQuad localToAbsoluteQuad(const FloatQuad&, bool fixed = false) const;
     
    613604
    614605    // Virtual since table cells override
    615     virtual int paddingTop() const;
    616     virtual int paddingBottom() const;
    617     virtual int paddingLeft() const;
    618     virtual int paddingRight() const;
    619 
    620     virtual int borderTopExtra() const { return 0; }
    621     virtual int borderBottomExtra() const { return 0; }
     606    virtual int paddingTop(bool includeIntrinsicPadding = true) const;
     607    virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
     608    virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
     609    virtual int paddingRight(bool includeIntrinsicPadding = true) const;
    622610
    623611    virtual int borderTop() const { return style()->borderTopWidth(); }
     
    695683    virtual bool containsFloat(RenderObject*) { return false; }
    696684    virtual bool hasOverhangingFloats() { return false; }
    697     virtual bool expandsToEncloseOverhangingFloats() const { return isFloating() && style()->height().isAuto(); }
    698685
    699686    virtual void removePositionedObjects(RenderBlock*) { }
  • trunk/WebCore/rendering/RenderReplaced.cpp

    r40107 r40142  
    255255        computeAbsoluteRepaintRect(rect);
    256256    else {
    257         FloatPoint absPos = localToAbsoluteForContent(FloatPoint());
     257        FloatPoint absPos = localToAbsolute(FloatPoint());
    258258        rect.move(absPos.x(), absPos.y());
    259259    }
     
    269269    if (!m_inlineBoxWrapper)
    270270        // We're a block-level replaced element.  Just return our own dimensions.
    271         return IntRect(0, 0, width(), height() + borderTopExtra() + borderBottomExtra());
     271        return IntRect(0, 0, width(), height());
    272272
    273273    RenderBlock* cb =  containingBlock();
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r40107 r40142  
    4444    , m_rowSpan(1)
    4545    , m_columnSpan(1)
    46     , m_topExtra(0)
    47     , m_bottomExtra(0)
     46    , m_intrinsicPaddingTop(0)
     47    , m_intrinsicPaddingBottom(0)
    4848    , m_widthChanged(false)
    4949    , m_percentageHeight(0)
     
    138138}
    139139
     140int RenderTableCell::paddingTop(bool includeIntrinsicPadding) const
     141{
     142    return RenderBlock::paddingTop() + (includeIntrinsicPadding ? intrinsicPaddingTop() : 0);
     143}
     144
     145int RenderTableCell::paddingBottom(bool includeIntrinsicPadding) const
     146{
     147    return RenderBlock::paddingBottom() + (includeIntrinsicPadding ? intrinsicPaddingBottom() : 0);
     148}
     149
     150void RenderTableCell::setOverrideSize(int size)
     151{
     152    clearIntrinsicPadding();
     153    RenderBlock::setOverrideSize(size);
     154}
     155
    140156IntRect RenderTableCell::absoluteClippedOverflowRect()
    141157{
     
    178194    }
    179195    left = max(left, -overflowLeft(false));
    180     top = max(top, -overflowTop(false) - borderTopExtra());
    181     IntRect r(-left, -borderTopExtra() - top, left + max(width() + right, overflowWidth(false)), borderTopExtra() + top + max(height() + bottom + borderBottomExtra(), overflowHeight(false)));
     196    top = max(top, -overflowTop(false));
     197    IntRect r(-left, - top, left + max(width() + right, overflowWidth(false)), top + max(height() + bottom, overflowHeight(false)));
    182198
    183199    if (RenderView* v = view())
     
    190206void RenderTableCell::computeAbsoluteRepaintRect(IntRect& r, bool fixed)
    191207{
    192     r.setY(r.y() + m_topExtra);
     208    r.setY(r.y());
    193209    RenderView* v = view();
    194210    if ((!v || !v->layoutStateEnabled()) && parent())
     
    232248    // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
    233249    // is no such line box or table-row, the baseline is the bottom of content edge of the cell box.
    234 
    235250    int firstLineBaseline = getBaselineOfFirstLineBox();
    236251    if (firstLineBaseline != -1)
    237252        return firstLineBaseline;
    238 
    239253    return paddingTop() + borderTop() + contentHeight();
    240254}
     
    639653    if (paintInfo.phase == PaintPhaseCollapsedTableBorders && style()->visibility() == VISIBLE) {
    640654        if (ty - table()->outerBorderTop() >= paintInfo.rect.bottom() + os ||
    641                 ty + m_topExtra + height() + m_bottomExtra + table()->outerBorderBottom() <= paintInfo.rect.y() - os)
     655                ty + height() + table()->outerBorderBottom() <= paintInfo.rect.y() - os)
    642656            return;
    643         int w = width();
    644         int h = height() + borderTopExtra() + borderBottomExtra();
    645         paintCollapsedBorder(paintInfo.context, tx, ty, w, h);
     657        paintCollapsedBorder(paintInfo.context, tx, ty, width(), height());
    646658    } else {
    647         if (ty + overflowTop(false) >= paintInfo.rect.bottom() + os || ty + m_topExtra + overflowHeight(false) + m_bottomExtra <= paintInfo.rect.y() - os)
     659        if (ty + overflowTop(false) >= paintInfo.rect.bottom() + os || ty + overflowHeight(false) <= paintInfo.rect.y() - os)
    648660            return;
    649         RenderBlock::paintObject(paintInfo, tx, ty + m_topExtra);
     661        RenderBlock::paintObject(paintInfo, tx, ty);
    650662    }
    651663}
     
    809821    if (backgroundObject != this) {
    810822        tx += x();
    811         ty += m_frameRect.y() + m_topExtra;
     823        ty += m_frameRect.y();
    812824    }
    813825
    814826    int w = width();
    815     int h = height() + borderTopExtra() + borderBottomExtra();
    816     ty -= borderTopExtra();
     827    int h = height();
    817828
    818829    int my = max(ty, paintInfo.rect.y());
     
    846857
    847858    int w = width();
    848     int h = height() + borderTopExtra() + borderBottomExtra();
     859    int h = height();
    849860   
    850861    if (style()->boxShadow())
    851         paintBoxShadow(paintInfo.context, tx, ty - borderTopExtra(), w, h, style());
     862        paintBoxShadow(paintInfo.context, tx, ty, w, h, style());
    852863   
    853864    // Paint our cell background.
     
    857868        return;
    858869
    859     ty -= borderTopExtra();
    860870    paintBorder(paintInfo.context, tx, ty, w, h, style());
    861871}
     
    871881
    872882    int w = width();
    873     int h = height() + borderTopExtra() + borderBottomExtra();
     883    int h = height();
    874884   
    875885    int my = max(ty, paintInfo.rect.y());
  • trunk/WebCore/rendering/RenderTableCell.h

    r40107 r40142  
    6666    void updateWidth(int);
    6767
    68     virtual bool expandsToEncloseOverhangingFloats() const { return true; }
    69 
    7068    int borderLeft() const;
    7169    int borderRight() const;
     
    105103    virtual int baselinePosition(bool firstLine = false, bool isRootLineBox = false) const;
    106104
    107     void setCellTopExtra(int p) { m_topExtra = p; }
    108     void setCellBottomExtra(int p) { m_bottomExtra = p; }
     105    void setIntrinsicPaddingTop(int p) { m_intrinsicPaddingTop = p; }
     106    void setIntrinsicPaddingBottom(int p) { m_intrinsicPaddingBottom = p; }
     107    void setIntrinsicPadding(int top, int bottom) { setIntrinsicPaddingTop(top); setIntrinsicPaddingBottom(bottom); }
     108    void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); }
    109109
    110     virtual int borderTopExtra() const { return m_topExtra; }
    111     virtual int borderBottomExtra() const { return m_bottomExtra; }
     110    int intrinsicPaddingTop() const { return m_intrinsicPaddingTop; }
     111    int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom; }
     112
     113    virtual int paddingTop(bool includeIntrinsicPadding = true) const;
     114    virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
     115
     116    virtual void setOverrideSize(int);
    112117
    113118protected:
     
    120125    int m_rowSpan;
    121126    int m_columnSpan;
    122     int m_topExtra : 31;
    123     int m_bottomExtra : 31;
     127    int m_intrinsicPaddingTop : 31;
     128    int m_intrinsicPaddingBottom : 31;
    124129    bool m_widthChanged : 1;
    125130    int m_percentageHeight;
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r40107 r40142  
    341341            }
    342342           
     343            int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingTop();
     344            int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingBottom();
     345            int adjustedHeight = cell->height() - (cell->intrinsicPaddingTop() + cell->intrinsicPaddingBottom());
     346       
    343347            // Explicit heights use the border box in quirks mode.  In strict mode do the right
    344348            // thing and actually add in the border and padding.
    345349            ch = cell->style()->height().calcValue(0) +
    346                 (cell->style()->htmlHacks() ? 0 : (cell->paddingTop() + cell->paddingBottom() +
     350                (cell->style()->htmlHacks() ? 0 : (adjustedPaddingTop + adjustedPaddingBottom +
    347351                                                   cell->borderTop() + cell->borderBottom()));
    348             ch = max(ch, cell->height());
     352            ch = max(ch, adjustedHeight);
    349353
    350354            pos = m_rowPos[indx] + ch + (m_grid[r].rowRenderer ? spacing : 0);
     
    357361                int b = cell->baselinePosition();
    358362                if (b > cell->borderTop() + cell->paddingTop()) {
    359                     baseline = max(baseline, b);
    360                     bdesc = max(bdesc, m_rowPos[indx] + ch - b);
     363                    baseline = max(baseline, b - cell->intrinsicPaddingTop());
     364                    bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingTop()));
    361365                }
    362366            }
     
    504508                }
    505509            }
     510           
    506511            if (cellChildrenFlex) {
    507512                // Alignment within a cell is based off the calculated
    508513                // height, which becomes irrelevant once the cell has
    509                 // been resized based off its percentage. -dwh
     514                // been resized based off its percentage.
    510515                cell->setOverrideSize(max(0,
    511516                                           rHeight - cell->borderTop() - cell->paddingTop() -
     
    522527            }
    523528           
     529            int oldTe = cell->intrinsicPaddingTop();
     530            int oldBe = cell->intrinsicPaddingBottom();
     531            int heightWithoutIntrinsicPadding = cell->height() - oldTe - oldBe;
     532           
    524533            int te = 0;
    525534            switch (cell->style()->verticalAlign()) {
     
    529538                case TEXT_BOTTOM:
    530539                case BASELINE:
    531                     te = getBaseline(r) - cell->baselinePosition();
     540                    int b = cell->baselinePosition();
     541                    if (b > cell->borderTop() + cell->paddingTop())
     542                        te = getBaseline(r) - (b - oldTe);
    532543                    break;
    533544                case TOP:
     
    535546                    break;
    536547                case MIDDLE:
    537                     te = (rHeight - cell->height()) / 2;
     548                    te = (rHeight - heightWithoutIntrinsicPadding) / 2;
    538549                    break;
    539550                case BOTTOM:
    540                     te = rHeight - cell->height();
     551                    te = rHeight - heightWithoutIntrinsicPadding;
    541552                    break;
    542553                default:
    543554                    break;
    544555            }
    545                
    546             int oldTe = cell->borderTopExtra();
    547             int oldBe = cell->borderBottomExtra();
    548                
    549             int be = rHeight - cell->height() - te;
    550             cell->setCellTopExtra(te);
    551             cell->setCellBottomExtra(be);
     556           
     557            int be = rHeight - heightWithoutIntrinsicPadding - te;
     558            cell->setIntrinsicPaddingTop(te);
     559            cell->setIntrinsicPaddingBottom(be);
     560            if (te != oldTe || be != oldBe) {
     561                cell->setNeedsLayout(true, false);
     562                cell->layoutIfNeeded();
     563            }
     564
    552565            if ((te != oldTe || be > oldBe) && !table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout())
    553566                cell->repaint();
    554567           
    555             IntRect oldCellRect(cell->x(), cell->y() - cell->borderTopExtra() , cell->width(), cell->height());
     568            IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
    556569       
    557570            if (style()->direction() == RTL) {
  • trunk/WebCore/rendering/RenderText.cpp

    r40107 r40142  
    222222    end = min(end, static_cast<unsigned>(INT_MAX));
    223223   
    224     FloatPoint absPos = localToAbsoluteForContent(FloatPoint());
     224    FloatPoint absPos = localToAbsolute(FloatPoint());
    225225
    226226    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
  • trunk/WebCore/rendering/RenderTreeAsText.cpp

    r40107 r40142  
    182182    }
    183183
     184    bool adjustForTableCells = o.containingBlock()->isTableCell();
     185
    184186    IntRect r;
    185187    if (o.isText()) {
     
    188190        const RenderText& text = static_cast<const RenderText&>(o);
    189191        r = IntRect(text.firstRunX(), text.firstRunY(), text.boundingBoxWidth(), text.boundingBoxHeight());
     192        if (adjustForTableCells && !text.firstTextBox())
     193            adjustForTableCells = false;
    190194    } else if (o.isBox()) {
    191195        if (o.isRenderInline()) {
     
    193197            const RenderInline& inlineFlow = static_cast<const RenderInline&>(o);
    194198            r = IntRect(0, 0, inlineFlow.boundingBoxWidth(), inlineFlow.boundingBoxHeight());
    195         } else {
    196             // FIXME: We can't just use the actual frameRect of the box because dump render tree dumps the "inner box" of table cells.
    197             // Because of the lie we have to call y().  We would like to fix dump render tree to dump the actual dimensions of the table
    198             // cell including the extra intrinsic padding.
    199             const RenderBox& box = static_cast<const RenderBox&>(o);
    200             r = IntRect(box.x(), box.y(), box.width(), box.height());
    201         }
    202     }
     199            adjustForTableCells = false;
     200        } else if (o.isTableCell()) {
     201            // FIXME: Deliberately dump the "inner" box of table cells, since that is what current results reflect.  We'd like
     202            // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are
     203            // captured by the results.
     204            const RenderTableCell& cell = static_cast<const RenderTableCell&>(o);
     205            r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingTop(), cell.width(), cell.height() - cell.intrinsicPaddingTop() - cell.intrinsicPaddingBottom());
     206        } else
     207            r = static_cast<const RenderBox&>(o).frameRect();
     208    }
     209
     210    // FIXME: Temporary in order to ensure compatibility with existing layout test results.
     211    if (adjustForTableCells)
     212        r.move(0, -static_cast<RenderTableCell*>(o.containingBlock())->intrinsicPaddingTop());
    203213
    204214    ts << " " << r;
     
    325335static void writeTextRun(TextStream& ts, const RenderText& o, const InlineTextBox& run)
    326336{
    327     ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.m_width;
     337    // FIXME: Table cell adjustment is temporary until results can be updated.
     338    int y = run.m_y;
     339    if (o.containingBlock()->isTableCell())
     340        y -= static_cast<RenderTableCell*>(o.containingBlock())->intrinsicPaddingTop();
     341    ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_width;
    328342    if (run.direction() == RTL || run.m_dirOverride) {
    329343        ts << (run.direction() == RTL ? " RTL" : " LTR");
Note: See TracChangeset for help on using the changeset viewer.