Tables with just border-style set on the cells do not get a grid
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Aug 2012 16:20:23 +0000 (16:20 +0000)
committeryounghwan cho <yhwan.cho@samsung.com>
Mon, 1 Apr 2013 04:49:46 +0000 (13:49 +0900)
https://bugs.webkit.org/show_bug.cgi?id=84286

Reviewed by Julien Chaffraix.

Source/WebCore:

This is happening because every cell gets a zero-width border in createSharedCellStyle() if the table border is not explictly set.
FF and Opera don't do this, so leave the cell's border alone if there is no table border explicitly set.

Test: fast/css/table-rules-attribute-none-with-cell-borders.html

* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::createSharedCellStyle):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject): Without this we would end up rebaselining a bunch of tests to report 'border: []'
 rather than 'border: [none]'. The problem here was that writeRenderObject would only report the first border if it differed from
 BorderValue(). What we want is for it to report the first border always and then any borders after that if they differ.

LayoutTests:

With the exception of the new test table-rules-attribute-none-with-cell-borders.html all
of these are rebaselines due to RenderTreeAsText now reporting the first border, even if it
is a default border.

* fast/block/float/avoidance-rtl-expected.txt:
* fast/borders/border-radius-wide-border-01-expected.txt:
* fast/borders/only-one-border-with-width-expected.txt:
* fast/css/table-rules-attribute-none-with-cell-borders-expected.html: Added.
* fast/css/table-rules-attribute-none-with-cell-borders.html: Added.
* fast/multicol/progression-reverse-expected.txt:
* fast/multicol/vertical-lr/rules-with-border-before-expected.txt:
* fast/multicol/vertical-rl/rules-with-border-before-expected.txt:
* platform/chromium-linux/css1/box_properties/border_bottom-expected.png:
* platform/chromium-linux/css2.1/t0805-c5519-brdr-r-00-a-expected.txt:
* platform/chromium-linux/css2.1/t0805-c5519-brdr-r-01-e-expected.txt:
* platform/chromium-linux/css2.1/t0805-c5520-brdr-b-01-e-expected.txt:
* platform/chromium-linux/css2.1/t0805-c5521-brdr-l-00-a-expected.txt:
* platform/chromium-linux/css2.1/t0805-c5521-brdr-l-01-e-expected.txt:
* platform/chromium-linux/css2.1/t0805-c5521-ibrdr-l-00-a-expected.txt:
* platform/chromium-linux/fast/css/line-height-determined-by-primary-font-expected.txt:
* platform/chromium-win/animations/cross-fade-border-image-source-expected.txt:
* platform/chromium-win/css1/box_properties/border_bottom-expected.txt:
* platform/chromium-win/css1/box_properties/border_bottom_inline-expected.txt:
* platform/chromium-win/css1/box_properties/border_left-expected.txt:
* platform/chromium-win/css1/box_properties/border_left_inline-expected.txt:
* platform/chromium-win/css1/box_properties/border_right-expected.txt:
* platform/chromium-win/css1/box_properties/border_right_inline-expected.txt:
* platform/chromium-win/css1/units/length_units-expected.txt:
* platform/chromium-win/css2.1/20110323/absolute-replaced-height-036-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-height-007-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-height-008-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-height-009-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-height-010-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-width-001-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-width-002-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-width-003-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-width-004-expected.txt:
* platform/chromium-win/css2.1/20110323/block-non-replaced-width-008-expected.txt:
* platform/chromium-win/css2.1/20110323/margin-applies-to-008-expected.txt:
* platform/chromium-win/css2.1/20110323/width-non-replaced-inline-001-expected.txt:
* platform/chromium-win/css2.1/t040302-c61-phys-len-00-b-expected.txt:
* platform/chromium-win/css2.1/t0804-c5507-padn-r-02-f-expected.txt:
* platform/chromium-win/css2.1/t0804-c5508-ipadn-b-03-b-a-expected.txt:
* platform/chromium-win/css2.1/t0804-c5509-padn-l-02-f-expected.txt:
* platform/chromium-win/css2.1/t0805-c5519-brdr-r-02-e-expected.txt:
* platform/chromium-win/css2.1/t0805-c5519-ibrdr-r-00-a-expected.txt:
* platform/chromium-win/css2.1/t0805-c5520-brdr-b-00-a-expected.txt:
* platform/chromium-win/css2.1/t0805-c5520-ibrdr-b-00-a-expected.txt:
* platform/chromium-win/css2.1/t0805-c5521-brdr-l-02-e-expected.txt:
* platform/chromium-win/editing/deleting/type-delete-after-quote-expected.txt:
* platform/chromium-win/editing/execCommand/4580583-1-expected.txt:
* platform/chromium-win/editing/execCommand/4580583-2-expected.txt:
* platform/chromium-win/editing/inserting/5418891-expected.txt:
* platform/chromium-win/editing/inserting/5510537-expected.txt:
* platform/chromium-win/editing/inserting/6703873-expected.txt:
* platform/chromium-win/editing/inserting/break-blockquote-after-delete-expected.txt:
* platform/chromium-win/editing/pasteboard/5006779-expected.txt:
* platform/chromium-win/editing/pasteboard/paste-blockquote-after-blockquote-expected.txt:
* platform/chromium-win/editing/pasteboard/paste-blockquote-into-blockquote-4-expected.txt:
* platform/chromium-win/fast/block/float/012-expected.txt:
* platform/chromium-win/fast/block/float/013-expected.txt:
* platform/chromium-win/fast/block/float/016-expected.txt:
* platform/chromium-win/fast/block/margin-collapse/041-expected.txt:
* platform/chromium-win/fast/block/margin-collapse/043-expected.txt:
* platform/chromium-win/fast/block/margin-collapse/057-expected.txt:
* platform/chromium-win/fast/css/acid2-expected.txt:
* platform/chromium-win/fast/css/acid2-pixel-expected.txt:
* platform/chromium-win/fast/css/border-height-expected.txt:
* platform/chromium-win/fast/frames/viewsource-attribute-expected.txt:
* platform/chromium-win/fast/frames/viewsource-on-image-file-expected.txt:
* platform/chromium-win/fast/inline/inline-padding-disables-text-quirk-expected.txt:
* platform/chromium-win/fast/inline/inline-text-quirk-bpm-expected.txt:
* platform/chromium-win/fast/layers/scroll-rect-to-visible-expected.txt:
* platform/chromium-win/fast/lists/007-expected.txt:
* platform/chromium-win/fast/multicol/block-axis-horizontal-bt-expected.txt:
* platform/chromium-win/fast/multicol/block-axis-vertical-lr-expected.txt:
* platform/chromium-win/fast/multicol/block-axis-vertical-rl-expected.txt:
* platform/chromium-win/fast/overflow/overflow-rtl-expected.txt:
* platform/chromium-win/fast/overflow/overflow-rtl-inline-scrollbar-expected.txt:
* platform/chromium-win/fast/repaint/repaint-across-writing-mode-boundary-expected.txt:
* platform/chromium-win/fast/table/border-collapsing/003-expected.txt:
* platform/chromium-win/fast/table/border-collapsing/003-vertical-expected.txt:
* platform/chromium-win/fast/table/border-collapsing/rtl-border-collapsing-expected.txt:
* platform/chromium-win/fast/table/colgroup-spanning-groups-rules-expected.txt:
* platform/chromium-win/fast/text/basic/015-expected.txt:
* platform/chromium-win/fast/text/monospace-width-cache-expected.txt:
* platform/chromium-win/http/tests/misc/acid2-expected.txt:
* platform/chromium-win/http/tests/misc/acid2-pixel-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-009-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-012-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-013-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-014-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-015-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-radius-applies-to-016-expected.txt:
* platform/chromium-win/ietestcenter/css3/bordersbackgrounds/border-top-left-radius-values-001-expected.txt:
* platform/chromium-win/tables/mozilla/core/table_rules-expected.txt:
* platform/chromium-win/tables/mozilla/marvin/x_table_rules_groups-expected.txt:
* platform/chromium-win/tables/mozilla_expected_failures/collapsing_borders/bug41262-1-expected.txt:
* platform/chromium-win/tables/mozilla_expected_failures/other/test4-expected.txt:
* platform/chromium-win/transforms/2d/transform-borderbox-expected.txt:
* platform/chromium-win/transforms/2d/transform-origin-borderbox-expected.txt:
* platform/chromium-win/transitions/cross-fade-border-image-expected.txt:
* platform/chromium/fast/css/pseudo-first-line-border-width-expected.txt:
* platform/mac/css2.1/20110323/abspos-non-replaced-width-margin-000-expected.txt:
* platform/mac/css2.1/20110323/abspos-replaced-width-margin-000-expected.txt:
* platform/mac/fast/css/caption-width-absolute-position-expected.txt:
* platform/mac/fast/css/caption-width-absolute-position-offset-top-expected.txt:
* platform/mac/fast/css/caption-width-fixed-position-expected.txt:
* platform/mac/fast/css/caption-width-fixed-position-offset-top-expected.txt:
* platform/mac/fast/table/border-collapsing/equal-precedence-resolution-expected.txt:
* platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt:
* platform/mac/fast/text/apply-start-width-after-skipped-text-expected.txt:

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

Conflicts:

LayoutTests/ChangeLog
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog

Change-Id: I1fd740b77475e8f08a989df6da7996bee741639c

Conflicts:

Source/WebCore/ChangeLog

LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders-expected.html [new file with mode: 0644]
LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders.html [new file with mode: 0644]
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/rendering/RenderTreeAsText.cpp

diff --git a/LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders-expected.html b/LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders-expected.html
new file mode 100644 (file)
index 0000000..694ee6d
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Table columns - HTML table 'rules' none attribute with cell borders</title>
+        <meta name="assert" content="The first table should have two vertical lines intersecting two horizontal lines.">
+        <style type="text/css">
+            table
+            {
+                border-collapse: collapse;
+                border-style: solid;
+                border-color: black;
+            }
+            td
+            {
+                border-width: 3px;
+                border-style: solid;
+                border-color: black;
+                height: 2em;
+                width: 2em;
+            }
+        </style>
+    </head>
+    <body>
+        <table rules="all">
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+        </table>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders.html b/LayoutTests/fast/css/table-rules-attribute-none-with-cell-borders.html
new file mode 100644 (file)
index 0000000..177d6af
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Table columns - HTML table 'rules' none attribute with cell borders</title>
+        <meta name="assert" content="The first table should have two vertical lines intersecting two horizontal lines.">
+        <style type="text/css">
+            table
+            {
+                border-collapse: collapse;
+            }
+            td
+            {
+                border-style: solid;
+                height: 2em;
+                width: 2em;
+            }
+        </style>
+    </head>
+    <body>
+        <table>
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+            </tr>
+        </table>
+    </body>
+</html>
\ No newline at end of file
index 283786b..317550e 100644 (file)
@@ -508,7 +508,7 @@ PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle()
         style->setProperty(CSSPropertyBorderColor, cssValuePool().createInheritedValue());
         break;
     case NoBorders:
-        style->setProperty(CSSPropertyBorderWidth, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX));
+        // If 'rules=none' then allow any borders set at cell level to take effect.
         break;
     }
 
index 8af6a27..c1585b1 100644 (file)
@@ -315,19 +315,16 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
         if (box.borderTop() || box.borderRight() || box.borderBottom() || box.borderLeft()) {
             ts << " [border:";
 
-            BorderValue prevBorder;
-            if (o.style()->borderTop() != prevBorder) {
-                prevBorder = o.style()->borderTop();
-                if (!box.borderTop())
-                    ts << " none";
-                else {
-                    ts << " (" << box.borderTop() << "px ";
-                    printBorderStyle(ts, o.style()->borderTopStyle());
-                    Color col = o.style()->borderTopColor();
-                    if (!col.isValid())
-                        col = o.style()->color();
-                    ts << col.nameForRenderTreeAsText() << ")";
-                }
+            BorderValue prevBorder = o.style()->borderTop();
+            if (!box.borderTop())
+                ts << " none";
+            else {
+                ts << " (" << box.borderTop() << "px ";
+                printBorderStyle(ts, o.style()->borderTopStyle());
+                Color col = o.style()->borderTopColor();
+                if (!col.isValid())
+                    col = o.style()->color();
+                ts << col.nameForRenderTreeAsText() << ")";
             }
 
             if (o.style()->borderRight() != prevBorder) {