Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
| index c9c04457e5ea67c7f176de9f8542466870e0c392..cc44fa1532293b4640b71dacf076addaf603df25 100644 |
| --- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
| +++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
| @@ -19,7 +19,7 @@ IntersectionObservation::IntersectionObservation(IntersectionObserver& observer, |
| bool shouldReportRootBounds) |
|
miu
2016/11/05 02:47:46
Did you intend to remove the 3rd argument to this
xjz
2016/11/09 02:24:28
Now keep this argument for original purpose.
|
| : m_observer(observer), |
| m_target(&target), |
| - m_shouldReportRootBounds(shouldReportRootBounds), |
| + m_shouldReportRootBounds(true), |
| m_lastThresholdIndex(0) {} |
| void IntersectionObservation::applyRootMargin(LayoutRect& rect) const { |
| @@ -220,9 +220,9 @@ void IntersectionObservation::computeIntersectionObservations( |
| float intersectionArea = |
| geometry.intersectionRect.size().width().toFloat() * |
| geometry.intersectionRect.size().height().toFloat(); |
| - float targetArea = geometry.targetRect.size().width().toFloat() * |
| - geometry.targetRect.size().height().toFloat(); |
| - newVisibleRatio = intersectionArea / targetArea; |
| + float rootArea = geometry.rootRect.size().width().toFloat() * |
| + geometry.rootRect.size().height().toFloat(); |
| + newVisibleRatio = intersectionArea / rootArea; |
| newThresholdIndex = observer().firstThresholdGreaterThan(newVisibleRatio); |
| } |
| if (m_lastThresholdIndex != newThresholdIndex) { |