From f6ef8d8ca7ed96d699c28914fc590b0604520fd0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 17 Jan 2019 19:02:50 +0100 Subject: Add isIntersecting property to IntersectionObserverEntry. Per updated spec. This resolves the issue raised in #249. --- dom/base/DOMIntersectionObserver.cpp | 1 + dom/base/DOMIntersectionObserver.h | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'dom/base') diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index e7b3cd0da..0264a105e 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 9c8ebf5b1..414f21482 100644 --- a/dom/base/DOMIntersectionObserver.h +++ b/dom/base/DOMIntersectionObserver.h @@ -30,6 +30,7 @@ public: RefPtr aRootBounds, RefPtr aBoundingClientRect, RefPtr 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 mRootBounds; RefPtr mBoundingClientRect; RefPtr mIntersectionRect; + bool mIsIntersecting; RefPtr mTarget; double mIntersectionRatio; }; -- cgit v1.2.3