summaryrefslogtreecommitdiffstats
path: root/dom/base
diff options
context:
space:
mode:
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;
}