top and bottom black background line not getting displayed
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2013 05:57:01 +0000 (05:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2013 05:57:01 +0000 (05:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=21664

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-12-10
Reviewed by Simon Fraser.

Source/WebCore:

The table cell's background was not being displayed. Since the table
cell had no child correct offsetWidth was not being set even if table
width is being defined.

Test: fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
cellHasContent should also be set to true incase background color is
present.

LayoutTests:

* fast/dom/HTMLTableElement/empy-table-cell-with-background-color-expected.txt: Added.
* fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html: Added.
Added new test case to verify that table cell offsetWidth is set even
when it has no contents but has background color.
* fast/table/auto-100-percent-width-expected.txt:
* platform/mac/fast/table/empty-cells-expected.txt:
* tables/mozilla/bugs/bug1818-6-expected.txt:
Rebaselining the existing test case as per the new changes. The new
dimension changes are as per mozilla behaviour. For
auto-100-percent-width-expected.txt we get 1 px red background because
if cellHasContent we set columnLayout's minLogicalWidth and
columnLayout's maxLogicalWidth as 1 initially even if cell is empty.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color-expected.txt [new file with mode: 0755]
LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html [new file with mode: 0755]
LayoutTests/fast/table/auto-100-percent-width-expected.txt
LayoutTests/platform/mac/fast/table/empty-cells-expected.txt
LayoutTests/tables/mozilla/bugs/bug1818-6-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/AutoTableLayout.cpp

index b7e8478..375aa22 100644 (file)
@@ -1,3 +1,23 @@
+2013-12-10  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        top and bottom black background line not getting displayed
+        https://bugs.webkit.org/show_bug.cgi?id=21664
+
+        Reviewed by Simon Fraser.
+
+        * fast/dom/HTMLTableElement/empy-table-cell-with-background-color-expected.txt: Added.
+        * fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html: Added.
+        Added new test case to verify that table cell offsetWidth is set even
+        when it has no contents but has background color.
+        * fast/table/auto-100-percent-width-expected.txt:
+        * platform/mac/fast/table/empty-cells-expected.txt:
+        * tables/mozilla/bugs/bug1818-6-expected.txt:
+        Rebaselining the existing test case as per the new changes. The new
+        dimension changes are as per mozilla behaviour. For
+        auto-100-percent-width-expected.txt we get 1 px red background because
+        if cellHasContent we set columnLayout's minLogicalWidth and 
+        columnLayout's maxLogicalWidth as 1 initially even if cell is empty.
+
 2013-12-10  Krzysztof Czech  <k.czech@samsung.com>
 
         AX: Share accessibility/aria-hidden-negates-no-visibility.html expectation with other ports
diff --git a/LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color-expected.txt b/LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color-expected.txt
new file mode 100755 (executable)
index 0000000..a195cb0
--- /dev/null
@@ -0,0 +1,10 @@
+Tests that the table cell width is set properly even when the table cell has no child and its table has width defined
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('nochildTd').offsetWidth is 750
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html b/LayoutTests/fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html
new file mode 100755 (executable)
index 0000000..172453b
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../../resources/js-test-pre.js"></script>
+        <script>
+            function runTest() {
+                description('Tests that the table cell width is set properly even when the table cell has no child and its table has width defined');
+
+                shouldBe("document.getElementById('nochildTd').offsetWidth","750");
+                isSuccessfullyParsed();
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <table  width="750px" border="0" cellpadding="0" cellspacing="0">
+            <tr>
+                <td id="nochildTd" height="1px" bgcolor=#000000></td>
+            </tr>
+        </table>
+    </body>
+</html>
index 0e2dfcc..4599a4a 100644 (file)
@@ -8,5 +8,5 @@ layer at (70,40) size 480x540
     RenderTable {TABLE} at (0,0) size 480x540
       RenderTableSection {TBODY} at (0,0) size 480x540
         RenderTableRow {TR} at (0,0) size 480x540
-          RenderTableCell {TD} at (0,269) size 480x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
-          RenderTableCell {TD} at (480,270) size 0x0 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,269) size 479x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (479,270) size 1x0 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
index 1c85138..4d77631 100644 (file)
@@ -78,8 +78,8 @@ layer at (0,0) size 785x783
       RenderTable {TABLE} at (0,292) size 785x29 [border: (2px solid #000000)]
         RenderTableSection {TBODY} at (2,2) size 781x25
           RenderTableRow {TR} at (0,0) size 781x25
-            RenderTableCell {TD} at (0,12) size 0x0 [bgcolor=#FFFF00] [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (0,3) size 781x18 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (0,12) size 391x0 [bgcolor=#FFFF00] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (391,3) size 390x18 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (0,0) size 261x18
                 text run at (0,0) width 261: "First cell empty but has background color"
       RenderTable {TABLE} at (0,321) size 785x54 [border: (2px solid #000000)]
index 8f81c29..7d8c644 100644 (file)
@@ -6,6 +6,6 @@ layer at (0,0) size 800x600
       RenderTable {TABLE} at (0,0) size 784x0
         RenderTableSection {TBODY} at (0,0) size 784x0
           RenderTableRow {TR} at (0,0) size 784x0
-            RenderTableCell {TD} at (0,0) size 772x0 [bgcolor=#0000CC] [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (772,0) size 12x0 [bgcolor=#00CC00] [r=0 c=1 rs=1 cs=1]
-            RenderTableCell {TD} at (784,0) size 0x0 [bgcolor=#CC0000] [r=0 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (0,0) size 400x0 [bgcolor=#0000CC] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (400,0) size 6x0 [bgcolor=#00CC00] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (406,0) size 378x0 [bgcolor=#CC0000] [r=0 c=2 rs=1 cs=1]
index db24ad0..ccd9e46 100644 (file)
@@ -1,3 +1,21 @@
+2013-12-10  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        top and bottom black background line not getting displayed
+        https://bugs.webkit.org/show_bug.cgi?id=21664
+
+        Reviewed by Simon Fraser.
+
+        The table cell's background was not being displayed. Since the table
+        cell had no child correct offsetWidth was not being set even if table
+        width is being defined.
+
+        Test: fast/dom/HTMLTableElement/empy-table-cell-with-background-color.html
+
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::recalcColumn):
+        cellHasContent should also be set to true incase background color is
+        present.
+
 2013-12-10  Beth Dakin  <bdakin@apple.com>
 
         Horizontal rubber-banding without a horizontal scrollbar is distracting
index 3fb6928..b20078a 100644 (file)
@@ -63,7 +63,7 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
                 if (current.inColSpan || !cell)
                     continue;
 
-                bool cellHasContent = cell->firstChild() || cell->style().hasBorder() || cell->style().hasPadding();
+                bool cellHasContent = cell->firstChild() || cell->style().hasBorder() || cell->style().hasPadding() || cell->style().hasBackground();
                 if (cellHasContent)
                     columnLayout.emptyCellsOnly = false;