зеркало из https://github.com/mozilla/gecko-dev.git
Bug 893331 - Relax assert checking if value is within range for nsRangeFrame. r=TYLin
GetValueAsFractionOfRange asserts that input == minimum if the range has maximum <= minimum. This assert is sane at face value, but floating point rounding issues can cause it to be triggered when input is essentially minimum. This changeset relaxes the assertion to check the input is within an epsilon value of minimum. Differential Revision: https://phabricator.services.mozilla.com/D10648 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cd9f025985
Коммит
2f64c0934b
|
@ -493,7 +493,10 @@ nsRangeFrame::GetValueAsFractionOfRange()
|
|||
"type=range should have a default maximum/minimum");
|
||||
|
||||
if (maximum <= minimum) {
|
||||
MOZ_ASSERT(value == minimum, "Unsanitized value");
|
||||
// Avoid rounding triggering the assert by checking against an epsilon.
|
||||
MOZ_ASSERT((value - minimum).abs().toDouble() <
|
||||
std::numeric_limits<float>::epsilon(),
|
||||
"Unsanitized value");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче