Changeset 18634 in webkit


Ignore:
Timestamp:
Jan 5, 2007 3:03:50 PM (17 years ago)
Author:
adele
Message:

LayoutTests:

Reviewed by Hyatt.

  • fast/repaint/table-section-overflow-expected.checksum: Added.
  • fast/repaint/table-section-overflow-expected.png: Added.
  • fast/repaint/table-section-overflow-expected.txt: Added.
  • fast/repaint/table-section-overflow.html: Added.
  • fast/repaint/table-section-repaint-expected.checksum: Added.
  • fast/repaint/table-section-repaint-expected.png: Added.
  • fast/repaint/table-section-repaint-expected.txt: Added.
  • fast/repaint/table-section-repaint.html: Added.
  • tables/mozilla/core/misc-expected.txt:
  • tables/mozilla/core/misc-expected.png:
  • tables/mozilla/core/misc-expected.checksum:

WebCore:

Reviewed by Hyatt.

Tests: fast/repaint/table-section-repaint.html

fast/repaint/table-section-overflow.html

Fixed repainting when table sections move during layout.

Made table cells' overflows propagate to table sections and gave tables
overflows.

  • rendering/RenderTable.cpp: (WebCore::RenderTable::layout): Added computation of horizontal and vertical overflows based on the caption's and the table sections' overflows. Added checks for table sections that change position during layout. When that happens, we assume all sections below the first section that moved also moved, and repaint everything downwards from there. Added calls to repaintDuringLayoutIfMoved() for the caption. Changed the way table sections are iterated over and added a FIXME to change it again once bug 12124 is fixed. (WebCore::RenderTable::paint): Changed to paint overflow. (WebCore::RenderTable::outerBorderBottom):
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::RenderTableSection): (WebCore::RenderTableSection::layoutRows): Added code to compute the section's overflow and a flag saying whether any cells in this section overflow. (WebCore::RenderTableSection::paint): Changed to paint overflow. If any cell in the section has overflow, then all cells are given a chance to paint. This is needed because there can be internal overflow, and external overflow can be coming from any cell inside.
  • rendering/RenderTableSection.h: (WebCore::RenderTableSection::overflowWidth): (WebCore::RenderTableSection::overflowLeft):
Location:
trunk
Files:
8 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18620 r18634  
     12007-01-05  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Hyatt.
     4
     5        - repaint tests and updated results for
     6          http://bugs.webkit.org/show_bug.cgi?id=12079
     7          Nested tables don't repaint properly when a certain row is added
     8
     9        * fast/repaint/table-section-overflow-expected.checksum: Added.
     10        * fast/repaint/table-section-overflow-expected.png: Added.
     11        * fast/repaint/table-section-overflow-expected.txt: Added.
     12        * fast/repaint/table-section-overflow.html: Added.
     13        * fast/repaint/table-section-repaint-expected.checksum: Added.
     14        * fast/repaint/table-section-repaint-expected.png: Added.
     15        * fast/repaint/table-section-repaint-expected.txt: Added.
     16        * fast/repaint/table-section-repaint.html: Added.
     17        * tables/mozilla/core/misc-expected.txt:
     18        * tables/mozilla/core/misc-expected.png:
     19        * tables/mozilla/core/misc-expected.checksum:
     20
    1212007-01-05  Alexey Proskuryakov  <ap@webkit.org>
    222
  • trunk/LayoutTests/tables/mozilla/core/misc-expected.checksum

    r16432 r18634  
    1 70242afa1f6d5c7d6c7dc9bec4eeed53
     1f3e8ac5f89b07679968161599c0e5f42
  • trunk/LayoutTests/tables/mozilla/core/misc-expected.txt

    r15011 r18634  
    11layer at (0,0) size 812x585
    22  RenderView at (0,0) size 800x585
    3 layer at (0,0) size 800x585
     3layer at (0,0) size 812x585
    44  RenderBlock {HTML} at (0,0) size 800x585
    55    RenderBody {BODY} at (8,8) size 784x569
  • trunk/WebCore/ChangeLog

    r18633 r18634  
     12007-01-05  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Hyatt.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=12079
     6          Nested tables don't repaint properly when a certain row is added
     7
     8        Tests: fast/repaint/table-section-repaint.html
     9               fast/repaint/table-section-overflow.html
     10
     11        Fixed repainting when table sections move during layout.
     12
     13        Made table cells' overflows propagate to table sections and gave tables
     14        overflows.
     15
     16        * rendering/RenderTable.cpp:
     17        (WebCore::RenderTable::layout): Added computation of horizontal and vertical overflows
     18        based on the caption's and the table sections' overflows.
     19        Added checks for table sections that change position during layout. When that happens,
     20        we assume all sections below the first section that moved also moved, and repaint
     21        everything downwards from there.
     22        Added calls to repaintDuringLayoutIfMoved() for the caption.
     23        Changed the way table sections are iterated over and added a FIXME to change it again
     24        once bug 12124 is fixed.
     25        (WebCore::RenderTable::paint): Changed to paint overflow.
     26        (WebCore::RenderTable::outerBorderBottom):
     27        * rendering/RenderTableSection.cpp:
     28        (WebCore::RenderTableSection::RenderTableSection):
     29        (WebCore::RenderTableSection::layoutRows): Added code to compute the section's overflow
     30        and a flag saying whether any cells in this section overflow.
     31        (WebCore::RenderTableSection::paint): Changed to paint overflow. If any cell
     32        in the section has overflow, then all cells are given a chance to paint. This is needed
     33        because there can be internal overflow, and external overflow can be coming from any
     34        cell inside.
     35        * rendering/RenderTableSection.h:
     36        (WebCore::RenderTableSection::overflowWidth):
     37        (WebCore::RenderTableSection::overflowLeft):
     38
    1392007-01-05  Beth Dakin  <bdakin@apple.com>
    240
  • trunk/WebCore/rendering/RenderTable.cpp

    r18608 r18634  
    3333#include "Document.h"
    3434#include "FixedTableLayout.h"
     35#include "FrameView.h"
    3536#include "HTMLNames.h"
    3637#include "RenderTableCell.h"
    3738#include "RenderTableCol.h"
    3839#include "RenderTableSection.h"
     40#include "RenderView.h"
    3941#include "TextStream.h"
    4042
     
    256258    m_height = 0;
    257259    m_overflowHeight = 0;
     260    m_overflowTop = 0;
    258261    initMaxMarginValues();
    259262   
    260263    //int oldWidth = m_width;
    261264    calcWidth();
     265
     266    m_overflowWidth = m_width + (collapseBorders() ? outerBorderRight() - borderRight() : 0);
     267    m_overflowLeft = collapseBorders() ? borderLeft() - outerBorderLeft() : 0;
    262268
    263269    // FIXME: The optimisation below doesn't work since the internal table
     
    272278    // layout child objects
    273279    int calculatedHeight = 0;
     280    int oldTableTop = m_caption ? m_caption->height() + m_caption->marginTop() + m_caption->marginBottom() : 0;
    274281
    275282    RenderObject* child = firstChild();
     
    285292    }
    286293
    287     m_overflowWidth = m_width + (collapseBorders() ? outerBorderRight() - borderRight() : 0);
    288     m_overflowLeft = collapseBorders() ? borderLeft() - outerBorderLeft() : 0;
     294    // If any table section moved vertically, we will just repaint everything from that
     295    // section down (it is quite unlikely that any of the following sections
     296    // did not shift).
     297    bool sectionMoved = false;
     298    int movedSectionTop = 0;
    289299
    290300    // FIXME: Collapse caption margin.
    291301    if (m_caption && m_caption->style()->captionSide() != CAPBOTTOM) {
     302        IntRect captionRect(m_caption->xPos(), m_caption->yPos(), m_caption->width(), m_caption->height());
     303
    292304        m_caption->setPos(m_caption->marginLeft(), m_height);
     305        if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
     306            m_caption->repaintDuringLayoutIfMoved(captionRect);
     307
    293308        m_height += m_caption->height() + m_caption->marginTop() + m_caption->marginBottom();
     309        m_overflowLeft = min(m_overflowLeft, m_caption->xPos() + m_caption->overflowLeft(false));
     310        m_overflowWidth = max(m_overflowWidth, m_caption->xPos() + m_caption->overflowWidth(false));
     311        m_overflowTop = min(m_overflowTop, m_caption->yPos() + m_caption->overflowTop(false));
     312        m_overflowHeight = max(m_overflowHeight, m_caption->yPos() + m_caption->overflowHeight(false));
     313
     314        if (m_height != oldTableTop) {
     315            sectionMoved = true;
     316            movedSectionTop = min(m_height, oldTableTop);
     317        }
    294318    }
    295319
     
    333357
    334358    // position the table sections
    335     if (m_head) {
    336         m_head->setPos(bl, m_height);
    337         m_height += m_head->height();
    338     }
    339     for (RenderObject* body = m_firstBody; body; body = body->nextSibling()) {
    340         if (body != m_head && body != m_foot && body->isTableSection()) {
    341             body->setPos(bl, m_height);
    342             m_height += body->height();
    343         }
    344     }
    345     if (m_foot) {
    346         m_foot->setPos(bl, m_height);
    347         m_height += m_foot->height();
     359    RenderObject* section = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
     360    while (section) {
     361        if (!sectionMoved && section->yPos() != m_height) {
     362            sectionMoved = true;
     363            movedSectionTop = min(m_height, section->yPos());
     364        }
     365        section->setPos(bl, m_height);
     366
     367        m_height += section->height();
     368        m_overflowLeft = min(m_overflowLeft, section->xPos() + section->overflowLeft(false));
     369        m_overflowWidth = max(m_overflowWidth, section->xPos() + section->overflowWidth(false));
     370        // FIXME: Use sectionBelow() instead of the following once sectionBelow() is fixed.
     371        // See http://bugs.webkit.org/show_bug.cgi?id=12124
     372        if (section == m_foot)
     373            break;
     374        if (section == m_head)
     375            section = m_firstBody ? m_firstBody : m_foot;
     376        else {
     377            do {
     378                section = section->nextSibling();
     379            } while (section && (section == m_head || section == m_foot || !section->isTableSection()));
     380            if (!section)
     381                section = m_foot;
     382        }
    348383    }
    349384
    350385    m_height += bpBottom;
    351                
     386
    352387    if (m_caption && m_caption->style()->captionSide() == CAPBOTTOM) {
     388        IntRect captionRect(m_caption->xPos(), m_caption->yPos(), m_caption->width(), m_caption->height());
     389
    353390        m_caption->setPos(m_caption->marginLeft(), m_height);
     391        if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
     392            m_caption->repaintDuringLayoutIfMoved(captionRect);
     393
    354394        m_height += m_caption->height() + m_caption->marginTop() + m_caption->marginBottom();
     395        m_overflowLeft = min(m_overflowLeft, m_caption->xPos() + m_caption->overflowLeft(false));
     396        m_overflowWidth = max(m_overflowWidth, m_caption->xPos() + m_caption->overflowWidth(false));
    355397    }
    356398
    357399    if (isPositioned())
    358400        calcHeight();
     401
     402    m_overflowHeight = max(m_overflowHeight, m_height);
    359403
    360404    // table can be containing block of positioned elements.
     
    362406    layoutPositionedObjects(true);
    363407
     408    bool didFullRepaint = true;
    364409    // Repaint with our new bounds if they are different from our old bounds.
    365410    if (checkForRepaint)
    366         repaintAfterLayoutIfNeeded(oldBounds, oldFullBounds);
     411        didFullRepaint = repaintAfterLayoutIfNeeded(oldBounds, oldFullBounds);
     412    if (!didFullRepaint && sectionMoved) {
     413        IntRect repaintRect(m_overflowLeft, movedSectionTop, m_overflowWidth - m_overflowLeft, m_overflowHeight - movedSectionTop);
     414        view()->frameView()->addRepaintInfo(this, repaintRect);
     415    }
    367416   
    368417    setNeedsLayout(false);
     
    385434
    386435    int os = 2 * maximalOutlineSize(paintPhase);
    387     if (ty >= paintInfo.rect.bottom() + os || ty + height() <= paintInfo.rect.y() - os)
     436    if (ty + overflowTop() >= paintInfo.rect.bottom() + os || ty + overflowHeight() <= paintInfo.rect.y() - os)
    388437        return;
    389     if (tx >= paintInfo.rect.right() + os || tx + width() <= paintInfo.rect.x() - os)
     438    if (tx + overflowLeft() >= paintInfo.rect.right() + os || tx + overflowWidth() <= paintInfo.rect.x() - os)
    390439        return;
    391440
     
    797846    else {
    798847        RenderObject* child;
    799         for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling());
     848        for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling())
     849            ;
    800850        bottomSection = child ? static_cast<RenderTableSection*>(child) : 0;
    801851    }
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r18608 r18634  
    5454    , m_outerBorderTop(0)
    5555    , m_outerBorderBottom(0)
     56    , m_overflowLeft(0)
     57    , m_overflowWidth(0)
     58    , m_hasOverflowingCell(false)
    5659{
    5760    // init RenderObject attributes
     
    362365    // Set the width of our section now.  The rows will also be this width.
    363366    m_width = table()->contentWidth();
     367    m_overflowLeft = 0;
     368    m_overflowWidth = m_width;
     369    m_hasOverflowingCell = false;
     370
    364371    if (table()->collapseBorders())
    365372        recalcOuterBorder();
     
    430437    for (int r = 0; r < totalRows; r++) {
    431438        // Set the row's x/y position and width/height.
    432         if (m_grid[r].rowRenderer) {
    433             m_grid[r].rowRenderer->setPos(0, m_rowPos[r]);
    434             m_grid[r].rowRenderer->setWidth(m_width);
    435             m_grid[r].rowRenderer->setHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
     439        if (RenderObject* rowRenderer = m_grid[r].rowRenderer) {
     440            rowRenderer->setPos(0, m_rowPos[r]);
     441            rowRenderer->setWidth(m_width);
     442            rowRenderer->setHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
    436443        }
    437444
     
    444451                continue;
    445452
    446             if ((rindx = r - cell->rowSpan() + 1) < 0)
    447                 rindx = 0;
     453            rindx = max(0, r - cell->rowSpan() + 1);
    448454
    449455            rHeight = m_rowPos[r + 1] - m_rowPos[rindx] - vspacing;
     
    516522                cell->setCellTopExtra(te);
    517523                cell->setCellBottomExtra(be);
    518                 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout() && (te != oldTe || be > oldBe))
     524                if ((te != oldTe || be > oldBe) && !table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout())
    519525                    cell->repaint();
    520526            }
     
    526532            } else
    527533                cell->setPos(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
     534
     535            m_overflowLeft = min(m_overflowLeft, cell->xPos() + cell->overflowLeft(false));
     536            m_overflowWidth = max(m_overflowWidth, cell->xPos() + cell->overflowWidth(false));
     537            m_hasOverflowingCell |= cell->overflowLeft(false) || cell->overflowWidth(false) > cell->width();
    528538
    529539            // If the cell moved, we have to repaint it as well as any floating/positioned
     
    835845    unsigned startcol = 0;
    836846    unsigned endcol = totalCols;
    837     if (style()->direction() == LTR) {
     847    // If some cell overflows, just paint all of them.
     848    // FIXME: Implement RTL.
     849    if (!m_hasOverflowingCell && style()->direction() == LTR) {
    838850        for (; startcol < totalCols; startcol++) {
    839851            if (tx + table()->columnPositions()[startcol + 1] >= x - os)
  • trunk/WebCore/rendering/RenderTableSection.h

    r18615 r18634  
    8181    void splitColumn(int pos, int newSize);
    8282
     83    virtual int overflowWidth(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? m_width : m_overflowWidth; }
     84    virtual int overflowLeft(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowLeft; }
     85
    8386    virtual int lowestPosition(bool includeOverflowInterior, bool includeSelf) const;
    8487    virtual int rightmostPosition(bool includeOverflowInterior, bool includeSelf) const;
     
    141144    int m_outerBorderTop;
    142145    int m_outerBorderBottom;
     146    int m_overflowLeft;
     147    int m_overflowWidth;
     148    bool m_hasOverflowingCell;
    143149};
    144150
Note: See TracChangeset for help on using the changeset viewer.