From c20fce3514bd3f250a238fe6956f18bd67421e31 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Wed, 27 Jan 2016 17:02:12 +0100 Subject: [PATCH] Bug 1241840 - Set table cell colspan=0 to 1 instead per the HTML spec. r=bz --- .../mochitest/table/test_indexes_table.html | 2 +- dom/html/HTMLTableCellElement.cpp | 4 +-- layout/mathml/nsMathMLmtableFrame.cpp | 2 +- .../meta/html/dom/reflection-tabular.html.ini | 29 +++++++++++++++++++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/accessible/tests/mochitest/table/test_indexes_table.html b/accessible/tests/mochitest/table/test_indexes_table.html index 0db4bfa015a..356a55933f2 100644 --- a/accessible/tests/mochitest/table/test_indexes_table.html +++ b/accessible/tests/mochitest/table/test_indexes_table.html @@ -110,7 +110,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052 [ 0, 1, 2, -1, -1], [-1, -1, -1, -1, -1], [ 3, 4, 5, -1, -1], - [ 6, 7, 7, 7, 7], + [ 6, 7, -1, -1, -1], [ 6, 8, 9, -1, -1], [ 6, 10, 9, 11, 12] ]; diff --git a/dom/html/HTMLTableCellElement.cpp b/dom/html/HTMLTableCellElement.cpp index 013ec6c6535..10ceabd3920 100644 --- a/dom/html/HTMLTableCellElement.cpp +++ b/dom/html/HTMLTableCellElement.cpp @@ -388,9 +388,7 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID, if (res) { int32_t val = aResult.GetIntegerValue(); // reset large colspan values as IE and opera do - // quirks mode does not honor the special html 4 value of 0 - if (val > MAX_COLSPAN || val < 0 || - (0 == val && InNavQuirksMode(OwnerDoc()))) { + if (val > MAX_COLSPAN || val <= 0) { aResult.SetTo(1, &aValue); } } diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index b1dbc917ddb..85c7e866928 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -1193,7 +1193,7 @@ nsMathMLmtdFrame::GetColSpan() if (!value.IsEmpty()) { nsresult error; colspan = value.ToInteger(&error); - if (NS_FAILED(error) || colspan < 0 || colspan > MAX_COLSPAN) + if (NS_FAILED(error) || colspan <= 0 || colspan > MAX_COLSPAN) colspan = 1; } } diff --git a/testing/web-platform/meta/html/dom/reflection-tabular.html.ini b/testing/web-platform/meta/html/dom/reflection-tabular.html.ini index 847a48fa2e7..cdeaf6f0957 100644 --- a/testing/web-platform/meta/html/dom/reflection-tabular.html.ini +++ b/testing/web-platform/meta/html/dom/reflection-tabular.html.ini @@ -615,3 +615,32 @@ [th.rowSpan: IDL set to 4294967295 followed by getAttribute()] expected: FAIL + [td.colSpan: setAttribute() to 0 followed by IDL get] + expected: FAIL + + [td.colSpan: setAttribute() to "-0" followed by IDL get] + expected: FAIL + + [td.colSpan: setAttribute() to "0" followed by IDL get] + expected: FAIL + + [td.colSpan: IDL set to 0 followed by IDL get] + expected: FAIL + + [td.colSpan: IDL set to "-0" followed by IDL get] + expected: FAIL + + [th.colSpan: setAttribute() to 0 followed by IDL get] + expected: FAIL + + [th.colSpan: setAttribute() to "-0" followed by IDL get] + expected: FAIL + + [th.colSpan: setAttribute() to "0" followed by IDL get] + expected: FAIL + + [th.colSpan: IDL set to 0 followed by IDL get] + expected: FAIL + + [th.colSpan: IDL set to "-0" followed by IDL get] + expected: FAIL