mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
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.
This commit is contained in:
parent
af47c6fb4d
commit
51f5cb3576
6 changed files with 59 additions and 19 deletions
|
|
@ -1526,6 +1526,40 @@ nsAttrValue::ParseIntWithFallback(const nsAString& aString, int32_t aDefault,
|
|||
SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
nsAttrValue::ParseClampedNonNegativeInt(const nsAString& aString,
|
||||
int32_t aDefault, int32_t aMin,
|
||||
int32_t aMax)
|
||||
{
|
||||
ResetIfSet();
|
||||
|
||||
nsContentUtils::ParseHTMLIntegerResultFlags result;
|
||||
int32_t val = nsContentUtils::ParseHTMLInteger(aString, &result);
|
||||
bool nonStrict = (result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
|
||||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
|
||||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);
|
||||
|
||||
if (result & nsContentUtils::eParseHTMLInteger_ErrorOverflow) {
|
||||
if (result & nsContentUtils::eParseHTMLInteger_Negative) {
|
||||
val = aDefault;
|
||||
} else {
|
||||
val = aMax;
|
||||
}
|
||||
nonStrict = true;
|
||||
} else if ((result & nsContentUtils::eParseHTMLInteger_Error) || val < 0) {
|
||||
val = aDefault;
|
||||
nonStrict = true;
|
||||
} else if (val < aMin) {
|
||||
val = aMin;
|
||||
nonStrict = true;
|
||||
} else if (val > aMax) {
|
||||
val = aMax;
|
||||
nonStrict = true;
|
||||
}
|
||||
|
||||
SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
nsAttrValue::ParseNonNegativeIntValue(const nsAString& aString)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue