| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/IntersectionObservation.h" | 5 #include "core/dom/IntersectionObservation.h" |
| 6 | 6 |
| 7 #include "core/dom/ElementRareData.h" | 7 #include "core/dom/ElementRareData.h" |
| 8 #include "core/dom/IntersectionObserver.h" | 8 #include "core/dom/IntersectionObserver.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 geometry.intersectionRect = geometry.targetRect; | 34 geometry.intersectionRect = geometry.targetRect; |
| 35 initializeRootRect(geometry.rootRect); | 35 initializeRootRect(geometry.rootRect); |
| 36 geometry.doesIntersect = true; | 36 geometry.doesIntersect = true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void IntersectionObservation::initializeTargetRect(LayoutRect& rect) const | 39 void IntersectionObservation::initializeTargetRect(LayoutRect& rect) const |
| 40 { | 40 { |
| 41 DCHECK(m_target); | 41 DCHECK(m_target); |
| 42 LayoutObject* targetLayoutObject = target()->layoutObject(); | 42 LayoutObject* targetLayoutObject = target()->layoutObject(); |
| 43 DCHECK(targetLayoutObject && targetLayoutObject->isBoxModelObject()); | 43 DCHECK(targetLayoutObject && targetLayoutObject->isBoxModelObject()); |
| 44 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); | 44 rect = LayoutRect(toLayoutBoxModelObject(targetLayoutObject)->borderBounding
Box()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const | 47 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const |
| 48 { | 48 { |
| 49 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 49 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
| 50 if (rootLayoutObject->isLayoutView()) | 50 if (rootLayoutObject->isLayoutView()) |
| 51 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo
ntentRect()); | 51 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo
ntentRect()); |
| 52 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip()) | 52 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip()) |
| 53 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); | 53 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); |
| 54 else | 54 else |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 m_observer.clear(); | 243 m_observer.clear(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 DEFINE_TRACE(IntersectionObservation) | 246 DEFINE_TRACE(IntersectionObservation) |
| 247 { | 247 { |
| 248 visitor->trace(m_observer); | 248 visitor->trace(m_observer); |
| 249 visitor->trace(m_target); | 249 visitor->trace(m_target); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |