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/base/nsAttrValue.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'dom/base/nsAttrValue.cpp') diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index ebddcb7ed..2418fb501 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -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) { -- cgit v1.2.3 From a680bdc637e0393aaa08d575c66f7166b788b443 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 23 Sep 2020 13:55:00 +0000 Subject: Issue #1656 - Part 1: Nuke most vim config lines in the tree. Since these are just interpreted comments, there's 0 impact on actual code. This removes all lines that match /* vim: set(.*)tw=80: */ with S&R -- there are a few others scattered around which will be removed manually in a second part. --- dom/base/nsAttrValue.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'dom/base/nsAttrValue.cpp') diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index 2418fb501..711a695b7 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -- cgit v1.2.3