Backed out changeset edfbe6020f30 (bug 1640441) for wpt failure on inferred-mrow-baseline.html . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2020-06-13 01:44:30 +03:00
Родитель f5fcf19b63
Коммит e8980a61ec
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -138,7 +138,16 @@ JSObject* DOMRectList::WrapObject(JSContext* cx,
return mozilla::dom::DOMRectList_Binding::Wrap(cx, this, aGivenProto);
}
static double RoundFloat(double aValue) { return floor(aValue + 0.5); }
void DOMRect::SetLayoutRect(const nsRect& aLayoutRect) {
auto pixelRect = CSSPixel::FromAppUnits(aLayoutRect);
SetRect(pixelRect.x, pixelRect.y, pixelRect.width, pixelRect.height);
double scale = 65536.0;
// Round to the nearest 1/scale units. We choose scale so it can be
// represented exactly by machine floating point.
double scaleInv = 1 / scale;
double t2pScaled = scale / AppUnitsPerCSSPixel();
double x = RoundFloat(aLayoutRect.x * t2pScaled) * scaleInv;
double y = RoundFloat(aLayoutRect.y * t2pScaled) * scaleInv;
SetRect(x, y, RoundFloat(aLayoutRect.XMost() * t2pScaled) * scaleInv - x,
RoundFloat(aLayoutRect.YMost() * t2pScaled) * scaleInv - y);
}