From 52940bc44c14382bfd26f55ff48ffaa372d43497 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Mon, 3 Feb 2020 16:59:23 +0200 Subject: Issue #1384 - Match standard for colSpan/rowSpan HTML standardizes proper behavior of colSpan and rowSpan: The main thing is that getting the .rowSpan and .colSpan IDL properties will now return the actual clamped value that we use. --- dom/html/HTMLTableCellElement.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'dom/html/HTMLTableCellElement.cpp') diff --git a/dom/html/HTMLTableCellElement.cpp b/dom/html/HTMLTableCellElement.cpp index d00d60400..1cf413413 100644 --- a/dom/html/HTMLTableCellElement.cpp +++ b/dom/html/HTMLTableCellElement.cpp @@ -390,26 +390,16 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID, return aResult.ParseIntWithBounds(aValue, 0); } if (aAttribute == nsGkAtoms::colspan) { - bool res = aResult.ParseIntWithBounds(aValue, -1); - if (res) { - int32_t val = aResult.GetIntegerValue(); - // reset large colspan values as IE and opera do - if (val > MAX_COLSPAN || val <= 0) { - aResult.SetTo(1, &aValue); - } - } - return res; + aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN); + return true; } if (aAttribute == nsGkAtoms::rowspan) { - bool res = aResult.ParseIntWithBounds(aValue, -1, MAX_ROWSPAN); - if (res) { - int32_t val = aResult.GetIntegerValue(); - // quirks mode does not honor the special html 4 value of 0 - if (val < 0 || (0 == val && InNavQuirksMode(OwnerDoc()))) { + aResult.ParseClampedNonNegativeInt(aValue, 1, 0, MAX_ROWSPAN); + // quirks mode does not honor the special html 4 value of 0 + if (aResult.GetIntegerValue() == 0 && InNavQuirksMode(OwnerDoc())) { aResult.SetTo(1, &aValue); - } } - return res; + return true; } if (aAttribute == nsGkAtoms::height) { return aResult.ParseSpecialIntValue(aValue); -- cgit v1.2.3