Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 2727843003: Replace RELEASE_ASSERT with CHECK in core/{dom,editing,html} (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/layout/IntersectionGeometry.h" 9 #include "core/layout/IntersectionGeometry.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 float targetArea = geometry.targetRect().size().width().toFloat() * 60 float targetArea = geometry.targetRect().size().width().toFloat() *
61 geometry.targetRect().size().height().toFloat(); 61 geometry.targetRect().size().height().toFloat();
62 newVisibleRatio = intersectionArea / targetArea; 62 newVisibleRatio = intersectionArea / targetArea;
63 } 63 }
64 newThresholdIndex = observer()->firstThresholdGreaterThan(newVisibleRatio); 64 newThresholdIndex = observer()->firstThresholdGreaterThan(newVisibleRatio);
65 } else { 65 } else {
66 newVisibleRatio = 0; 66 newVisibleRatio = 0;
67 newThresholdIndex = 0; 67 newThresholdIndex = 0;
68 } 68 }
69 69
70 RELEASE_ASSERT(newThresholdIndex < kMaxThresholdIndex); 70 CHECK(newThresholdIndex < kMaxThresholdIndex);
yoichio 2017/03/02 07:25:22 CHECK_LT?
tkent 2017/03/02 07:33:59 Unfortunately we can't. If we use CHECK_LT, Inter
71 71
72 if (m_lastThresholdIndex != newThresholdIndex) { 72 if (m_lastThresholdIndex != newThresholdIndex) {
73 IntRect snappedRootBounds = geometry.rootIntRect(); 73 IntRect snappedRootBounds = geometry.rootIntRect();
74 IntRect* rootBoundsPointer = 74 IntRect* rootBoundsPointer =
75 m_shouldReportRootBounds ? &snappedRootBounds : nullptr; 75 m_shouldReportRootBounds ? &snappedRootBounds : nullptr;
76 IntersectionObserverEntry* newEntry = new IntersectionObserverEntry( 76 IntersectionObserverEntry* newEntry = new IntersectionObserverEntry(
77 timestamp, newVisibleRatio, geometry.targetIntRect(), rootBoundsPointer, 77 timestamp, newVisibleRatio, geometry.targetIntRect(), rootBoundsPointer,
78 geometry.intersectionIntRect(), geometry.doesIntersect(), target()); 78 geometry.intersectionIntRect(), geometry.doesIntersect(), target());
79 observer()->enqueueIntersectionObserverEntry(*newEntry); 79 observer()->enqueueIntersectionObserverEntry(*newEntry);
80 setLastThresholdIndex(newThresholdIndex); 80 setLastThresholdIndex(newThresholdIndex);
81 } 81 }
82 } 82 }
83 83
84 void IntersectionObservation::disconnect() { 84 void IntersectionObservation::disconnect() {
85 DCHECK(observer()); 85 DCHECK(observer());
86 if (m_target) 86 if (m_target)
87 target()->ensureIntersectionObserverData().removeObservation(*observer()); 87 target()->ensureIntersectionObserverData().removeObservation(*observer());
88 m_observer.clear(); 88 m_observer.clear();
89 } 89 }
90 90
91 DEFINE_TRACE(IntersectionObservation) { 91 DEFINE_TRACE(IntersectionObservation) {
92 visitor->trace(m_observer); 92 visitor->trace(m_observer);
93 visitor->trace(m_target); 93 visitor->trace(m_target);
94 } 94 }
95 95
96 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698