summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc b/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
index ee29249e866..e6049513e78 100644
--- a/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
+++ b/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
@@ -50,7 +50,7 @@ class IntersectionObserverDelegateImpl final
ExecutionContext* GetExecutionContext() const override { return context_; }
- void Trace(blink::Visitor* visitor) {
+ void Trace(blink::Visitor* visitor) override {
IntersectionObserverDelegate::Trace(visitor);
visitor->Trace(context_);
}
@@ -150,7 +150,12 @@ IntersectionObserver* IntersectionObserver::Create(
if (exception_state.HadException())
return nullptr;
- return new IntersectionObserver(delegate, root, root_margin, thresholds);
+ bool track_visibility = false;
+ if (RuntimeEnabledFeatures::IntersectionObserverV2Enabled())
+ track_visibility = observer_init.trackVisibility();
+
+ return new IntersectionObserver(delegate, root, root_margin, thresholds,
+ track_visibility);
}
IntersectionObserver* IntersectionObserver::Create(
@@ -168,18 +173,20 @@ IntersectionObserver* IntersectionObserver::Create(
const Vector<float>& thresholds,
Document* document,
EventCallback callback,
+ bool track_visibility,
ExceptionState& exception_state) {
IntersectionObserverDelegateImpl* intersection_observer_delegate =
new IntersectionObserverDelegateImpl(document, std::move(callback));
return new IntersectionObserver(*intersection_observer_delegate, nullptr,
- root_margin, thresholds);
+ root_margin, thresholds, track_visibility);
}
IntersectionObserver::IntersectionObserver(
IntersectionObserverDelegate& delegate,
Element* root,
const Vector<Length>& root_margin,
- const Vector<float>& thresholds)
+ const Vector<float>& thresholds,
+ bool track_visibility)
: ContextClient(delegate.GetExecutionContext()),
delegate_(&delegate),
root_(root),
@@ -188,7 +195,8 @@ IntersectionObserver::IntersectionObserver(
right_margin_(kFixed),
bottom_margin_(kFixed),
left_margin_(kFixed),
- root_is_implicit_(root ? 0 : 1) {
+ root_is_implicit_(root ? 0 : 1),
+ track_visibility_(track_visibility ? 1 : 0) {
switch (root_margin.size()) {
case 0:
break;
@@ -380,7 +388,7 @@ void IntersectionObserver::Trace(blink::Visitor* visitor) {
}
void IntersectionObserver::TraceWrappers(
- const ScriptWrappableVisitor* visitor) const {
+ ScriptWrappableVisitor* visitor) const {
visitor->TraceWrappers(delegate_);
ScriptWrappable::TraceWrappers(visitor);
}