Changeset 13346 in webkit


Ignore:
Timestamp:
Mar 17, 2006 1:50:35 AM (18 years ago)
Author:
hyatt
Message:

Give table rows and sections accurate dimensions. Fix absolutePosition
to work for table cells properly. Add an absolutePositionForContent method
to make sure callers that want to deal with the content of a cell handle
the cell's extra space correctly.

Reviewed by darin

Existing layout tests cover this change.

  • bridge/mac/WebCoreFrameBridge.mm: (-[WebCoreFrameBridge copyRenderNode:copier:]):
  • dom/ContainerNodeImpl.cpp: (WebCore::ContainerNodeImpl::getUpperLeftCorner): (WebCore::ContainerNodeImpl::getLowerRightCorner):
  • dom/NodeImpl.cpp: (WebCore::NodeImpl::getRect):
  • editing/SelectionController.cpp: (WebCore::SelectionController::layout): (WebCore::SelectionController::caretRect):
  • editing/visible_units.cpp: (WebCore::previousLinePosition): (WebCore::nextLinePosition):
  • khtml/html/HTMLInputElementImpl.cpp: (WebCore::HTMLInputElementImpl::defaultEventHandler):
  • kwq/KWQRenderTreeDebug.cpp: (operator<<):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::selectionGapRects): (WebCore::RenderBlock::positionForCoordinates):
  • rendering/RenderContainer.cpp: (WebCore::RenderContainer::positionForCoordinates): (WebCore::RenderContainer::lineBoxRects):
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeAbsoluteRepaintRect): (WebCore::RenderTableCell::absolutePosition):
  • rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): (WebCore::RenderTableRow::getAbsoluteRepaintRect): (WebCore::RenderTableRow::nodeAtPoint):
  • rendering/RenderTableRow.h:
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::ensureRows): (WebCore::RenderTableSection::addCell): (WebCore::RenderTableSection::layoutRows): (WebCore::RenderTableSection::recalcCells): (WebCore::RenderTableSection::nodeAtPoint):
  • rendering/RenderTableSection.h:
  • rendering/RenderText.cpp: (WebCore::RenderText::lineBoxRects): (WebCore::RenderText::positionForCoordinates): (WebCore::RenderText::caretRect): (WebCore::RenderText::posOfChar): (WebCore::RenderText::selectionRect):
  • rendering/render_box.cpp: (WebCore::RenderBox::absolutePosition): (WebCore::RenderBox::caretRect):
  • rendering/render_br.cpp: (WebCore::RenderBR::caretRect):
  • rendering/render_canvas.h:
  • rendering/render_flow.cpp: (WebCore::RenderFlow::caretRect):
  • rendering/render_frames.cpp: (WebCore::RenderPart::updateWidgetPosition):
  • rendering/render_layer.cpp: (WebCore::RenderLayer::updateLayerPosition):
  • rendering/render_object.cpp: (WebCore::RenderObject::absoluteRects): (WebCore::RenderObject::absoluteBoundingBoxRect): (WebCore::RenderObject::absolutePosition):
  • rendering/render_object.h: (WebCore::RenderObject::absolutePositionForContent): (WebCore::RenderObject::offsetHeight):
  • rendering/render_replaced.cpp: (WebCore::RenderWidget::updateWidgetPosition):
Location:
trunk/WebCore
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r13344 r13346  
     12006-03-17  David Hyatt  <hyatt@apple.com>
     2
     3        Give table rows and sections accurate dimensions.  Fix absolutePosition
     4        to work for table cells properly.  Add an absolutePositionForContent method
     5        to make sure callers that want to deal with the content of a cell handle
     6        the cell's extra space correctly.
     7
     8        Reviewed by darin
     9
     10        Existing layout tests cover this change.
     11
     12        * bridge/mac/WebCoreFrameBridge.mm:
     13        (-[WebCoreFrameBridge copyRenderNode:copier:]):
     14        * dom/ContainerNodeImpl.cpp:
     15        (WebCore::ContainerNodeImpl::getUpperLeftCorner):
     16        (WebCore::ContainerNodeImpl::getLowerRightCorner):
     17        * dom/NodeImpl.cpp:
     18        (WebCore::NodeImpl::getRect):
     19        * editing/SelectionController.cpp:
     20        (WebCore::SelectionController::layout):
     21        (WebCore::SelectionController::caretRect):
     22        * editing/visible_units.cpp:
     23        (WebCore::previousLinePosition):
     24        (WebCore::nextLinePosition):
     25        * khtml/html/HTMLInputElementImpl.cpp:
     26        (WebCore::HTMLInputElementImpl::defaultEventHandler):
     27        * kwq/KWQRenderTreeDebug.cpp:
     28        (operator<<):
     29        * rendering/RenderBlock.cpp:
     30        (WebCore::RenderBlock::selectionGapRects):
     31        (WebCore::RenderBlock::positionForCoordinates):
     32        * rendering/RenderContainer.cpp:
     33        (WebCore::RenderContainer::positionForCoordinates):
     34        (WebCore::RenderContainer::lineBoxRects):
     35        * rendering/RenderTableCell.cpp:
     36        (WebCore::RenderTableCell::computeAbsoluteRepaintRect):
     37        (WebCore::RenderTableCell::absolutePosition):
     38        * rendering/RenderTableRow.cpp:
     39        (WebCore::RenderTableRow::addChild):
     40        (WebCore::RenderTableRow::getAbsoluteRepaintRect):
     41        (WebCore::RenderTableRow::nodeAtPoint):
     42        * rendering/RenderTableRow.h:
     43        * rendering/RenderTableSection.cpp:
     44        (WebCore::RenderTableSection::ensureRows):
     45        (WebCore::RenderTableSection::addCell):
     46        (WebCore::RenderTableSection::layoutRows):
     47        (WebCore::RenderTableSection::recalcCells):
     48        (WebCore::RenderTableSection::nodeAtPoint):
     49        * rendering/RenderTableSection.h:
     50        * rendering/RenderText.cpp:
     51        (WebCore::RenderText::lineBoxRects):
     52        (WebCore::RenderText::positionForCoordinates):
     53        (WebCore::RenderText::caretRect):
     54        (WebCore::RenderText::posOfChar):
     55        (WebCore::RenderText::selectionRect):
     56        * rendering/render_box.cpp:
     57        (WebCore::RenderBox::absolutePosition):
     58        (WebCore::RenderBox::caretRect):
     59        * rendering/render_br.cpp:
     60        (WebCore::RenderBR::caretRect):
     61        * rendering/render_canvas.h:
     62        * rendering/render_flow.cpp:
     63        (WebCore::RenderFlow::caretRect):
     64        * rendering/render_frames.cpp:
     65        (WebCore::RenderPart::updateWidgetPosition):
     66        * rendering/render_layer.cpp:
     67        (WebCore::RenderLayer::updateLayerPosition):
     68        * rendering/render_object.cpp:
     69        (WebCore::RenderObject::absoluteRects):
     70        (WebCore::RenderObject::absoluteBoundingBoxRect):
     71        (WebCore::RenderObject::absolutePosition):
     72        * rendering/render_object.h:
     73        (WebCore::RenderObject::absolutePositionForContent):
     74        (WebCore::RenderObject::offsetHeight):
     75        * rendering/render_replaced.cpp:
     76        (WebCore::RenderWidget::updateWidgetPosition):
     77
    1782006-03-17  Adele Peterson  <adele@apple.com>
    279
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm

    r13342 r13346  
    990990   
    991991    int nx, ny;
    992     node->absolutePosition(nx,ny);
     992    node->absolutePosition(nx, ny);
    993993    NSObject *copiedNode = [copier nodeWithName:name
    994994                                       position:NSMakePoint(nx,ny)
  • trunk/WebCore/dom/ContainerNodeImpl.cpp

    r13167 r13346  
    630630    xPos = yPos = 0;
    631631    if (!o->isInline() || o->isReplaced()) {
    632         o->absolutePosition( xPos, yPos );
     632        o->absolutePosition(xPos, yPos);
    633633        return true;
    634634    }
     
    654654
    655655        if (!o->isInline() || o->isReplaced()) {
    656             o->absolutePosition( xPos, yPos );
     656            o->absolutePosition(xPos, yPos);
    657657            return true;
    658658        }
     
    661661                // do nothing - skip unrendered whitespace that is a child or next sibling of the anchor
    662662        } else if ((o->isText() && !o->isBR()) || o->isReplaced()) {
    663             o->container()->absolutePosition( xPos, yPos );
     663            o->container()->absolutePosition(xPos, yPos);
    664664            if (o->isText() && static_cast<RenderText *>(o)->firstTextBox()) {
    665665                xPos += static_cast<RenderText *>(o)->minXPos();
     
    691691    if (!o->isInline() || o->isReplaced())
    692692    {
    693         o->absolutePosition( xPos, yPos );
     693        o->absolutePosition(xPos, yPos);
    694694        xPos += o->width();
    695         yPos += o->height();
     695        yPos += o->height() + o->borderTopExtra() + o->borderBottomExtra();
    696696        return true;
    697697    }
     
    711711            o = prev;
    712712        }
    713         if(o->isText() || o->isReplaced()) {
     713        if (o->isText() || o->isReplaced()) {
    714714            o->container()->absolutePosition(xPos, yPos);
    715715            if (o->isText())
  • trunk/WebCore/dom/NodeImpl.cpp

    r13342 r13346  
    341341    int _x, _y;
    342342    if (renderer() && renderer()->absolutePosition(_x, _y))
    343         return IntRect( _x, _y, renderer()->width(), renderer()->height() );
     343        return IntRect( _x, _y, renderer()->width(), renderer()->height() + renderer()->borderTopExtra() + renderer()->borderBottomExtra());
    344344
    345345    return IntRect();
  • trunk/WebCore/editing/SelectionController.cpp

    r13167 r13346  
    756756           
    757757            int x, y;
    758             pos.node()->renderer()->absolutePosition(x, y);
     758            pos.node()->renderer()->absolutePositionForContent(x, y);
    759759            m_caretPositionOnLayout = IntPoint(x, y);
    760760        }
     
    773773    if (m_sel.start().node() && m_sel.start().node()->renderer()) {
    774774        int x, y;
    775         m_sel.start().node()->renderer()->absolutePosition(x, y);
     775        m_sel.start().node()->renderer()->absolutePositionForContent(x, y);
    776776        caret.move(IntPoint(x, y) - m_caretPositionOnLayout);
    777777    }
  • trunk/WebCore/editing/visible_units.cpp

    r13187 r13346  
    425425    if (root) {
    426426        int absx, absy;
    427         containingBlock->absolutePosition(absx, absy);
     427        containingBlock->absolutePositionForContent(absx, absy);
    428428        RenderObject *renderer = root->closestLeafChildForXPos(x, absx)->object();
    429429        return renderer->positionForCoordinates(x, absy + root->topOverflow());
     
    488488    if (root) {
    489489        int absx, absy;
    490         containingBlock->absolutePosition(absx, absy);
     490        containingBlock->absolutePositionForContent(absx, absy);
    491491        RenderObject *renderer = root->closestLeafChildForXPos(x, absx)->object();
    492492        return renderer->positionForCoordinates(x, absy + root->topOverflow());
  • trunk/WebCore/khtml/html/HTMLInputElementImpl.cpp

    r13250 r13346  
    10471047        } else {
    10481048            int offsetX, offsetY;
    1049             renderer()->absolutePosition(offsetX,offsetY);
     1049            renderer()->absolutePosition(offsetX, offsetY);
    10501050            xPos = me->clientX() - offsetX;
    10511051            yPos = me->clientY() - offsetY;
  • trunk/WebCore/kwq/KWQRenderTreeDebug.cpp

    r13187 r13346  
    135135    // FIXME: Will remove this <br> code once all layout tests pass.  Until then, we can't really change
    136136    // all the results easily.
     137    // FIXME: Will also remove the table row and section hacks once all layout tests pass.
    137138    bool usePositions = true;
     139    bool useWidth = true;
     140    bool useHeight = true;
    138141    if (o.isBR()) {
    139142        const RenderBR* br = static_cast<const RenderBR*>(&o);
    140143        usePositions = (br->firstTextBox() && br->firstTextBox()->isText());
    141     }
    142     IntRect r(usePositions ? o.xPos() : 0, usePositions ? o.yPos() : 0, o.width(), o.height());
     144    } else if (o.isTableRow())
     145        usePositions = useWidth = useHeight = false;
     146    else if (o.isTableSection())
     147        useWidth = false;
     148
     149    IntRect r(usePositions ? o.xPos() : 0, usePositions ? o.yPos() : 0, useWidth ? o.width() : 0, useHeight ? o.height() : 0);
    143150    ts << " " << r;
    144151   
  • trunk/WebCore/rendering/RenderBlock.cpp

    r13192 r13346  
    14551455
    14561456    int tx, ty;
    1457     absolutePosition(tx, ty);
     1457    absolutePositionForContent(tx, ty);
    14581458   
    14591459    int lastTop = -borderTopExtra();
     
    25872587
    25882588    int absx, absy;
    2589     absolutePosition(absx, absy);
     2589    absolutePositionForContent(absx, absy);
    25902590
    25912591    int top = absy + borderTop() + paddingTop();
     
    26382638        if (renderer->height() == 0 || renderer->style()->visibility() != VISIBLE || renderer->isFloatingOrPositioned())
    26392639            continue;
    2640         renderer->absolutePosition(absx, top);
     2640        renderer->absolutePositionForContent(absx, top);
    26412641        RenderObject *next = renderer->nextSibling();
    26422642        while (next && next->isFloatingOrPositioned())
    26432643            next = next->nextSibling();
    26442644        if (next)
    2645             next->absolutePosition(absx, bottom);
     2645            next->absolutePositionForContent(absx, bottom);
    26462646        else
    26472647            bottom = top + contentHeight();
  • trunk/WebCore/rendering/RenderContainer.cpp

    r13102 r13346  
    488488
    489489        int absx, absy;
    490         renderer->absolutePosition(absx, absy);
     490        renderer->absolutePositionForContent(absx, absy);
    491491       
    492492        int top = absy + borderTop() + paddingTop();
     
    513513        QValueList<IntRect> rects;
    514514        int x = 0, y = 0;
    515         absolutePosition(x, y);
     515        absolutePositionForContent(x, y);
    516516        absoluteRects(rects, x, y);
    517517        return rects;
     
    525525        if (child->isText() || child->isInline() || child->isAnonymousBlock()) {
    526526            int x = 0, y = 0;
    527             child->absolutePosition(x, y);
     527            child->absolutePositionForContent(x, y);
    528528            child->absoluteRects(rects, x, y);
    529529        }
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r13067 r13346  
    123123{
    124124    r.setY(r.y() + _topExtra);
     125    r.move(-parent()->xPos(), -parent()->yPos()); // Rows are in the same coordinate space, so don't add their offset in.
    125126    RenderBlock::computeAbsoluteRepaintRect(r, f);
    126127}
     
    128129bool RenderTableCell::absolutePosition(int &xPos, int &yPos, bool f)
    129130{
    130     bool ret = RenderBlock::absolutePosition(xPos, yPos, f);
    131     if (ret)
    132       yPos += _topExtra;
    133     return ret;
     131    bool result = RenderBlock::absolutePosition(xPos, yPos, f);
     132    xPos -= parent()->xPos(); // Rows are in the same coordinate space, so don't add their offset in.
     133    yPos -= parent()->yPos();
     134    return result;
    134135}
    135136
  • trunk/WebCore/rendering/RenderTableRow.cpp

    r12746 r13346  
    9393    RenderTableCell* cell = static_cast<RenderTableCell*>(child);
    9494
    95     section()->addCell(cell);
    96 
     95    section()->addCell(cell, this);
     96   
    9797    RenderContainer::addChild(cell, beforeChild);
    9898
     
    123123{
    124124    // For now, just repaint the whole table.
    125     // FIXME: Find a better way to do this.
     125    // FIXME: Find a better way to do this, e.g., need to repaint all the cells that we
     126    // might have propagated a background color into.
    126127    RenderTable* parentTable = table();
    127128    if (parentTable)
     
    131132}
    132133
     134// Hit Testing
     135bool RenderTableRow::nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction action)
     136{
     137    // Table rows cannot ever be hit tested.  Effectively they do not exist.
     138    // Just forward to our children always.
     139    for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
     140        // FIXME: We have to skip over inline flows, since they can show up inside table rows
     141        // at the moment (a demoted inline <form> for example). If we ever implement a
     142        // table-specific hit-test method (which we should do for performance reasons anyway),
     143        // then we can remove this check.
     144        if (!child->layer() && !child->isInlineFlow() && child->nodeAtPoint(info, x, y, tx, ty, action)) {
     145            setInnerNode(info);
     146            return true;
     147        }
     148    }
     149   
     150    return false;
    133151}
     152
     153}
  • trunk/WebCore/rendering/RenderTableRow.h

    r13286 r13346  
    4646    virtual void layout();
    4747    virtual IntRect getAbsoluteRepaintRect();
    48    
     48    virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction action);
     49
    4950    // FIXME: We can't support things like opacity on table rows because they have no dimensions.  This can be removed when
    5051    // table rows really work right.
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r12953 r13346  
    146146            grid[r].row = new Row(nCols);
    147147            grid[r].row->fill(emptyCellStruct);
     148            grid[r].rowRenderer = 0;
    148149            grid[r].baseLine = 0;
    149150            grid[r].height = Length();
     
    154155}
    155156
    156 void RenderTableSection::addCell(RenderTableCell *cell)
     157void RenderTableSection::addCell(RenderTableCell *cell, RenderObject* row)
    157158{
    158159    int rSpan = cell->rowSpan();
     
    198199        return;
    199200
     201    grid[cRow].rowRenderer = row;
     202
    200203    int col = cCol;
    201204    // tell the cell where it is
     
    362365    int hspacing = table()->hBorderSpacing();
    363366    int vspacing = table()->vBorderSpacing();
     367   
     368    // Set the width of our section now.  The rows will also be this width.
     369    m_width = table()->contentWidth();
    364370   
    365371    if (toAdd && totalRows && (rowPos[totalRows] || !nextSibling())) {
     
    430436        Row *row = grid[r].row;
    431437        int totalCols = row->size();
     438       
     439        // Set the row's x/y position and width/height.
     440        if (grid[r].rowRenderer) {
     441            grid[r].rowRenderer->setPos(0, rowPos[r]);
     442            grid[r].rowRenderer->setWidth(m_width);
     443            grid[r].rowRenderer->setHeight(rowPos[r+1] - rowPos[r] - vspacing);
     444        }
     445
    432446        for (int c = 0; c < nEffCols; c++) {
    433447            CellStruct current = cellAt(r, c);
     
    660674
    661675    for (RenderObject *row = firstChild(); row; row = row->nextSibling()) {
    662         cRow++;
    663         cCol = 0;
    664         ensureRows(cRow + 1);
    665         for (RenderObject *cell = row->firstChild(); cell; cell = cell->nextSibling())
    666             if (cell->isTableCell())
    667                 addCell(static_cast<RenderTableCell *>(cell));
     676        if (row->isTableRow()) {
     677            cRow++;
     678            cCol = 0;
     679            ensureRows(cRow + 1);
     680            for (RenderObject *cell = row->firstChild(); cell; cell = cell->nextSibling())
     681                if (cell->isTableCell())
     682                    addCell(static_cast<RenderTableCell *>(cell), row);
     683        }
    668684    }
    669685    needCellRecalc = false;
     
    697713    setNeedCellRecalc();
    698714    return RenderContainer::removeChildNode(child);
     715}
     716
     717// Hit Testing
     718bool RenderTableSection::nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction action)
     719{
     720    // Table sections cannot ever be hit tested.  Effectively they do not exist.
     721    // Just forward to our children always.
     722    tx += m_x;
     723    ty += m_y;
     724
     725    for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
     726        // FIXME: We have to skip over inline flows, since they can show up inside table rows
     727        // at the moment (a demoted inline <form> for example). If we ever implement a
     728        // table-specific hit-test method (which we should do for performance reasons anyway),
     729        // then we can remove this check.
     730        if (!child->layer() && !child->isInlineFlow() && child->nodeAtPoint(info, x, y, tx, ty, action)) {
     731            setInnerNode(info);
     732            return true;
     733        }
     734    }
     735   
     736    return false;
    699737}
    700738
  • trunk/WebCore/rendering/RenderTableSection.h

    r12758 r13346  
    5656#endif
    5757
    58     void addCell(RenderTableCell *cell);
     58    void addCell(RenderTableCell *cell, RenderObject* row);
    5959
    6060    void setCellWidths();
     
    7070    typedef Array<CellStruct> Row;
    7171    struct RowStruct {
    72         Row *row;
     72        Row* row;
     73        RenderObject* rowRenderer;
    7374        int baseLine;
    7475        Length height;
     
    9899    virtual RenderObject* removeChildNode(RenderObject* child);
    99100
     101    virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction action);
     102
    100103    // this gets a cell grid data structure. changing the number of
    101104    // columns is done by the table
  • trunk/WebCore/rendering/RenderText.cpp

    r13300 r13346  
    216216    QValueList<IntRect> rects;
    217217    int x = 0, y = 0;
    218     absolutePosition(x, y);
     218    absolutePositionForContent(x, y);
    219219    absoluteRects(rects, x, y);
    220220    return rects;
     
    250250    int absx, absy;
    251251    RenderBlock *cb = containingBlock();
    252     cb->absolutePosition(absx, absy);
     252    cb->absolutePositionForContent(absx, absy);
    253253    if (cb->hasOverflowClip())
    254254        cb->layer()->subtractScrollOffset(absx, absy);
     
    400400
    401401    int absx, absy;
    402     absolutePosition(absx,absy);
     402    absolutePositionForContent(absx, absy);
    403403    left += absx;
    404404    top += absy;
     
    418418void RenderText::posOfChar(int chr, int &x, int &y)
    419419{
    420     absolutePosition(x, y, false);
     420    absolutePositionForContent(x, y);
    421421
    422422    int pos;
     
    10491049
    10501050    int absx, absy;
    1051     cb->absolutePosition(absx, absy);
     1051    cb->absolutePositionForContent(absx, absy);
    10521052    RenderLayer* layer = cb->layer();
    10531053    if (layer)
  • trunk/WebCore/rendering/render_box.cpp

    r13344 r13346  
    653653    RenderObject *o = container();
    654654    if (o && o->absolutePosition(xPos, yPos, f)) {
     655        yPos += o->borderTopExtra();
    655656        if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isInlineFlow()) {
    656657            // When we have an enclosing relpositioned inline, we need to add in the offset of the first line
     
    686687            o->layer()->subtractScrollOffset(xPos, yPos);
    687688           
    688         if (!isInline() || isReplaced())
    689             xPos += m_x, yPos += m_y;
     689        if (!isInline() || isReplaced()) {
     690            xPos += m_x;
     691            yPos += m_y;
     692        }
    690693
    691694        if (isRelPositioned())
     
    17601763    int absx, absy;
    17611764    RenderObject *cb = containingBlock();
    1762     if (cb && cb != this && cb->absolutePosition(absx,absy)) {
     1765    if (cb && cb != this && cb->absolutePosition(absx, absy)) {
    17631766        _x += absx;
    17641767        _y += absy;
  • trunk/WebCore/rendering/render_br.cpp

    r13134 r13346  
    114114
    115115    int absx, absy;
    116     absolutePosition(absx,absy);
     116    absolutePosition(absx, absy);
    117117
    118    if (extraWidthToEndOfLine)
     118    if (extraWidthToEndOfLine)
    119119        *extraWidthToEndOfLine = containingBlockWidth() - xPos();
    120120 
  • trunk/WebCore/rendering/render_canvas.h

    r12853 r13346  
    4545    virtual void calcHeight();
    4646    virtual void calcMinMaxWidth();
    47     virtual bool absolutePosition(int &xPos, int&yPos, bool f = false);
     47    virtual bool absolutePosition(int &xPos, int& yPos, bool f = false);
    4848   
    4949    int docHeight() const;
  • trunk/WebCore/rendering/render_flow.cpp

    r13331 r13346  
    637637            int myRight = _x + width;
    638638            int ignore;
    639             absolutePosition(myRight, ignore);
     639            absolutePositionForContent(myRight, ignore);
    640640           
    641641            int containerRight = containingBlock()->xPos() + containingBlockWidth();
    642             absolutePosition(containerRight, ignore);
     642            absolutePositionForContent(containerRight, ignore);
    643643           
    644644            *extraWidthToEndOfLine = containerRight - myRight;
     
    647647
    648648    int absx, absy;
    649     absolutePosition(absx, absy, false);
     649    absolutePositionForContent(absx, absy);
    650650    _x += absx + paddingLeft() + borderLeft();
    651651    _y += absy + paddingTop() + borderTop();
  • trunk/WebCore/rendering/render_frames.cpp

    r13257 r13346  
    929929   
    930930    int x, y, width, height;
    931     absolutePosition(x,y);
     931    absolutePosition(x, y);
    932932    x += borderLeft() + paddingLeft();
    933933    y += borderTop() + paddingTop();
  • trunk/WebCore/rendering/render_layer.cpp

    r13302 r13346  
    229229        RenderObject* curr = m_object->parent();
    230230        while (curr && !curr->layer()) {
    231             x += curr->xPos();
    232             y += curr->yPos();
     231            if (!curr->isTableRow()) {
     232                // Rows and cells share the same coordinate space (that of the section).
     233                // Omit them when computing our xpos/ypos.
     234                x += curr->xPos();
     235                y += curr->yPos();
     236            }
    233237            curr = curr->parent();
    234238        }
  • trunk/WebCore/rendering/render_object.cpp

    r13331 r13346  
    12761276    }
    12771277    else
    1278         rects.append(IntRect(_tx, _ty, width(), height()));
     1278        rects.append(IntRect(_tx, _ty, width(), height() + borderTopExtra() + borderBottomExtra()));
    12791279}
    12801280
    12811281IntRect RenderObject::absoluteBoundingBoxRect()
    12821282{
    1283     int x, y;
     1283    int x = 0, y = 0;
    12841284    absolutePosition(x, y);
    12851285    QValueList<IntRect> rects;
     
    18781878    if (o) {
    18791879        o->absolutePosition(xPos, yPos, f);
     1880        yPos += o->borderTopExtra();
    18801881        if (o->hasOverflowClip())
    18811882            o->layer()->subtractScrollOffset(xPos, yPos);
  • trunk/WebCore/rendering/render_object.h

    r13134 r13346  
    564564    // calculate client position of box
    565565    virtual bool absolutePosition(int &/*xPos*/, int &/*yPos*/, bool fixed = false);
     566   
     567    // This function is used to deal with the extra top space that can occur in table cells (called borderTopExtra).
     568    // The children of the cell do not factor this space in, so we have to add it in.  Any code that wants to
     569    // accurately deal with the contents of a cell must call this function instad of absolutePosition.
     570    void absolutePositionForContent(int& xPos, int& yPos, bool fixed = false) {
     571        absolutePosition(xPos, yPos, fixed);
     572        yPos += borderTopExtra();
     573    }
    566574
    567575    // width and height are without margins but include paddings and borders
     
    585593    // to return the remaining width on a given line (and the height of a single line). -dwh
    586594    virtual int offsetWidth() const { return width(); }
    587     virtual int offsetHeight() const { return height(); }
     595    virtual int offsetHeight() const { return height() + borderTopExtra() + borderBottomExtra(); }
    588596   
    589597    // IE exxtensions.  Also supported by Gecko.  We override in render flow to get the
  • trunk/WebCore/rendering/render_replaced.cpp

    r13176 r13346  
    435435   
    436436    int x, y, width, height;
    437     absolutePosition(x,y);
     437    absolutePosition(x, y);
    438438    x += borderLeft() + paddingLeft();
    439439    y += borderTop() + paddingTop();
Note: See TracChangeset for help on using the changeset viewer.