summaryrefslogtreecommitdiffstats
path: root/dom/html
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2020-02-03 16:59:23 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:28:14 +0200
commit0ebdc997574ba96199e68f0766e1f220bd00ab35 (patch)
tree393da535fa7287b5349b8fe92d08b8f6492cb59d /dom/html
parent68d3bc54fbc9b99310197c51dfd84b6f72b7fb01 (diff)
downloadUXP-0ebdc997574ba96199e68f0766e1f220bd00ab35.tar
UXP-0ebdc997574ba96199e68f0766e1f220bd00ab35.tar.gz
UXP-0ebdc997574ba96199e68f0766e1f220bd00ab35.tar.lz
UXP-0ebdc997574ba96199e68f0766e1f220bd00ab35.tar.xz
UXP-0ebdc997574ba96199e68f0766e1f220bd00ab35.zip
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.
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLTableCellElement.cpp22
-rw-r--r--dom/html/HTMLTableCellElement.h4
2 files changed, 8 insertions, 18 deletions
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);
diff --git a/dom/html/HTMLTableCellElement.h b/dom/html/HTMLTableCellElement.h
index 916333510..ab7a918eb 100644
--- a/dom/html/HTMLTableCellElement.h
+++ b/dom/html/HTMLTableCellElement.h
@@ -37,7 +37,7 @@ public:
}
void SetColSpan(uint32_t aColSpan, ErrorResult& aError)
{
- SetHTMLIntAttr(nsGkAtoms::colspan, aColSpan, aError);
+ SetUnsignedIntAttr(nsGkAtoms::colspan, aColSpan, 1, aError);
}
uint32_t RowSpan() const
{
@@ -45,7 +45,7 @@ public:
}
void SetRowSpan(uint32_t aRowSpan, ErrorResult& aError)
{
- SetHTMLIntAttr(nsGkAtoms::rowspan, aRowSpan, aError);
+ SetUnsignedIntAttr(nsGkAtoms::rowspan, aRowSpan, 1, aError);
}
//already_AddRefed<nsDOMTokenList> Headers() const;
void GetHeaders(DOMString& aHeaders)