зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577389 - Return early from StyleCSSPixelLength::ToAppUnits for zero lengths. r=emilio
Zero lengths are common, and we can avoid doing all the FP math. Differential Revision: https://phabricator.services.mozilla.com/D43896 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e45d08541b
Коммит
a1b17a4a25
|
@ -442,6 +442,10 @@ nscoord StyleCSSPixelLength::ToAppUnits() const {
|
|||
// would regress bug 1323735, for example.
|
||||
//
|
||||
// FIXME(emilio, bug 1528114): Probably we should do something smarter.
|
||||
if (IsZero()) {
|
||||
// Avoid the expensive FP math below.
|
||||
return 0;
|
||||
}
|
||||
float length = _0 * float(mozilla::AppUnitsPerCSSPixel());
|
||||
if (length >= nscoord_MAX) {
|
||||
return nscoord_MAX;
|
||||
|
|
Загрузка…
Ссылка в новой задаче