IntersectionObserverEntry.h [plain text]
#pragma once
#if ENABLE(INTERSECTION_OBSERVER)
#include "DOMRectReadOnly.h"
#include "Element.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class Element;
class IntersectionObserverEntry : public RefCounted<IntersectionObserverEntry> {
WTF_MAKE_FAST_ALLOCATED;
public:
struct Init {
double time;
DOMRectInit rootBounds;
DOMRectInit boundingClientRect;
DOMRectInit intersectionRect;
RefPtr<Element> target;
};
static Ref<IntersectionObserverEntry> create(const Init& init)
{
return WTF::adoptRef(*new IntersectionObserverEntry(init));
}
double time() const { return m_time; }
RefPtr<DOMRectReadOnly> rootBounds() const { return m_rootBounds; }
RefPtr<DOMRectReadOnly> boundingClientRect() const { return m_boundingClientRect; }
RefPtr<DOMRectReadOnly> intersectionRect() const { return m_intersectionRect; }
RefPtr<Element> target() const { return m_target; }
double intersectionRatio() const { return m_intersectionRatio; }
private:
IntersectionObserverEntry(const Init&);
double m_time { 0 };
RefPtr<DOMRectReadOnly> m_rootBounds;
RefPtr<DOMRectReadOnly> m_boundingClientRect;
RefPtr<DOMRectReadOnly> m_intersectionRect;
double m_intersectionRatio { 0 };
RefPtr<Element> m_target;
};
}
#endif // ENABLE(INTERSECTION_OBSERVER)