summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-01-17 19:02:50 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-01-17 19:02:50 +0100
commit246caca74548e1cd5fd4dc4dae9dd7004487bb92 (patch)
treee139d0db8d13c4120c586d3d439ca9f4c7358216
parentbc1ff2e74257e662ec5e3110b830c31deec97a26 (diff)
downloaduxp-246caca74548e1cd5fd4dc4dae9dd7004487bb92.tar.gz
Add isIntersecting property to IntersectionObserverEntry.
Per updated spec. This resolves the issue raised in #249.
-rw-r--r--dom/base/DOMIntersectionObserver.cpp1
-rw-r--r--dom/base/DOMIntersectionObserver.h8
-rw-r--r--dom/webidl/IntersectionObserver.webidl2
3 files changed, 11 insertions, 0 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp
index e7b3cd0da8..0264a105e5 100644
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -482,6 +482,7 @@ DOMIntersectionObserver::QueueIntersectionObserverEntry(Element* aTarget,
rootBounds.forget(),
boundingClientRect.forget(),
intersectionRect.forget(),
+ aIntersectionRect.isSome(),
aTarget, aIntersectionRatio);
mQueuedEntries.AppendElement(entry.forget());
}
diff --git a/dom/base/DOMIntersectionObserver.h b/dom/base/DOMIntersectionObserver.h
index 9c8ebf5b12..414f214826 100644
--- a/dom/base/DOMIntersectionObserver.h
+++ b/dom/base/DOMIntersectionObserver.h
@@ -30,6 +30,7 @@ public:
RefPtr<DOMRect> aRootBounds,
RefPtr<DOMRect> aBoundingClientRect,
RefPtr<DOMRect> aIntersectionRect,
+ bool aIsIntersecting,
Element* aTarget,
double aIntersectionRatio)
: mOwner(aOwner),
@@ -37,6 +38,7 @@ public:
mRootBounds(aRootBounds),
mBoundingClientRect(aBoundingClientRect),
mIntersectionRect(aIntersectionRect),
+ mIsIntersecting(aIsIntersecting),
mTarget(aTarget),
mIntersectionRatio(aIntersectionRatio)
{
@@ -74,6 +76,11 @@ public:
return mIntersectionRect;
}
+ bool IsIntersecting()
+ {
+ return mIsIntersecting;
+ }
+
double IntersectionRatio()
{
return mIntersectionRatio;
@@ -90,6 +97,7 @@ protected:
RefPtr<DOMRect> mRootBounds;
RefPtr<DOMRect> mBoundingClientRect;
RefPtr<DOMRect> mIntersectionRect;
+ bool mIsIntersecting;
RefPtr<Element> mTarget;
double mIntersectionRatio;
};
diff --git a/dom/webidl/IntersectionObserver.webidl b/dom/webidl/IntersectionObserver.webidl
index dbe8f428d8..bc193ee8c6 100644
--- a/dom/webidl/IntersectionObserver.webidl
+++ b/dom/webidl/IntersectionObserver.webidl
@@ -18,6 +18,8 @@ interface IntersectionObserverEntry {
[Constant]
readonly attribute DOMRectReadOnly intersectionRect;
[Constant]
+ readonly attribute boolean isIntersecting;
+ [Constant]
readonly attribute double intersectionRatio;
[Constant]
readonly attribute Element target;