diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-12-22 14:59:46 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-12-22 14:59:46 +0100 |
commit | 7771a8716d4bc135adadf95cf9ddf976f4294fba (patch) | |
tree | 2c3e2922bdaf43533a985e49272c2ab60ebcf8ed /dom/base | |
parent | 85d43d68bb32e484167bdeb0b6d78c60d44444d2 (diff) | |
download | uxp-7771a8716d4bc135adadf95cf9ddf976f4294fba.tar.gz |
[intersection-observer] Calculate areas using int64_t.
Tag #249
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/DOMIntersectionObserver.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index 650ec83cdb..2f3a341c5e 100644 --- a/dom/base/DOMIntersectionObserver.cpp +++ b/dom/base/DOMIntersectionObserver.cpp @@ -413,13 +413,15 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time } } - double targetArea = targetRect.width * targetRect.height; - double intersectionArea = !intersectionRect ? - 0 : intersectionRect->width * intersectionRect->height; + int64_t targetArea = + (int64_t) targetRect.Width() * (int64_t) targetRect.Height(); + int64_t intersectionArea = !intersectionRect ? 0 : + (int64_t) intersectionRect->Width() * + (int64_t) intersectionRect->Height(); double intersectionRatio; if (targetArea > 0.0) { - intersectionRatio = intersectionArea / targetArea; + intersectionRatio = (double) intersectionArea / (double) targetArea; } else { intersectionRatio = intersectionRect.isSome() ? 1.0 : 0.0; } |