+2008-08-23 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - test and updated results for <rdar://problem/6065143> Reflowed image in first line of table doesn't affect baseline
+
+ * fast/table/vertical-align-baseline.html: Added.
+ * platform/mac/fast/table/form-with-table-style-expected.checksum:
+ * platform/mac/fast/table/form-with-table-style-expected.png:
+ * platform/mac/fast/table/form-with-table-style-expected.txt:
+ * platform/mac/fast/table/vertical-align-baseline-expected.checksum: Added.
+ * platform/mac/fast/table/vertical-align-baseline-expected.png: Added.
+ * platform/mac/fast/table/vertical-align-baseline-expected.txt: Added.
+ * platform/mac/tables/mozilla/bugs/bug3037-1-expected.txt:
+ * platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.checksum:
+ * platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png:
+ * platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt:
+
2008-08-22 Timothy Hatcher <timothy@apple.com>
Test for the tests the parsing and retrieval of the overflow,
--- /dev/null
+<!DOCTYPE html>
+<style>
+ .float { float: left; width: 25px; height: 30px; background-color: lightgreen; }
+</style>
+<table border>
+ <tr>
+ <td style="vertical-align: baseline; height: 400px;">
+ Lorem
+ </td>
+ <td style="vertical-align: baseline;">
+ ipsum <span style="font-size: 36px;">dolor</span>
+ </td>
+ <td style="vertical-align: baseline;">
+ <div>sit</div>
+ </td>
+ <td style="vertical-align: baseline;">
+ <div style="background-color: lightblue; width: 50px; height: 100px;">amet</div>
+ </td>
+ <td style="vertical-align: baseline; width: 60px;">
+ consec
+ <div style="width: 60px; height: 50px; position: absolute; top: 0; background-color: lightyellow;">P</div>
+ </td>
+ <td style="vertical-align: baseline;">
+ <table border style="-webkit-border-vertical-spacing: 10px;">
+ <tr>
+ <td style="padding-top: 5px; border-top: 10px solid blue; border-bottom: 5px solid blue; vertical-align: baseline;">tetuer<br>adipiscing.</td>
+ </tr>
+ </table>
+ </td>
+ <td style="vertical-align: baseline; width: 60px;">
+ <div style="width: 60px; height: 50px; position: absolute; background-color: lightyellow;">P</div>
+ </td>
+ <td style="vertical-align: baseline;">
+ <div style="background-color: lightpink; width: 50px; height: 100px;"></div>
+ </td>
+ <td style="vertical-align: baseline;">
+ <table border cellpadding="5">
+ <tr style="height: 80px;">
+ <td style="padding-top: 15px; border-top: 10px solid blue; border-bottom: 5px solid blue; vertical-align: bottom;"><div style="background-color: lightpink;">Lorem</div></td>
+ </tr>
+ <tr>
+ <td>ipsum</td>
+ </tr>
+ </table>
+ dolor sit<br>amet.
+ </td>
+ <td style="vertical-align: baseline; width: 60px;">
+ <div class="float">F1</div>
+ <div class="float">F2</div>
+ <div class="float">F3</div>
+ </td>
+ </tr>
+</table>
-09ccc872b5c0ddb9c4b05a0fddf29cb4
\ No newline at end of file
+67c33a3fa50c51faaac4c19642e19844
\ No newline at end of file
RenderTableCell (anonymous) at (0,0) size 123x18 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 123x18
text run at (0,0) width 123: "display: inline-table"
- RenderBlock {DIV} at (0,324) size 784x14
- RenderTable at (0,0) size 155x14
- RenderTableSection {FORM} at (0,0) size 155x14
- RenderTableRow (anonymous) at (0,0) size 155x14
+ RenderBlock {DIV} at (0,324) size 784x0
+ RenderTable at (0,0) size 155x0
+ RenderTableSection {FORM} at (0,0) size 155x0
+ RenderTableRow (anonymous) at (0,0) size 155x0
RenderTableCell (anonymous) at (0,0) size 155x0 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,338) size 784x14
- RenderTable at (0,0) size 172x14
- RenderTableSection {FORM} at (0,0) size 172x14
- RenderTableRow (anonymous) at (0,0) size 172x14
+ RenderBlock {DIV} at (0,324) size 784x0
+ RenderTable at (0,0) size 172x0
+ RenderTableSection {FORM} at (0,0) size 172x0
+ RenderTableRow (anonymous) at (0,0) size 172x0
RenderTableCell (anonymous) at (0,0) size 172x0 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,352) size 784x14
- RenderTable at (0,0) size 167x14
- RenderTableSection {FORM} at (0,0) size 167x14
- RenderTableRow (anonymous) at (0,0) size 167x14
+ RenderBlock {DIV} at (0,324) size 784x0
+ RenderTable at (0,0) size 167x0
+ RenderTableSection {FORM} at (0,0) size 167x0
+ RenderTableRow (anonymous) at (0,0) size 167x0
RenderTableCell (anonymous) at (0,0) size 167x0 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,366) size 784x18
+ RenderBlock {DIV} at (0,324) size 784x18
RenderTable at (0,0) size 113x18
RenderTableSection (anonymous) at (0,0) size 113x18
RenderTableRow {FORM} at (0,0) size 113x18
RenderTableCell (anonymous) at (0,0) size 113x18 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 113x18
text run at (0,0) width 113: "display: table-row"
- RenderBlock {DIV} at (0,384) size 784x0
+ RenderBlock {DIV} at (0,342) size 784x0
RenderTable at (0,0) size 0x0
RenderTableCol {FORM} at (0,0) size 0x0
- RenderBlock {DIV} at (0,384) size 784x0
+ RenderBlock {DIV} at (0,342) size 784x0
RenderTableCol {FORM} at (0,0) size 0x0
- RenderBlock {DIV} at (0,400) size 784x18
+ RenderBlock {DIV} at (0,358) size 784x18
RenderTable at (0,0) size 110x18
RenderTableSection (anonymous) at (0,0) size 110x18
RenderTableRow (anonymous) at (0,0) size 110x18
RenderTableCell {FORM} at (0,0) size 110x18 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (0,0) size 110x18
text run at (0,0) width 110: "display: table-cell"
- RenderBlock {DIV} at (0,418) size 784x0
+ RenderBlock {DIV} at (0,376) size 784x0
RenderTable at (0,0) size 49x0
RenderBlock {FORM} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
--- /dev/null
+fb1d964f962b642e5301046630a9e31a
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x512
+ RenderBlock {HTML} at (0,0) size 800x512
+ RenderBody {BODY} at (8,8) size 784x496
+ RenderTable {TABLE} at (0,0) size 656x496 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 654x494
+ RenderTableRow {TR} at (0,2) size 654x490
+ RenderTableCell {TD} at (2,88) size 46x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 42x18
+ text run at (2,2) width 42: "Lorem"
+ RenderTableCell {TD} at (50,70) size 122x45 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (2,20) size 42x18
+ text run at (2,20) width 42: "ipsum "
+ RenderInline {SPAN} at (0,0) size 76x41
+ RenderText {#text} at (44,2) size 76x41
+ text run at (44,2) width 76: "dolor"
+ RenderText {#text} at (0,0) size 0x0
+ RenderTableCell {TD} at (174,88) size 18x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+ RenderBlock {DIV} at (2,2) size 14x18
+ RenderText {#text} at (0,0) size 14x18
+ text run at (0,0) width 14: "sit"
+ RenderTableCell {TD} at (194,88) size 54x104 [border: (1px inset #808080)] [r=0 c=3 rs=1 cs=1]
+ RenderBlock {DIV} at (2,2) size 50x100 [bgcolor=#ADD8E6]
+ RenderText {#text} at (0,0) size 30x18
+ text run at (0,0) width 30: "amet"
+ RenderTableCell {TD} at (250,88) size 64x22 [border: (1px inset #808080)] [r=0 c=4 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 43x18
+ text run at (2,2) width 43: "consec"
+ RenderText {#text} at (0,0) size 0x0
+ RenderTableCell {TD} at (316,62) size 82x83 [border: (1px inset #808080)] [r=0 c=5 rs=1 cs=1]
+ RenderTable {TABLE} at (2,2) size 78x79 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 76x77
+ RenderTableRow {TR} at (0,10) size 76x57
+ RenderTableCell {TD} at (2,10) size 72x57 [border: (10px solid #0000FF) (1px inset #808080) (5px solid #0000FF) (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,15) size 35x18
+ text run at (2,15) width 35: "tetuer"
+ RenderBR {BR} at (37,15) size 0x18
+ RenderText {#text} at (2,33) size 68x18
+ text run at (2,33) width 68: "adipiscing."
+ RenderTableCell {TD} at (400,102) size 64x4 [border: (1px inset #808080)] [r=0 c=6 rs=1 cs=1]
+ RenderTableCell {TD} at (466,2) size 54x104 [border: (1px inset #808080)] [r=0 c=7 rs=1 cs=1]
+ RenderBlock {DIV} at (2,2) size 50x100 [bgcolor=#FFB6C1]
+ RenderTableCell {TD} at (522,29) size 64x158 [border: (1px inset #808080)] [r=0 c=8 rs=1 cs=1]
+ RenderTable {TABLE} at (2,2) size 60x118 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 58x116
+ RenderTableRow {TR} at (0,2) size 58x80
+ RenderTableCell {TD} at (2,29) size 54x53 [border: (10px solid #0000FF) (1px inset #808080) (5px solid #0000FF) (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderBlock {DIV} at (6,25) size 42x18 [bgcolor=#FFB6C1]
+ RenderText {#text} at (0,0) size 42x18
+ text run at (0,0) width 42: "Lorem"
+ RenderTableRow {TR} at (0,84) size 58x30
+ RenderTableCell {TD} at (2,84) size 54x30 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (6,6) size 38x18
+ text run at (6,6) width 38: "ipsum"
+ RenderBlock (anonymous) at (2,120) size 60x36
+ RenderText {#text} at (0,0) size 51x18
+ text run at (0,0) width 51: "dolor sit"
+ RenderBR {BR} at (51,0) size 0x18
+ RenderText {#text} at (0,18) size 34x18
+ text run at (0,18) width 34: "amet."
+ RenderTableCell {TD} at (588,42) size 64x64 [border: (1px inset #808080)] [r=0 c=9 rs=1 cs=1]
+ RenderBlock (floating) {DIV} at (2,2) size 25x30 [bgcolor=#90EE90]
+ RenderText {#text} at (0,0) size 17x18
+ text run at (0,0) width 17: "F1"
+ RenderBlock (floating) {DIV} at (27,2) size 25x30 [bgcolor=#90EE90]
+ RenderText {#text} at (0,0) size 17x18
+ text run at (0,0) width 17: "F2"
+ RenderBlock (floating) {DIV} at (2,32) size 25x30 [bgcolor=#90EE90]
+ RenderText {#text} at (0,0) size 17x18
+ text run at (0,0) width 17: "F3"
+layer at (261,0) size 60x50
+ RenderBlock (positioned) {DIV} at (261,0) size 60x50 [bgcolor=#FFFFE0]
+ RenderText {#text} at (0,0) size 9x18
+ text run at (0,0) width 9: "P"
+layer at (411,113) size 60x50
+ RenderBlock (positioned) {DIV} at (411,113) size 60x50 [bgcolor=#FFFFE0]
+ RenderText {#text} at (0,0) size 9x18
+ text run at (0,0) width 9: "P"
RenderText {#text} at (0,0) size 33x18
text run at (0,0) width 33: "Back"
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {HTML:SPAN} at (33,0) size 1x0 [r=0 c=1 rs=1 cs=1]
+ RenderTableCell {HTML:SPAN} at (33,14) size 1x0 [r=0 c=1 rs=1 cs=1]
RenderInline {HTML:INPUT} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderBlock (anonymous) at (0,18) size 784x0
-5c0af7034a8f140da8a6605657a4898c
\ No newline at end of file
+089b6c3dad58614ddba279809f4d3fba
\ No newline at end of file
-layer at (0,0) size 785x1792
+layer at (0,0) size 785x1415
RenderView at (0,0) size 785x600
-layer at (8,8) size 769x1776
- RenderBlock {HTML} at (8,8) size 769x1776 [bgcolor=#008000] [border: (16px solid #00FF00)]
- RenderTable at (16,16) size 737x1744
- RenderTableSection (anonymous) at (0,0) size 737x1744
- RenderTableRow (anonymous) at (0,0) size 737x1744
+layer at (8,8) size 769x1399
+ RenderBlock {HTML} at (8,8) size 769x1399 [bgcolor=#008000] [border: (16px solid #00FF00)]
+ RenderTable at (16,16) size 737x1367
+ RenderTableSection (anonymous) at (0,0) size 737x1367
+ RenderTableRow (anonymous) at (0,0) size 737x1367
RenderTableCell {HEAD} at (0,0) size 237x490 [color=#FFFFFF] [bgcolor=#FF0000] [border: (5px solid #FFFFFF)] [r=0 c=0 rs=1 cs=1]
RenderBlock {META} at (21,37) size 195x2 [border: (1px dotted #FFFFFF)]
RenderBlock {META} at (21,55) size 195x2 [border: (1px dotted #FFFFFF)]
text run at (124,217) width 59: "BODY {"
text run at (1,235) width 170: "color: yellow; background:"
text run at (1,253) width 38: "teal; }"
- RenderTableCell {BODY} at (237,418) size 500x1326 [color=#FFFF00] [bgcolor=#008080] [border: (5px solid #FFFF00)] [r=0 c=1 rs=1 cs=1]
+ RenderTableCell {BODY} at (237,41) size 500x1326 [color=#FFFF00] [bgcolor=#008080] [border: (5px solid #FFFF00)] [r=0 c=1 rs=1 cs=1]
RenderBlock {H1} at (21,53) size 458x76 [border: (1px dotted #FFFF00)]
RenderText {#text} at (1,1) size 152x37
text run at (1,1) width 152: "Rendering "
RenderBlock {P} at (21,1269) size 458x20 [border: (1px dotted #FFFF00)]
RenderText {#text} at (1,1) size 170x18
text run at (1,1) width 170: "Last updated in June 1999."
-layer at (358,1570) size 142x13
+layer at (358,1193) size 142x13
RenderBlock {DIV} at (3,3) size 142x13
+2008-08-23 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - fix <rdar://problem/6065143> Reflowed image in first line of table doesn't affect baseline
+
+ Test: fast/table/vertical-align-baseline.html
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::getBaselineOfFirstLineBox): Added. Returns the
+ baseline of the first table row, if there is one, -1 otherwise.
+ * rendering/RenderTable.h:
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::baselinePosition): Changed to follow the
+ CSS2.1 definition of the baseline of a table cell.
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::getBaselineOfFirstLineBox): Added. Returns
+ the baseline of the first row in the section.
+ * rendering/RenderTableSection.h:
+
2008-08-18 Jon Honeycutt <jhoneycutt@apple.com>
Add SPI to make a Windows WebView transparent.
{
}
+int RenderTable::getBaselineOfFirstLineBox() const
+{
+ RenderTableSection* firstNonEmptySection = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
+ if (firstNonEmptySection && !firstNonEmptySection->numRows())
+ firstNonEmptySection = sectionBelow(firstNonEmptySection, true);
+
+ if (!firstNonEmptySection)
+ return -1;
+
+ return firstNonEmptySection->yPos() + firstNonEmptySection->getBaselineOfFirstLineBox();
+}
+
IntRect RenderTable::getOverflowClipRect(int tx, int ty)
{
IntRect rect = RenderBlock::getOverflowClipRect(tx, ty);
virtual void layout();
virtual void calcPrefWidths();
+ virtual int getBaselineOfFirstLineBox() const;
+
virtual RenderBlock* firstLineBlock() const;
virtual void updateFirstLetter();
int RenderTableCell::baselinePosition(bool /*firstLine*/, bool /*isRootLineBox*/) const
{
- RenderObject* o = firstChild();
- int offset = paddingTop() + borderTop();
-
- if (!o)
- return offset + contentHeight();
- while (o->firstChild() && !o->isReplaced()) {
- if (!o->isInline())
- offset += o->paddingTop() + o->borderTop();
- o = o->firstChild();
- }
-
- if (!o->isInline())
- return paddingTop() + borderTop() + contentHeight();
+ // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of
+ // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
+ // is no such line box or table-row, the baseline is the bottom of content edge of the cell box.
+
+ int firstLineBaseline = getBaselineOfFirstLineBox();
+ if (firstLineBaseline != -1)
+ return firstLineBaseline;
- offset += o->baselinePosition(true);
- return offset;
+ return paddingTop() + borderTop() + contentHeight();
}
void RenderTableCell::setStyle(RenderStyle* newStyle)
m_outerBorderRight = calcOuterBorderRight(rtl);
}
+int RenderTableSection::getBaselineOfFirstLineBox() const
+{
+ if (!m_gridRows)
+ return -1;
+
+ int firstLineBaseline = m_grid[0].baseline;
+ if (firstLineBaseline)
+ return firstLineBaseline + m_rowPos[0];
+
+ firstLineBaseline = -1;
+ Row* firstRow = m_grid[0].row;
+ for (size_t i = 0; i < firstRow->size(); ++i) {
+ RenderTableCell* cell = firstRow->at(i).cell;
+ if (cell)
+ firstLineBaseline = max(firstLineBaseline, cell->yPos() + cell->paddingTop() + cell->borderTop() + cell->contentHeight());
+ }
+
+ return firstLineBaseline;
+}
void RenderTableSection::paint(PaintInfo& paintInfo, int tx, int ty)
{
virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const { return 0; }
virtual void position(InlineBox*) { }
+ virtual int getBaselineOfFirstLineBox() const;
+
void addCell(RenderTableCell*, RenderObject* row);
void setCellWidths();