Index: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
index 7509dcf7051d0c111c615918360c489eed7e098e..32ef04c78978b5f0856a4812c1ff8499585d1e5d 100644 |
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
@@ -203,7 +203,8 @@ IntersectionObserver::IntersectionObserver( |
m_topMargin(Fixed), |
m_rightMargin(Fixed), |
m_bottomMargin(Fixed), |
- m_leftMargin(Fixed) { |
+ m_leftMargin(Fixed), |
+ m_initialState(InitialState::kHidden) { |
switch (rootMargin.size()) { |
case 0: |
break; |
@@ -291,6 +292,11 @@ void IntersectionObserver::observe(Element* target, |
return; |
} |
+ if (m_initialState == InitialState::kAuto) { |
+ for (auto& observation : m_observations) |
+ observation->setLastThresholdIndex(std::numeric_limits<unsigned>::max()); |
+ } |
+ |
if (!rootFrame) |
return; |
if (FrameView* rootFrameView = rootFrame->view()) |
@@ -345,6 +351,11 @@ void IntersectionObserver::removeObservation( |
m_observations.remove(&observation); |
} |
+void IntersectionObserver::setInitialState(InitialState initialState) { |
+ DCHECK(m_observations.isEmpty()); |
+ m_initialState = initialState; |
+} |
+ |
HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords( |
ExceptionState& exceptionState) { |
HeapVector<Member<IntersectionObserverEntry>> entries; |