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/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 LayoutObject* targetLayoutObject = target()->layoutObject(); | 48 LayoutObject* targetLayoutObject = target()->layoutObject(); |
49 ASSERT(targetLayoutObject && targetLayoutObject->isBoxModelObject()); | 49 ASSERT(targetLayoutObject && targetLayoutObject->isBoxModelObject()); |
50 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); | 50 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); |
51 } | 51 } |
52 | 52 |
53 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const | 53 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const |
54 { | 54 { |
55 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 55 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
56 if (rootLayoutObject->isLayoutView()) | 56 if (rootLayoutObject->isLayoutView()) |
57 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo
ntentRect()); | 57 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo
ntentRect()); |
58 // TODO(szager): Obey the spec -- use content box for a scrolling element, b
order box otherwise. | 58 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip()) |
59 else if (rootLayoutObject->isBox()) | |
60 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); | 59 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); |
61 else | 60 else |
62 rect = LayoutRect(toLayoutBoxModelObject(rootLayoutObject)->borderBoundi
ngBox()); | 61 rect = LayoutRect(toLayoutBoxModelObject(rootLayoutObject)->borderBoundi
ngBox()); |
63 applyRootMargin(rect); | 62 applyRootMargin(rect); |
64 } | 63 } |
65 | 64 |
66 void IntersectionObservation::clipToRoot(IntersectionGeometry& geometry) const | 65 void IntersectionObservation::clipToRoot(IntersectionGeometry& geometry) const |
67 { | 66 { |
68 // Map and clip rect into root element coordinates. | 67 // Map and clip rect into root element coordinates. |
69 // TODO(szager): the writing mode flipping needs a test. | 68 // TODO(szager): the writing mode flipping needs a test. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 m_observer.clear(); | 241 m_observer.clear(); |
243 } | 242 } |
244 | 243 |
245 DEFINE_TRACE(IntersectionObservation) | 244 DEFINE_TRACE(IntersectionObservation) |
246 { | 245 { |
247 visitor->trace(m_observer); | 246 visitor->trace(m_observer); |
248 visitor->trace(m_target); | 247 visitor->trace(m_target); |
249 } | 248 } |
250 | 249 |
251 } // namespace blink | 250 } // namespace blink |
OLD | NEW |