| 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/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/IntersectionGeometry.h" | 10 #include "core/layout/IntersectionGeometry.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 void IntersectionObservation::UpdateShouldReportRootBoundsAfterDomChange() { | 95 void IntersectionObservation::UpdateShouldReportRootBoundsAfterDomChange() { |
| 96 if (!Observer()->RootIsImplicit()) { | 96 if (!Observer()->RootIsImplicit()) { |
| 97 should_report_root_bounds_ = true; | 97 should_report_root_bounds_ = true; |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 should_report_root_bounds_ = false; | 100 should_report_root_bounds_ = false; |
| 101 LocalFrame* target_frame = Target()->GetDocument().GetFrame(); | 101 LocalFrame* target_frame = Target()->GetDocument().GetFrame(); |
| 102 if (!target_frame) | 102 if (!target_frame) |
| 103 return; | 103 return; |
| 104 Frame* root_frame = target_frame->Tree().Top(); | 104 Frame& root_frame = target_frame->Tree().Top(); |
| 105 DCHECK(root_frame); | 105 if (&root_frame == target_frame) { |
| 106 if (root_frame == target_frame) { | |
| 107 should_report_root_bounds_ = true; | 106 should_report_root_bounds_ = true; |
| 108 } else { | 107 } else { |
| 109 should_report_root_bounds_ = | 108 should_report_root_bounds_ = |
| 110 target_frame->GetSecurityContext()->GetSecurityOrigin()->CanAccess( | 109 target_frame->GetSecurityContext()->GetSecurityOrigin()->CanAccess( |
| 111 root_frame->GetSecurityContext()->GetSecurityOrigin()); | 110 root_frame.GetSecurityContext()->GetSecurityOrigin()); |
| 112 } | 111 } |
| 113 } | 112 } |
| 114 | 113 |
| 115 DEFINE_TRACE(IntersectionObservation) { | 114 DEFINE_TRACE(IntersectionObservation) { |
| 116 visitor->Trace(observer_); | 115 visitor->Trace(observer_); |
| 117 visitor->Trace(target_); | 116 visitor->Trace(target_); |
| 118 } | 117 } |
| 119 | 118 |
| 120 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |