Commit 86d1fbd4 authored by bdash's avatar bdash

2007-01-11 Mitz Pettel <mitz@webkit.org>

        Reviewed by Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12115
          RTL text is jumbled on display

        Fixed fixed table layout. Implemented an algorithm that matches the behavior
        of Firefox, up to rounding errors.

        Fixes three existing table tests.

        * rendering/FixedTableLayout.cpp:
        Undid accidental search-and-replace of "width" to "m_width" in the comments.
        Removed an outdated comment, since WebKit no longer honors table-layout:fixed
        for variable-width tables.
        (WebCore::FixedTableLayout::calcWidthArray): Fixed the logic that finds the
        first row. Changed to divide the width specified for a cell that spans multiple
        columns between the columns rather than assign its entire width to each column.
        (WebCore::FixedTableLayout::calcMinMaxWidth):
        (WebCore::FixedTableLayout::layout): Implemented the behavior observed in
        Firefox.
        * rendering/FixedTableLayout.h:

2007-01-11  Mitz Pettel  <mitz@webkit.org>

        Reviewed by Hyatt.

        - updated results for http://bugs.webkit.org/show_bug.cgi?id=12115
          RTL text is jumbled on display
          (fixing fixed table layout)

        * tables/mozilla/bugs/bug157890-expected.checksum:
        * tables/mozilla/bugs/bug157890-expected.png:
        * tables/mozilla/bugs/bug157890-expected.txt:
        * tables/mozilla/bugs/bug44505-expected.checksum:
        * tables/mozilla/bugs/bug44505-expected.png:
        * tables/mozilla/bugs/bug44505-expected.txt:
        * tables/mozilla_expected_failures/bugs/bug7243-expected.checksum:
        * tables/mozilla_expected_failures/bugs/bug7243-expected.png:
        * tables/mozilla_expected_failures/bugs/bug7243-expected.txt:


git-svn-id: svn://svn.chromium.org/blink/trunk@18790 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 659f1193
2007-01-11 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
- updated results for http://bugs.webkit.org/show_bug.cgi?id=12115
RTL text is jumbled on display
(fixing fixed table layout)
* tables/mozilla/bugs/bug157890-expected.checksum:
* tables/mozilla/bugs/bug157890-expected.png:
* tables/mozilla/bugs/bug157890-expected.txt:
* tables/mozilla/bugs/bug44505-expected.checksum:
* tables/mozilla/bugs/bug44505-expected.png:
* tables/mozilla/bugs/bug44505-expected.txt:
* tables/mozilla_expected_failures/bugs/bug7243-expected.checksum:
* tables/mozilla_expected_failures/bugs/bug7243-expected.png:
* tables/mozilla_expected_failures/bugs/bug7243-expected.txt:
2007-01-11 Mitz Pettel <mitz@webkit.org> 2007-01-11 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt. Reviewed by Hyatt.
94c3e0cdcbd44a143545d5d7131902c1 7dd09a4474aae5290b806f3d85feb26f
\ No newline at end of file \ No newline at end of file
...@@ -42,32 +42,32 @@ layer at (0,0) size 800x484 ...@@ -42,32 +42,32 @@ layer at (0,0) size 800x484
RenderTable {TABLE} at (0,0) size 24x0 RenderTable {TABLE} at (0,0) size 24x0
RenderTableSection {TBODY} at (0,0) size 24x0 RenderTableSection {TBODY} at (0,0) size 24x0
RenderTableRow {TR} at (0,0) size 24x0 RenderTableRow {TR} at (0,0) size 24x0
RenderTableCell {TD} at (0,0) size 4x0 [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (0,0) size 2x0 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (4,0) size 4x0 [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (2,0) size 2x0 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (8,0) size 3x0 [r=0 c=2 rs=1 cs=1] RenderTableCell {TD} at (4,0) size 2x0 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (11,0) size 3x0 [r=0 c=3 rs=1 cs=1] RenderTableCell {TD} at (6,0) size 2x0 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (14,0) size 10x0 [r=0 c=4 rs=1 cs=1] RenderTableCell {TD} at (8,0) size 16x0 [r=0 c=4 rs=1 cs=1]
RenderTable {TABLE} at (0,0) size 25x0 RenderTable {TABLE} at (0,0) size 25x0
RenderTableSection {TBODY} at (0,0) size 25x0 RenderTableSection {TBODY} at (0,0) size 25x0
RenderTableRow {TR} at (0,0) size 25x0 RenderTableRow {TR} at (0,0) size 25x0
RenderTableCell {TD} at (0,0) size 4x0 [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (0,0) size 3x0 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (4,0) size 4x0 [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (3,0) size 2x0 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (8,0) size 4x0 [r=0 c=2 rs=1 cs=1] RenderTableCell {TD} at (5,0) size 2x0 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (12,0) size 3x0 [r=0 c=3 rs=1 cs=1] RenderTableCell {TD} at (7,0) size 2x0 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (15,0) size 10x0 [r=0 c=4 rs=1 cs=1] RenderTableCell {TD} at (9,0) size 16x0 [r=0 c=4 rs=1 cs=1]
RenderTable {TABLE} at (0,0) size 100x0 RenderTable {TABLE} at (0,0) size 17x0
RenderTableSection {TBODY} at (0,0) size 100x0 RenderTableSection {TBODY} at (0,0) size 17x0
RenderTableRow {TR} at (0,0) size 100x0 RenderTableRow {TR} at (0,0) size 17x0
RenderTableCell {TD} at (0,0) size 10x0 [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (0,0) size 2x0 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (10,0) size 10x0 [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (2,0) size 2x0 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (20,0) size 10x0 [r=0 c=2 rs=1 cs=1] RenderTableCell {TD} at (4,0) size 2x0 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (30,0) size 10x0 [r=0 c=3 rs=1 cs=1] RenderTableCell {TD} at (6,0) size 2x0 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (40,0) size 10x0 [r=0 c=4 rs=1 cs=1] RenderTableCell {TD} at (8,0) size 2x0 [r=0 c=4 rs=1 cs=1]
RenderTableCell {TD} at (50,0) size 10x0 [r=0 c=5 rs=1 cs=1] RenderTableCell {TD} at (10,0) size 2x0 [r=0 c=5 rs=1 cs=1]
RenderTableCell {TD} at (60,0) size 10x0 [r=0 c=6 rs=1 cs=1] RenderTableCell {TD} at (12,0) size 2x0 [r=0 c=6 rs=1 cs=1]
RenderTableCell {TD} at (70,0) size 10x0 [r=0 c=7 rs=1 cs=1] RenderTableCell {TD} at (14,0) size 1x0 [r=0 c=7 rs=1 cs=1]
RenderTableCell {TD} at (80,0) size 10x0 [r=0 c=8 rs=1 cs=1] RenderTableCell {TD} at (15,0) size 1x0 [r=0 c=8 rs=1 cs=1]
RenderTableCell {TD} at (90,0) size 10x0 [r=0 c=9 rs=1 cs=1] RenderTableCell {TD} at (16,0) size 1x0 [r=0 c=9 rs=1 cs=1]
RenderBlock {PRE} at (0,13) size 784x450 RenderBlock {PRE} at (0,13) size 784x450
RenderText {#text} at (0,0) size 216x15 RenderText {#text} at (0,0) size 216x15
text run at (0,0) width 216: "Specified table width: 25px" text run at (0,0) width 216: "Specified table width: 25px"
...@@ -245,15 +245,15 @@ layer at (0,0) size 800x484 ...@@ -245,15 +245,15 @@ layer at (0,0) size 800x484
RenderText {#text} at (0,270) size 168x15 RenderText {#text} at (0,270) size 168x15
text run at (0,270) width 168: "Actual TD widths: " text run at (0,270) width 168: "Actual TD widths: "
RenderText {#text} at (168,270) size 32x15 RenderText {#text} at (168,270) size 32x15
text run at (168,270) width 32: "4px " text run at (168,270) width 32: "2px "
RenderText {#text} at (200,270) size 32x15 RenderText {#text} at (200,270) size 32x15
text run at (200,270) width 32: "4px " text run at (200,270) width 32: "2px "
RenderText {#text} at (232,270) size 32x15 RenderText {#text} at (232,270) size 32x15
text run at (232,270) width 32: "3px " text run at (232,270) width 32: "2px "
RenderText {#text} at (264,270) size 32x15 RenderText {#text} at (264,270) size 32x15
text run at (264,270) width 32: "3px " text run at (264,270) width 32: "2px "
RenderText {#text} at (296,270) size 40x15 RenderText {#text} at (296,270) size 40x15
text run at (296,270) width 40: "10px " text run at (296,270) width 40: "16px "
RenderText {#text} at (336,270) size 336x30 RenderText {#text} at (336,270) size 336x30
text run at (336,270) width 0: " " text run at (336,270) width 0: " "
text run at (0,285) width 0: " " text run at (0,285) width 0: " "
...@@ -280,24 +280,24 @@ layer at (0,0) size 800x484 ...@@ -280,24 +280,24 @@ layer at (0,0) size 800x484
RenderText {#text} at (0,345) size 168x15 RenderText {#text} at (0,345) size 168x15
text run at (0,345) width 168: "Actual TD widths: " text run at (0,345) width 168: "Actual TD widths: "
RenderText {#text} at (168,345) size 32x15 RenderText {#text} at (168,345) size 32x15
text run at (168,345) width 32: "4px " text run at (168,345) width 32: "3px "
RenderText {#text} at (200,345) size 32x15 RenderText {#text} at (200,345) size 32x15
text run at (200,345) width 32: "4px " text run at (200,345) width 32: "2px "
RenderText {#text} at (232,345) size 32x15 RenderText {#text} at (232,345) size 32x15
text run at (232,345) width 32: "4px " text run at (232,345) width 32: "2px "
RenderText {#text} at (264,345) size 32x15 RenderText {#text} at (264,345) size 32x15
text run at (264,345) width 32: "3px " text run at (264,345) width 32: "2px "
RenderText {#text} at (296,345) size 40x15 RenderText {#text} at (296,345) size 40x15
text run at (296,345) width 40: "10px " text run at (296,345) width 40: "16px "
RenderText {#text} at (336,345) size 336x30 RenderText {#text} at (336,345) size 336x30
text run at (336,345) width 0: " " text run at (336,345) width 0: " "
text run at (0,360) width 0: " " text run at (0,360) width 0: " "
RenderText {#text} at (0,375) size 216x15 RenderText {#text} at (0,375) size 216x15
text run at (0,375) width 216: "Specified table width: 17px" text run at (0,375) width 216: "Specified table width: 17px"
text run at (216,375) width 0: " " text run at (216,375) width 0: " "
RenderText {#text} at (0,390) size 224x15 RenderText {#text} at (0,390) size 216x15
text run at (0,390) width 224: "Actual table width: 100px" text run at (0,390) width 216: "Actual table width: 17px"
text run at (224,390) width 0: " " text run at (216,390) width 0: " "
RenderText {#text} at (0,405) size 168x15 RenderText {#text} at (0,405) size 168x15
text run at (0,405) width 168: "Specified TD widths: " text run at (0,405) width 168: "Specified TD widths: "
RenderText {#text} at (168,405) size 32x15 RenderText {#text} at (168,405) size 32x15
...@@ -324,26 +324,26 @@ layer at (0,0) size 800x484 ...@@ -324,26 +324,26 @@ layer at (0,0) size 800x484
text run at (488,405) width 0: " " text run at (488,405) width 0: " "
RenderText {#text} at (0,420) size 168x15 RenderText {#text} at (0,420) size 168x15
text run at (0,420) width 168: "Actual TD widths: " text run at (0,420) width 168: "Actual TD widths: "
RenderText {#text} at (168,420) size 40x15 RenderText {#text} at (168,420) size 32x15
text run at (168,420) width 40: "10px " text run at (168,420) width 32: "2px "
RenderText {#text} at (208,420) size 40x15 RenderText {#text} at (200,420) size 32x15
text run at (208,420) width 40: "10px " text run at (200,420) width 32: "2px "
RenderText {#text} at (248,420) size 40x15 RenderText {#text} at (232,420) size 32x15
text run at (248,420) width 40: "10px " text run at (232,420) width 32: "2px "
RenderText {#text} at (288,420) size 40x15 RenderText {#text} at (264,420) size 32x15
text run at (288,420) width 40: "10px " text run at (264,420) width 32: "2px "
RenderText {#text} at (328,420) size 40x15 RenderText {#text} at (296,420) size 32x15
text run at (328,420) width 40: "10px " text run at (296,420) width 32: "2px "
RenderText {#text} at (368,420) size 40x15 RenderText {#text} at (328,420) size 32x15
text run at (368,420) width 40: "10px " text run at (328,420) width 32: "2px "
RenderText {#text} at (408,420) size 40x15 RenderText {#text} at (360,420) size 32x15
text run at (408,420) width 40: "10px " text run at (360,420) width 32: "2px "
RenderText {#text} at (448,420) size 40x15 RenderText {#text} at (392,420) size 32x15
text run at (448,420) width 40: "10px " text run at (392,420) width 32: "1px "
RenderText {#text} at (488,420) size 40x15 RenderText {#text} at (424,420) size 32x15
text run at (488,420) width 40: "10px " text run at (424,420) width 32: "1px "
RenderText {#text} at (528,420) size 40x15 RenderText {#text} at (456,420) size 32x15
text run at (528,420) width 40: "10px " text run at (456,420) width 32: "1px "
RenderText {#text} at (568,420) size 568x30 RenderText {#text} at (488,420) size 488x30
text run at (568,420) width 0: " " text run at (488,420) width 0: " "
text run at (0,435) width 0: " " text run at (0,435) width 0: " "
3dc0ee2d6ae1cea2c88defc9405414a2 2dddf239d6fc289d8e025d9b6b2a0a50
\ No newline at end of file \ No newline at end of file
...@@ -73,20 +73,20 @@ layer at (213,87) size 100x22 clip at (214,88) size 98x20 ...@@ -73,20 +73,20 @@ layer at (213,87) size 100x22 clip at (214,88) size 98x20
RenderTableCell {TD} at (204,26) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1] RenderTableCell {TD} at (204,26) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 4x18 RenderText {#text} at (2,2) size 4x18
text run at (2,2) width 4: " " text run at (2,2) width 4: " "
layer at (11,115) size 186x22 clip at (12,116) size 184x20 layer at (11,115) size 233x22 clip at (12,116) size 231x20
RenderTableCell {TD} at (2,2) size 186x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (2,2) size 233x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 4x18 RenderText {#text} at (2,2) size 4x18
text run at (2,2) width 4: " " text run at (2,2) width 4: " "
layer at (199,115) size 106x22 clip at (200,116) size 104x20 layer at (246,115) size 59x22 clip at (247,116) size 57x20
RenderTableCell {TD} at (190,2) size 106x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (237,2) size 59x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 4x18 RenderText {#text} at (2,2) size 4x18
text run at (2,2) width 4: " " text run at (2,2) width 4: " "
layer at (11,139) size 186x22 clip at (12,140) size 184x20 layer at (11,139) size 233x22 clip at (12,140) size 231x20
RenderTableCell {TD} at (2,26) size 186x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1] RenderTableCell {TD} at (2,26) size 233x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 4x18 RenderText {#text} at (2,2) size 4x18
text run at (2,2) width 4: " " text run at (2,2) width 4: " "
layer at (199,139) size 106x22 clip at (200,140) size 104x20 layer at (246,139) size 59x22 clip at (247,140) size 57x20
RenderTableCell {TD} at (190,26) size 106x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1] RenderTableCell {TD} at (237,26) size 59x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 4x18 RenderText {#text} at (2,2) size 4x18
text run at (2,2) width 4: " " text run at (2,2) width 4: " "
layer at (11,167) size 150x22 clip at (12,168) size 148x20 layer at (11,167) size 150x22 clip at (12,168) size 148x20
......
cea4667d98e0d80f994bddcf9cc10b3e 7be8b6d1e975ddade007fb9f4cb9f53f
\ No newline at end of file \ No newline at end of file
...@@ -21,10 +21,10 @@ layer at (0,0) size 800x600 ...@@ -21,10 +21,10 @@ layer at (0,0) size 800x600
RenderTableCol {COL} at (0,0) size 0x0 RenderTableCol {COL} at (0,0) size 0x0
RenderTableSection {TBODY} at (1,1) size 398x22 RenderTableSection {TBODY} at (1,1) size 398x22
RenderTableRow {TR} at (0,0) size 398x22 RenderTableRow {TR} at (0,0) size 398x22
RenderTableCell {TD} at (0,0) size 149x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (0,0) size 133x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderTableCell {TD} at (149,0) size 249x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (133,0) size 265x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 20x18 RenderText {#text} at (2,2) size 20x18
text run at (2,2) width 20: "bar" text run at (2,2) width 20: "bar"
RenderBlock (anonymous) at (0,86) size 784x18 RenderBlock (anonymous) at (0,86) size 784x18
...@@ -68,20 +68,20 @@ layer at (0,0) size 800x600 ...@@ -68,20 +68,20 @@ layer at (0,0) size 800x600
RenderTable {TABLE} at (0,252) size 784x106 [border: (1px outset #808080)] RenderTable {TABLE} at (0,252) size 784x106 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 782x104 RenderTableSection {TBODY} at (1,1) size 782x104
RenderTableRow {TR} at (0,20) size 782x22 RenderTableRow {TR} at (0,20) size 782x22
RenderTableCell {TD} at (20,20) size 422x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2] RenderTableCell {TD} at (20,20) size 301x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderTableCell {TD} at (462,20) size 300x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1] RenderTableCell {TD} at (341,20) size 421x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 20x18 RenderText {#text} at (2,2) size 20x18
text run at (2,2) width 20: "bar" text run at (2,2) width 20: "bar"
RenderTableRow {TR} at (0,62) size 782x22 RenderTableRow {TR} at (0,62) size 782x22
RenderTableCell {TD} at (20,62) size 201x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1] RenderTableCell {TD} at (20,62) size 141x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderTableCell {TD} at (241,62) size 201x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1] RenderTableCell {TD} at (181,62) size 140x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 20x18 RenderText {#text} at (2,2) size 20x18
text run at (2,2) width 20: "bar" text run at (2,2) width 20: "bar"
RenderTableCell {TD} at (462,62) size 300x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1] RenderTableCell {TD} at (341,62) size 421x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 20x18 RenderText {#text} at (2,2) size 20x18
text run at (2,2) width 20: "bar" text run at (2,2) width 20: "bar"
RenderBlock (anonymous) at (0,358) size 784x18 RenderBlock (anonymous) at (0,358) size 784x18
...@@ -104,13 +104,13 @@ layer at (0,0) size 800x600 ...@@ -104,13 +104,13 @@ layer at (0,0) size 800x600
RenderTableCol {COL} at (0,0) size 0x0 RenderTableCol {COL} at (0,0) size 0x0
RenderTableSection {TBODY} at (1,1) size 98x42 RenderTableSection {TBODY} at (1,1) size 98x42
RenderTableRow {TR} at (0,10) size 98x22 RenderTableRow {TR} at (0,10) size 98x22
RenderTableCell {TD} at (10,10) size 23x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] RenderTableCell {TD} at (10,10) size 16x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderTableCell {TD} at (43,10) size 34x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] RenderTableCell {TD} at (36,10) size 22x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderTableCell {TD} at (87,10) size 20x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1] RenderTableCell {TD} at (68,10) size 20x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18 RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo" text run at (2,2) width 21: "foo"
RenderBlock (anonymous) at (0,538) size 784x18 RenderBlock (anonymous) at (0,538) size 784x18
......
2007-01-11 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
- fix http://bugs.webkit.org/show_bug.cgi?id=12115
RTL text is jumbled on display
Fixed fixed table layout. Implemented an algorithm that matches the behavior
of Firefox, up to rounding errors.
Fixes three existing table tests.
* rendering/FixedTableLayout.cpp:
Undid accidental search-and-replace of "width" to "m_width" in the comments.
Removed an outdated comment, since WebKit no longer honors table-layout:fixed
for variable-width tables.
(WebCore::FixedTableLayout::calcWidthArray): Fixed the logic that finds the
first row. Changed to divide the width specified for a cell that spans multiple
columns between the columns rather than assign its entire width to each column.
(WebCore::FixedTableLayout::calcMinMaxWidth):
(WebCore::FixedTableLayout::layout): Implemented the behavior observed in
Firefox.
* rendering/FixedTableLayout.h:
2007-01-11 Mitz Pettel <mitz@webkit.org> 2007-01-11 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt. Reviewed by Hyatt.
......
...@@ -36,29 +36,29 @@ ...@@ -36,29 +36,29 @@
With this (fast) algorithm, the horizontal layout of the table does With this (fast) algorithm, the horizontal layout of the table does
not depend on the contents of the cells; it only depends on the not depend on the contents of the cells; it only depends on the
table's m_width, the m_width of the columns, and borders or cell table's width, the width of the columns, and borders or cell
spacing. spacing.
The table's m_width may be specified explicitly with the 'm_width' The table's width may be specified explicitly with the 'width'
property. A value of 'auto' (for both 'display: table' and 'display: property. A value of 'auto' (for both 'display: table' and 'display:
inline-table') means use the automatic table layout algorithm. inline-table') means use the automatic table layout algorithm.
In the fixed table layout algorithm, the m_width of each column is In the fixed table layout algorithm, the width of each column is
determined as follows: determined as follows:
1. A column element with a value other than 'auto' for the 'm_width' 1. A column element with a value other than 'auto' for the 'width'
property sets the m_width for that column. property sets the width for that column.
2. Otherwise, a cell in the first row with a value other than 2. Otherwise, a cell in the first row with a value other than
'auto' for the 'm_width' property sets the m_width for that column. If 'auto' for the 'width' property sets the width for that column. If
the cell spans more than one column, the m_width is divided over the the cell spans more than one column, the width is divided over the
columns. columns.
3. Any remaining columns equally divide the remaining horizontal 3. Any remaining columns equally divide the remaining horizontal
table space (minus borders or cell spacing). table space (minus borders or cell spacing).
The m_width of the table is then the greater of the value of the The width of the table is then the greater of the value of the
'm_width' property for the table element and the sum of the column 'width' property for the table element and the sum of the column
widths (plus cell spacing or borders). If the table is wider than widths (plus cell spacing or borders). If the table is wider than
the columns, the extra space should be distributed over the columns. the columns, the extra space should be distributed over the columns.
...@@ -68,13 +68,6 @@ ...@@ -68,13 +68,6 @@
not affect column widths. Any cell that has content that overflows not affect column widths. Any cell that has content that overflows
uses the 'overflow' property to determine whether to clip the uses the 'overflow' property to determine whether to clip the
overflow content. overflow content.
_____________________________________________________
This is not quite true when comparing to IE. IE always honours
table-layout:fixed and treats a variable table m_width as 100%. Makes
a lot of sense, and is implemented here the same way.
*/ */
using namespace std; using namespace std;
...@@ -86,10 +79,6 @@ FixedTableLayout::FixedTableLayout(RenderTable* table) ...@@ -86,10 +79,6 @@ FixedTableLayout::FixedTableLayout(RenderTable* table)
{ {
} }
FixedTableLayout::~FixedTableLayout()
{
}
int FixedTableLayout::calcWidthArray(int tableWidth) int FixedTableLayout::calcWidthArray(int tableWidth)
{ {
int usedWidth = 0; int usedWidth = 0;
...@@ -127,7 +116,7 @@ int FixedTableLayout::calcWidthArray(int tableWidth) ...@@ -127,7 +116,7 @@ int FixedTableLayout::calcWidthArray(int tableWidth)
} }
int eSpan = m_table->spanOfEffCol(cCol+i); int eSpan = m_table->spanOfEffCol(cCol+i);
if ((w.isFixed() || w.isPercent()) && w.isPositive()) { if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan); m_width[cCol + i].setRawValue(w.type(), w.rawValue() * eSpan);
usedWidth += effWidth * eSpan; usedWidth += effWidth * eSpan;
} }
usedSpan += eSpan; usedSpan += eSpan;
...@@ -148,38 +137,36 @@ int FixedTableLayout::calcWidthArray(int tableWidth) ...@@ -148,38 +137,36 @@ int FixedTableLayout::calcWidthArray(int tableWidth)
child = next; child = next;
} }
// iterate over the first row in case some are unspecified. // Iterate over the first row in case some are unspecified.
RenderTableSection* section = m_table->header(); RenderTableSection* section = m_table->header();
if (!section) if (!section)
section = m_table->firstBody(); section = m_table->firstBody();
if (!section) if (!section)
section = m_table->footer(); section = m_table->footer();
if (!section->numRows())
section = m_table->sectionBelow(section, true);
if (section) { if (section) {
cCol = 0; cCol = 0;
// FIXME: Technically the first row could be in an arbitrary section (e.g., an nth section
// if the previous n-1 sections have no rows), so this check isn't good enough.
// get the first cell in the first row
RenderObject* firstRow = section->firstChild(); RenderObject* firstRow = section->firstChild();
child = firstRow ? firstRow->firstChild() : 0; child = firstRow->firstChild();
while (child) { while (child) {
if (child->isTableCell()) { if (child->isTableCell()) {
RenderTableCell *cell = static_cast<RenderTableCell *>(child); RenderTableCell* cell = static_cast<RenderTableCell*>(child);
Length w = cell->styleOrColWidth(); Length w = cell->styleOrColWidth();
int span = cell->colSpan(); int span = cell->colSpan();
int effWidth = 0; int effWidth = 0;
// FIXME: This does not make sense (mixing percentages with absolute length) if (w.isFixed() && w.isPositive())
if ((w.isFixed() || w.isPercent()) && w.isPositive()) effWidth = w.value();
effWidth = w.isPercent() ? w.rawValue() / percentScaleFactor : w.value();
int usedSpan = 0; int usedSpan = 0;
int i = 0; int i = 0;
while (usedSpan < span) { while (usedSpan < span) {
ASSERT(cCol + i < nEffCols); ASSERT(cCol + i < nEffCols);
int eSpan = m_table->spanOfEffCol(cCol+i); int eSpan = m_table->spanOfEffCol(cCol + i);
// only set if no col element has already set it. // Only set if no col element has already set it.
if (m_width[cCol+i].isAuto() && w.type() != Auto) { if (m_width[cCol + i].isAuto() && w.type() != Auto) {
m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan); m_width[cCol + i].setRawValue(w.type(), w.rawValue() * eSpan / span);
usedWidth += effWidth*eSpan; usedWidth += effWidth * eSpan / span;
} }
usedSpan += eSpan; usedSpan += eSpan;
i++; i++;
...@@ -191,7 +178,6 @@ int FixedTableLayout::calcWidthArray(int tableWidth) ...@@ -191,7 +178,6 @@ int FixedTableLayout::calcWidthArray(int tableWidth)
} }
return usedWidth; return usedWidth;
} }
void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth) void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth)
...@@ -201,10 +187,10 @@ void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth) ...@@ -201,10 +187,10 @@ void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth)
// we might want to wait until we have all of the first row before // we might want to wait until we have all of the first row before
// layouting for the first time. // layouting for the first time.
// only need to calculate the minimum m_width as the sum of the // only need to calculate the minimum width as the sum of the
// cols/cells with a fixed m_width. // cols/cells with a fixed width.
// //
// The maximum m_width is max(minWidth, tableWidth). // The maximum width is max(minWidth, tableWidth).
int bs = m_table->bordersPaddingAndSpacing(); int bs = m_table->bordersPaddingAndSpacing();
int tableWidth = m_table->style()->width().isFixed() ? m_table->style()->width().value() - bs : 0; int tableWidth = m_table->style()->width().isFixed() ? m_table->style()->width().value() - bs : 0;
...@@ -217,74 +203,86 @@ void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth) ...@@ -217,74 +203,86 @@ void FixedTableLayout::calcMinMaxWidth(int& minWidth, int& maxWidth)
void FixedTableLayout::layout() void FixedTableLayout::layout()
{ {
int tableWidth = m_table->width() - m_table->bordersPaddingAndSpacing(); int tableWidth = m_table->width() - m_table->bordersPaddingAndSpacing();
int available = tableWidth;
int nEffCols = m_table->numEffCols(); int nEffCols = m_table->numEffCols();
int totalPercent = 0; Vector<int> calcWidth(nEffCols, 0);
Vector<int> calcWidth(nEffCols, -1);
// assign percent m_width int numAuto = 0;
if (available > 0) { int totalFixedWidth = 0;
for (int i = 0; i < nEffCols; i++) int totalPercentWidth = 0;
if (m_width[i].isPercent()) int totalRawPercent = 0;
totalPercent += m_width[i].rawValue();
// calculate how much to distribute to percent cells. // Compute requirements and try to satisfy fixed and percent widths.
int base = tableWidth * totalPercent / (100 * percentScaleFactor); // Percentages are of the table's width, so for example
if (base > available) // for a table width of 100px with columns (40px, 10%), the 10% compute
base = available; // to 10px here, and will scale up to 20px in the final (80px, 20px).
else
totalPercent = 100 * percentScaleFactor;
for (int i = 0; available > 0 && i < nEffCols; i++) {
if (m_width[i].isPercent()) {
int w = base * m_width[i].rawValue() / totalPercent;
available -= w;
calcWidth[i] = w;
}
}
}
// next assign fixed m_width
for (int i = 0; i < nEffCols; i++) { for (int i = 0; i < nEffCols; i++) {
if (m_width[i].isFixed()) { if (m_width[i].isFixed()) {
calcWidth[i] = m_width[i].value(); calcWidth[i] = m_width[i].value();
available -= m_width[i].value(); totalFixedWidth += calcWidth[i];
} } else if (m_width[i].isPercent()) {
calcWidth[i] = m_width[i].calcValue(tableWidth);
totalPercentWidth += calcWidth[i];
totalRawPercent += m_width[i].rawValue();
} else if (m_width[i].isAuto())
numAuto++;
} }
// assign variable m_width int totalWidth = totalFixedWidth + totalPercentWidth;
if (available > 0) { if (!numAuto || totalWidth > tableWidth) {
int totalAuto = 0; // If there are no auto columns, or if the total is too wide, take
for (int i = 0; i < nEffCols; i++) // what we have and scale it to fit as necessary.
if (m_width[i].isAuto()) if (totalWidth != tableWidth) {
totalAuto++; // Fixed widths only scale up
if (totalFixedWidth && totalWidth < tableWidth) {
for (int i = 0; available > 0 && i < nEffCols; i++) { totalFixedWidth = 0;
for (int i = 0; i < nEffCols; i++) {
if (m_width[i].isFixed()) {
calcWidth[i] = calcWidth[i] * tableWidth / totalWidth;
totalFixedWidth += calcWidth[i];
}
}
}
if (totalRawPercent) {
totalPercentWidth = 0;
for (int i = 0; i < nEffCols; i++) {
if (m_width[i].isPercent()) {
calcWidth[i] = m_width[i].rawValue() * (tableWidth - totalFixedWidth) / totalRawPercent;
totalPercentWidth += calcWidth[i];
}
}
}
totalWidth = totalFixedWidth + totalPercentWidth;
}
} else {
// Divide the remaining width among the auto columns.
int remainingWidth = tableWidth - totalFixedWidth - totalPercentWidth;
int lastAuto = 0;
for (int i = 0; i < nEffCols; i++) {
if (m_width[i].isAuto()) { if (m_width[i].isAuto()) {
int w = available / totalAuto; calcWidth[i] = remainingWidth / numAuto;
available -= w; remainingWidth -= calcWidth[i];
calcWidth[i] = w; if (!remainingWidth)
totalAuto--; break;
lastAuto = i;
numAuto--;
} }
} }
// Last one gets the remainder.
if (remainingWidth)
calcWidth[lastAuto] += remainingWidth;
totalWidth = tableWidth;
} }
for (int i = 0; i < nEffCols; i++) if (totalWidth < tableWidth) {
if (calcWidth[i] <= 0) // Spread extra space over columns.
calcWidth[i] = 0; // IE gives min 1 px... int remainingWidth = tableWidth - totalWidth;
// spread extra space over columns
if (available > 0) {
int total = nEffCols; int total = nEffCols;
// still have some m_width to spread while (total) {
int i = nEffCols; int w = remainingWidth / total;
while ( i--) { remainingWidth -= w;
int w = available / total; calcWidth[--total] += w;
available -= w;
total--;
calcWidth[i] += w;
} }
calcWidth[nEffCols - 1] += remainingWidth;
} }
int pos = 0; int pos = 0;
...@@ -293,9 +291,7 @@ void FixedTableLayout::layout() ...@@ -293,9 +291,7 @@ void FixedTableLayout::layout()
m_table->columnPositions()[i] = pos; m_table->columnPositions()[i] = pos;
pos += calcWidth[i] + hspacing; pos += calcWidth[i] + hspacing;
} }
m_table->columnPositions()[m_table->columnPositions().size()-1] = pos; m_table->columnPositions()[m_table->columnPositions().size() - 1] = pos;
} }
#undef DEBUG_LAYOUT
} // namespace WebCore } // namespace WebCore
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifndef FixedTableLayout_H #ifndef FixedTableLayout_h
#define FixedTableLayout_H #define FixedTableLayout_h
#include "Length.h" #include "Length.h"
#include "TableLayout.h" #include "TableLayout.h"
...@@ -34,7 +34,6 @@ class RenderTable; ...@@ -34,7 +34,6 @@ class RenderTable;
class FixedTableLayout : public TableLayout { class FixedTableLayout : public TableLayout {
public: public:
FixedTableLayout(RenderTable*); FixedTableLayout(RenderTable*);
~FixedTableLayout();
virtual void calcMinMaxWidth(int& minWidth, int& maxWidth); virtual void calcMinMaxWidth(int& minWidth, int& maxWidth);
virtual void layout(); virtual void layout();
...@@ -47,4 +46,4 @@ protected: ...@@ -47,4 +46,4 @@ protected:
} // namespace WebCore } // namespace WebCore
#endif // FixedTableLayout_H #endif // FixedTableLayout_h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment