summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-22 06:30:39 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-22 06:30:39 +0100
commit107a68cb1d12aa6ed74e4ca414e5f05e4a92c963 (patch)
treef734be34f47e6bd927cd49b25cf72514761e4cea /dom
parentc9d920e9c630fd8b99b863e034742fd3b38e12d3 (diff)
downloadUXP-107a68cb1d12aa6ed74e4ca414e5f05e4a92c963.tar
UXP-107a68cb1d12aa6ed74e4ca414e5f05e4a92c963.tar.gz
UXP-107a68cb1d12aa6ed74e4ca414e5f05e4a92c963.tar.lz
UXP-107a68cb1d12aa6ed74e4ca414e5f05e4a92c963.tar.xz
UXP-107a68cb1d12aa6ed74e4ca414e5f05e4a92c963.zip
Intersection ratio should be 1.0 for zero-area intersections.
Tag #249
Diffstat (limited to 'dom')
-rw-r--r--dom/base/DOMIntersectionObserver.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp
index cb624fb17..0834bc05c 100644
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -411,7 +411,13 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
double targetArea = targetRect.width * targetRect.height;
double intersectionArea = !intersectionRect ?
0 : intersectionRect->width * intersectionRect->height;
- double intersectionRatio = targetArea > 0.0 ? intersectionArea / targetArea : 0.0;
+
+ double intersectionRatio;
+ if (targetArea > 0.0) {
+ intersectionRatio = intersectionArea / targetArea;
+ } else {
+ intersectionRatio = intersectionRect.isSome() ? 1.0 : 0.0;
+ }
size_t threshold = -1;
if (intersectionRatio > 0.0) {