summaryrefslogtreecommitdiffstats
path: root/dom/base
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-22 14:59:46 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-22 14:59:46 +0100
commit7771a8716d4bc135adadf95cf9ddf976f4294fba (patch)
tree2c3e2922bdaf43533a985e49272c2ab60ebcf8ed /dom/base
parent85d43d68bb32e484167bdeb0b6d78c60d44444d2 (diff)
downloadUXP-7771a8716d4bc135adadf95cf9ddf976f4294fba.tar
UXP-7771a8716d4bc135adadf95cf9ddf976f4294fba.tar.gz
UXP-7771a8716d4bc135adadf95cf9ddf976f4294fba.tar.lz
UXP-7771a8716d4bc135adadf95cf9ddf976f4294fba.tar.xz
UXP-7771a8716d4bc135adadf95cf9ddf976f4294fba.zip
[intersection-observer] Calculate areas using int64_t.
Tag #249
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/DOMIntersectionObserver.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp
index 650ec83cd..2f3a341c5 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;
}