Title: [140907] trunk
- Revision
- 140907
- Author
- [email protected]
- Date
- 2013-01-26 01:36:34 -0800 (Sat, 26 Jan 2013)
Log Message
REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
https://bugs.webkit.org/show_bug.cgi?id=106571
Reviewed by Julien Chaffraix.
Source/WebCore:
When a cell spans multiple rows, its baseline is set on the first row it spans. r120616 contained a
couple of errors in its attempt to ensure the row height calculated in such cases was correct. When it
calculated the baseline on the first row in the span, it didn't ensure that the row height was increased
if necessary. It also suffered from allowing the baseline descent calculated on a rowspan to affect the
height of the other cells in the first row of the span.
Fix both of these errors in calcRowLogicalHeight() and refactor the calculation of the baseline and baseline
descent so that it is freestanding (rather than depending on the height of the section so far).
Tests: fast/css/vertical-align-baseline-rowspan-010.html
fast/css/vertical-align-baseline-rowspan-011.html
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):
LayoutTests:
* fast/css/vertical-align-baseline-rowspan-010-expected.html: Added.
* fast/css/vertical-align-baseline-rowspan-010.html: Added.
* fast/css/vertical-align-baseline-rowspan-011-expected.html: Added.
* fast/css/vertical-align-baseline-rowspan-011.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (140906 => 140907)
--- trunk/LayoutTests/ChangeLog 2013-01-26 08:13:41 UTC (rev 140906)
+++ trunk/LayoutTests/ChangeLog 2013-01-26 09:36:34 UTC (rev 140907)
@@ -1,3 +1,15 @@
+2013-01-26 Robert Hogan <[email protected]>
+
+ REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
+ https://bugs.webkit.org/show_bug.cgi?id=106571
+
+ Reviewed by Julien Chaffraix.
+
+ * fast/css/vertical-align-baseline-rowspan-010-expected.html: Added.
+ * fast/css/vertical-align-baseline-rowspan-010.html: Added.
+ * fast/css/vertical-align-baseline-rowspan-011-expected.html: Added.
+ * fast/css/vertical-align-baseline-rowspan-011.html: Added.
+
2013-01-25 Elliott Sprehn <[email protected]>
Make unload-reparent-sibling-frame.html wait for completion
Added: trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010-expected.html (0 => 140907)
--- trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010-expected.html 2013-01-26 09:36:34 UTC (rev 140907)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ td {
+ vertical-align:baseline;
+ font: 20px/1 Ahem;
+ }
+ img {
+ width: 100px;
+ height: 200px;
+ background-color: green;
+ }
+</style>
+</head>
+<body>
+<p> https://bugs.webkit.org/show_bug.cgi?id=106571: The baseline of the first row of cells should be aligned with the baseline of the bottom of the green box.</p>
+<table>
+ <tbody>
+ <tr>
+ <td>XXX</td><td>XXX</td><td><img></td><td>XXX</td><td>XXX</td>
+ </tr>
+ <tr>
+ <td>XXX</td><td>XXX</td><td></td><td>XXX</td><td>XXX</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010.html (0 => 140907)
--- trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010.html (rev 0)
+++ trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-010.html 2013-01-26 09:36:34 UTC (rev 140907)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ td {
+ vertical-align:baseline;
+ font: 20px/1 Ahem;
+ }
+ img {
+ width: 100px;
+ height: 200px;
+ background-color: green;
+ }
+</style>
+</head>
+<body>
+<p> https://bugs.webkit.org/show_bug.cgi?id=106571: The baseline of the first row of cells should be aligned with the baseline of the bottom of the green box.</p>
+<table>
+ <tbody>
+ <tr>
+ <td>XXX</td><td>XXX</td><td rowspan="2"><img></td><td>XXX</td><td>XXX</td>
+ </tr>
+ <tr>
+ <td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011-expected.html (0 => 140907)
--- trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011-expected.html 2013-01-26 09:36:34 UTC (rev 140907)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ td {
+ vertical-align:baseline;
+ border: 1px solid #f90;
+ }
+ img {
+ width: 100px;
+ height: 200px;
+ background-color: green;
+ }
+</style>
+</head>
+<body>
+<p> https://bugs.webkit.org/show_bug.cgi?id=106571: The baseline of the first row of cells should be aligned with the baseline of the bottom of the green box.</p>
+<table>
+ <tbody>
+ <tr>
+ <td>XXX</td><td>XXX</td><td><img src=""
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011.html (0 => 140907)
--- trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011.html (rev 0)
+++ trunk/LayoutTests/fast/css/vertical-align-baseline-rowspan-011.html 2013-01-26 09:36:34 UTC (rev 140907)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ td {
+ vertical-align:baseline;
+ border: 1px solid #f90;
+ }
+ img {
+ width: 100px;
+ height: 200px;
+ background-color: green;
+ }
+</style>
+</head>
+<body>
+<p> https://bugs.webkit.org/show_bug.cgi?id=106571: The baseline of the first row of cells should be aligned with the baseline of the bottom of the green box.</p>
+<table>
+ <tbody>
+ <tr>
+ <td>XXX</td><td>XXX</td><td rowspan="2"><img src=""
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (140906 => 140907)
--- trunk/Source/WebCore/ChangeLog 2013-01-26 08:13:41 UTC (rev 140906)
+++ trunk/Source/WebCore/ChangeLog 2013-01-26 09:36:34 UTC (rev 140907)
@@ -1,3 +1,25 @@
+2013-01-26 Robert Hogan <[email protected]>
+
+ REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
+ https://bugs.webkit.org/show_bug.cgi?id=106571
+
+ Reviewed by Julien Chaffraix.
+
+ When a cell spans multiple rows, its baseline is set on the first row it spans. r120616 contained a
+ couple of errors in its attempt to ensure the row height calculated in such cases was correct. When it
+ calculated the baseline on the first row in the span, it didn't ensure that the row height was increased
+ if necessary. It also suffered from allowing the baseline descent calculated on a rowspan to affect the
+ height of the other cells in the first row of the span.
+
+ Fix both of these errors in calcRowLogicalHeight() and refactor the calculation of the baseline and baseline
+ descent so that it is freestanding (rather than depending on the height of the section so far).
+
+ Tests: fast/css/vertical-align-baseline-rowspan-010.html
+ fast/css/vertical-align-baseline-rowspan-011.html
+
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::calcRowLogicalHeight):
+
2013-01-26 James Simonsen <[email protected]>
[chromium] Export ResourceRequest's priority through WebURLRequest
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (140906 => 140907)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2013-01-26 08:13:41 UTC (rev 140906)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2013-01-26 09:36:34 UTC (rev 140907)
@@ -318,23 +318,22 @@
int cellLogicalHeight = cell->logicalHeightForRowSizing();
m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight);
- // find out the baseline
+ // Find out the baseline. The baseline is set on the first row in a rowspan.
EVerticalAlign va = cell->style()->verticalAlign();
if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) {
LayoutUnit baselinePosition = cell->cellBaselinePosition();
if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) {
- m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore());
- baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore()));
+ m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition);
+ // The descent of a cell that spans multiple rows does not affect the height of the first row it spans, so don't let it
+ // become the baseline descent applied to the rest of the row.
+ if (cell->rowSpan() == 1)
+ baselineDescent = max(baselineDescent, cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore()));
+ m_rowPos[cellStartRow + 1] = max<int>(m_rowPos[cellStartRow + 1], m_rowPos[cellStartRow] + m_grid[cellStartRow].baseline + baselineDescent);
}
}
}
}
- // do we have baseline aligned elements?
- if (m_grid[r].baseline)
- // increase rowheight if baseline requires
- m_rowPos[r + 1] = max<int>(m_rowPos[r + 1], m_grid[r].baseline + baselineDescent);
-
// Add the border-spacing to our final position.
m_rowPos[r + 1] += m_grid[r].rowRenderer ? spacing : 0;
m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes