Changeset 56319 in webkit
- Timestamp:
- Mar 21, 2010 3:19:27 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56316 r56319 1 2010-03-21 Dmitry Gorbik <socket.h@gmail.com> 2 3 <http://webkit.org/b/14858> <col> width ignored when not tied to a single cell 4 5 Reviewed by David Kilzer. 6 7 Fixed width calculation for cells with span when <col> is defined. 8 9 * fast/table/col-width-span-expand-expected.txt: Added. 10 * fast/table/col-width-span-expand.html: Added. 11 1 12 2010-03-20 Martin Robinson <mrobinson@webkit.org> 2 13 -
trunk/WebCore/ChangeLog
r56311 r56319 1 2010-03-21 Dmitry Gorbik <socket.h@gmail.com> 2 3 <http://webkit.org/b/14858> <col> width ignored when not tied to a single cell 4 5 Reviewed by David Kilzer. 6 7 Fixed width calculation for cells with span when <col> is defined. 8 9 Test: fast/table/col-width-span-expand.html 10 11 * rendering/RenderTableCell.cpp: 12 (WebCore::RenderTableCell::styleOrColWidth): Added the calculation of cell width 13 in case of <col> defined and span > 1. 14 1 15 2010-03-20 Antonio Gomes <tonikitoo@webkit.org> 2 16 -
trunk/WebCore/rendering/RenderTable.cpp
r54311 r56319 582 582 } 583 583 584 RenderTableCol* RenderTable::nextColElement(RenderTableCol* current) const 585 { 586 RenderObject* next = current->firstChild(); 587 if (!next) 588 next = current->nextSibling(); 589 if (!next && current->parent()->isTableCol()) 590 next = current->parent()->nextSibling(); 591 592 while (next) { 593 if (next->isTableCol()) 594 return toRenderTableCol(next); 595 if (next != m_caption) 596 return 0; 597 next = next->nextSibling(); 598 } 599 600 return 0; 601 } 602 584 603 RenderTableCol* RenderTable::colElement(int col, bool* startEdge, bool* endEdge) const 585 604 { … … 590 609 591 610 while (child) { 592 if (child->isTableCol()) { 593 RenderTableCol* colElem = toRenderTableCol(child); 594 int span = colElem->span(); 595 if (!colElem->firstChild()) { 596 int startCol = cCol; 597 int endCol = cCol + span - 1; 598 cCol += span; 599 if (cCol > col) { 600 if (startEdge) 601 *startEdge = startCol == col; 602 if (endEdge) 603 *endEdge = endCol == col; 604 return colElem; 605 } 611 if (child->isTableCol()) 612 break; 613 if (child != m_caption) 614 return 0; 615 child = child->nextSibling(); 616 } 617 if (!child) 618 return 0; 619 620 RenderTableCol* colElem = toRenderTableCol(child); 621 while (colElem) { 622 int span = colElem->span(); 623 if (!colElem->firstChild()) { 624 int startCol = cCol; 625 int endCol = cCol + span - 1; 626 cCol += span; 627 if (cCol > col) { 628 if (startEdge) 629 *startEdge = startCol == col; 630 if (endEdge) 631 *endEdge = endCol == col; 632 return colElem; 606 633 } 607 608 RenderObject* next = child->firstChild(); 609 if (!next) 610 next = child->nextSibling(); 611 if (!next && child->parent()->isTableCol()) 612 next = child->parent()->nextSibling(); 613 child = next; 614 } else if (child == m_caption) 615 child = child->nextSibling(); 616 else 617 break; 634 } 635 colElem = nextColElement(colElem); 618 636 } 619 637 -
trunk/WebCore/rendering/RenderTable.h
r46647 r56319 114 114 115 115 RenderTableCol* colElement(int col, bool* startEdge = 0, bool* endEdge = 0) const; 116 RenderTableCol* nextColElement(RenderTableCol* current) const; 116 117 117 118 bool needsSectionRecalc() const { return m_needsSectionRecalc; } -
trunk/WebCore/rendering/RenderTableCell.cpp
r54784 r56319 84 84 { 85 85 Length w = style()->width(); 86 if ( colSpan() > 1 ||!w.isAuto())86 if (!w.isAuto()) 87 87 return w; 88 88 89 RenderTableCol* tableCol = table()->colElement(col()); 90 89 91 if (tableCol) { 90 w = tableCol->style()->width(); 91 92 int colSpanCount = colSpan(); 93 94 Length colWidthSum = Length(0, Fixed); 95 for (int i = 1; i <= colSpanCount; i++) { 96 Length colWidth = tableCol->style()->width(); 97 98 // Percentage value should be returned only for colSpan == 1. 99 // Otherwise we return original width for the cell. 100 if (!colWidth.isFixed()) { 101 if (colSpanCount > 1) 102 return w; 103 return colWidth; 104 } 105 106 colWidthSum = Length(colWidthSum.value() + colWidth.value(), Fixed); 107 108 tableCol = table()->nextColElement(tableCol); 109 // If no next <col> tag found for the span we just return what we have for now. 110 if (!tableCol) 111 break; 112 } 113 92 114 // Column widths specified on <col> apply to the border box of the cell. 93 115 // Percentages don't need to be handled since they're always treated this way (even when specified on the cells). 94 116 // See Bugzilla bug 8126 for details. 95 if (w.isFixed() && w.value() > 0) 96 w = Length(max(0, w.value() - borderLeft() - borderRight() - paddingLeft() - paddingRight()), Fixed); 97 } 117 if (colWidthSum.isFixed() && colWidthSum.value() > 0) 118 colWidthSum = Length(max(0, colWidthSum.value() - borderLeft() - borderRight() - paddingLeft() - paddingRight()), Fixed); 119 return colWidthSum; 120 } 121 98 122 return w; 99 123 }
Note: See TracChangeset
for help on using the changeset viewer.