Changeset 18516 in webkit


Ignore:
Timestamp:
Jan 1, 2007 8:37:43 PM (17 years ago)
Author:
ddkilzer
Message:

LayoutTests:

Reviewed by Darin.

  • fast/repaint/table-cell-collapsed-border-expected.checksum: Added.
  • fast/repaint/table-cell-collapsed-border-expected.png: Added.
  • fast/repaint/table-cell-collapsed-border-expected.txt: Added.
  • fast/repaint/table-cell-collapsed-border.html: Added.

WebCore:

Reviewed by Darin.

Test: fast/repaint/table-cell-collapsed-border.html

  • rendering/RenderTable.h: Added needsSectionRecalc() accessor.
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::getAbsoluteRepaintRect): Overloaded to add the outer half of any collapsed borders. This function checks the cell's borders' widths but also the widths of the adjoining cells' borders, since they can contribute to the length of this cell's borders perpendicular to them, making such a border overflow the cell in both dimensions. (WebCore::RenderTableCell::borderLeft): Split the collapsing borders case off to borderHalfLeft(). (WebCore::RenderTableCell::borderRight): Ditto. (WebCore::RenderTableCell::borderTop): Ditto. (WebCore::RenderTableCell::borderBottom): Ditto. (WebCore::RenderTableCell::borderHalfLeft): Added. Takes an 'outer' boolean parameter. When true, this function returns the width of the part of the border that is outside the cell (different from the inner width when the total width is odd). (WebCore::RenderTableCell::borderHalfRight): Ditto. (WebCore::RenderTableCell::borderHalfTop): Ditto. (WebCore::RenderTableCell::borderHalfBottom): Ditto.
  • rendering/RenderTableCell.h:
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18511 r18516  
     12007-01-01  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - repaint test for http://bugs.webkit.org/show_bug.cgi?id=11359
     6          Incomplete repaint of table cell's collapsed border when changing only the cell
     7
     8        * fast/repaint/table-cell-collapsed-border-expected.checksum: Added.
     9        * fast/repaint/table-cell-collapsed-border-expected.png: Added.
     10        * fast/repaint/table-cell-collapsed-border-expected.txt: Added.
     11        * fast/repaint/table-cell-collapsed-border.html: Added.
     12
    1132007-01-01  Mitz Pettel  <mitz@webkit.org>
    214
  • trunk/WebCore/ChangeLog

    r18515 r18516  
     12007-01-01  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=11359
     6          Incomplete repaint of table cell's collapsed border when changing only the cell
     7
     8        Test: fast/repaint/table-cell-collapsed-border.html
     9
     10        * rendering/RenderTable.h:
     11        Added needsSectionRecalc() accessor.
     12        * rendering/RenderTableCell.cpp:
     13        (WebCore::RenderTableCell::getAbsoluteRepaintRect): Overloaded to add the
     14        outer half of any collapsed borders. This function checks the cell's borders'
     15        widths but also the widths of the adjoining cells' borders, since they can
     16        contribute to the length of this cell's borders perpendicular to them, making
     17        such a border overflow the cell in both dimensions.
     18        (WebCore::RenderTableCell::borderLeft): Split the collapsing borders case off to
     19        borderHalfLeft().
     20        (WebCore::RenderTableCell::borderRight): Ditto.
     21        (WebCore::RenderTableCell::borderTop): Ditto.
     22        (WebCore::RenderTableCell::borderBottom): Ditto.
     23        (WebCore::RenderTableCell::borderHalfLeft): Added. Takes an 'outer' boolean
     24        parameter. When true, this function returns the width of the part of the border
     25        that is outside the cell (different from the inner width when the total width is odd).
     26        (WebCore::RenderTableCell::borderHalfRight): Ditto.
     27        (WebCore::RenderTableCell::borderHalfTop): Ditto.
     28        (WebCore::RenderTableCell::borderHalfBottom): Ditto.
     29        * rendering/RenderTableCell.h:
     30
    1312007-01-01  David Kilzer  <ddkilzer@webkit.org>
    232
  • trunk/WebCore/rendering/RenderTable.h

    r17521 r18516  
    160160    RenderTableCol* colElement(int col) const;
    161161
     162    bool needsSectionRecalc() const { return needSectionRecalc; }
    162163    void setNeedSectionRecalc() { needSectionRecalc = true; }
    163164
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r18455 r18516  
    136136}
    137137
     138IntRect RenderTableCell::getAbsoluteRepaintRect()
     139{
     140    // If the table grid is dirty, we cannot get reliable information about adjoining cells,
     141    // so we ignore outside borders. This should not be a problem because it means that
     142    // the table is going to recalculate the grid, relayout and repaint its current rect, which
     143    // includes any outside borders of this cell.
     144    if (table()->collapseBorders() && !table()->needsSectionRecalc()) {
     145        bool rtl = table()->style()->direction() == RTL;
     146        int outlineSize = style()->outlineSize();
     147        int left = max(borderHalfLeft(true), outlineSize);
     148        int right = max(borderHalfRight(true), outlineSize);
     149        int top = max(borderHalfTop(true), outlineSize);
     150        int bottom = max(borderHalfBottom(true), outlineSize);
     151        if (left && !rtl || right && rtl) {
     152            if (RenderTableCell* before = table()->cellBefore(this)) {
     153                top = max(top, before->borderHalfTop(true));
     154                bottom = max(bottom, before->borderHalfBottom(true));
     155            }
     156        }
     157        if (left && rtl || right && !rtl) {
     158            if (RenderTableCell* after = table()->cellAfter(this)) {
     159                top = max(top, after->borderHalfTop(true));
     160                bottom = max(bottom, after->borderHalfBottom(true));
     161            }
     162        }
     163        if (top) {
     164            if (RenderTableCell* above = table()->cellAbove(this)) {
     165                left = max(left, above->borderHalfLeft(true));
     166                right = max(right, above->borderHalfRight(true));
     167            }
     168        }
     169        if (bottom) {
     170            if (RenderTableCell* below = table()->cellBelow(this)) {
     171                left = max(left, below->borderHalfLeft(true));
     172                right = max(right, below->borderHalfRight(true));
     173            }
     174        }
     175        left = max(left, -overflowLeft(false));
     176        top = max(top, -overflowTop(false) - borderTopExtra());
     177        IntRect r(-left, -borderTopExtra() - top, left + max(width() + right, overflowWidth(false)), borderTopExtra() + top + max(height() + bottom + borderBottomExtra(), overflowHeight(false)));
     178        computeAbsoluteRepaintRect(r);
     179        return r;
     180    }
     181    return RenderBlock::getAbsoluteRepaintRect();
     182}
     183
    138184void RenderTableCell::computeAbsoluteRepaintRect(IntRect& r, bool f)
    139185{
     
    488534int RenderTableCell::borderLeft() const
    489535{
    490     if (table()->collapseBorders()) {
    491         CollapsedBorderValue border = collapsedLeftBorder(table()->style()->direction() == RTL);
    492         if (border.exists())
    493             return (border.width() + 1) / 2; // Give the extra pixel to top and left.
    494         return 0;
    495     }
    496     return RenderBlock::borderLeft();
    497 }
    498    
     536    return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderLeft();
     537}
     538
    499539int RenderTableCell::borderRight() const
    500540{
    501     if (table()->collapseBorders()) {
    502         CollapsedBorderValue border = collapsedRightBorder(table()->style()->direction() == RTL);
    503         if (border.exists())
    504             return border.width() / 2;
    505         return 0;
    506     }
    507     return RenderBlock::borderRight();
     541    return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderRight();
    508542}
    509543
    510544int RenderTableCell::borderTop() const
    511545{
    512     if (table()->collapseBorders()) {
    513         CollapsedBorderValue border = collapsedTopBorder();
    514         if (border.exists())
    515             return (border.width() + 1) / 2; // Give the extra pixel to top and left.
    516         return 0;
    517     }
    518     return RenderBlock::borderTop();
     546    return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderTop();
    519547}
    520548
    521549int RenderTableCell::borderBottom() const
    522550{
    523     if (table()->collapseBorders()) {
    524         CollapsedBorderValue border = collapsedBottomBorder();
    525         if (border.exists())
    526             return border.width() / 2;
    527         return 0;
    528     }
    529     return RenderBlock::borderBottom();
     551    return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderBottom();
     552}
     553
     554int RenderTableCell::borderHalfLeft(bool outer) const
     555{
     556    CollapsedBorderValue border = collapsedLeftBorder(table()->style()->direction() == RTL);
     557    if (border.exists())
     558        return (border.width() + (outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.
     559    return 0;
     560}
     561   
     562int RenderTableCell::borderHalfRight(bool outer) const
     563{
     564    CollapsedBorderValue border = collapsedRightBorder(table()->style()->direction() == RTL);
     565    if (border.exists())
     566        return (border.width() + (outer ? 1 : 0)) / 2;
     567    return 0;
     568}
     569
     570int RenderTableCell::borderHalfTop(bool outer) const
     571{
     572    CollapsedBorderValue border = collapsedTopBorder();
     573    if (border.exists())
     574        return (border.width() + (outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.
     575    return 0;
     576}
     577
     578int RenderTableCell::borderHalfBottom(bool outer) const
     579{
     580    CollapsedBorderValue border = collapsedBottomBorder();
     581    if (border.exists())
     582        return (border.width() + (outer ? 1 : 0)) / 2;
     583    return 0;
    530584}
    531585
  • trunk/WebCore/rendering/RenderTableCell.h

    r18455 r18516  
    7272    int borderBottom() const;
    7373
     74    int borderHalfLeft(bool outer) const;
     75    int borderHalfRight(bool outer) const;
     76    int borderHalfTop(bool outer) const;
     77    int borderHalfBottom(bool outer) const;
     78
    7479    CollapsedBorderValue collapsedLeftBorder(bool rtl) const;
    7580    CollapsedBorderValue collapsedRightBorder(bool rtl) const;
     
    9297    virtual int yPos() const { return m_y + _topExtra; }
    9398
     99    virtual IntRect getAbsoluteRepaintRect();
    94100    virtual void computeAbsoluteRepaintRect(IntRect&, bool f=false);
    95101    virtual bool absolutePosition(int& xPos, int& yPos, bool f = false);
Note: See TracChangeset for help on using the changeset viewer.