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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.h

Issue 2645283008: IntersectionObserver: Always send an initial notification. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/IntersectionObservation.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.h b/third_party/WebKit/Source/core/dom/IntersectionObservation.h
index dcb93231cd50f05f279f81ac5504dec7895bad55..e3f1dd433fcb8e72b71eb92e04b67b27b63462af 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.h
@@ -23,7 +23,7 @@ class IntersectionObservation final
IntersectionObserver* observer() const { return m_observer.get(); }
Element* target() const { return m_target; }
unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
- void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
+ void setLastThresholdIndex(int index) { m_lastThresholdIndex = index; }
ojan 2017/01/26 01:44:56 I assume this is leftover from a previous iteratio
szager1 2017/01/30 19:37:41 Yep, thanks for the catch.
void computeIntersectionObservations(DOMHighResTimeStamp);
void disconnect();
@@ -34,7 +34,12 @@ class IntersectionObservation final
WeakMember<Element> m_target;
const unsigned m_shouldReportRootBounds : 1;
+
+ // HACK: the spec calls for the inital value of m_lastThresholdIndex to be
+ // -1. But if m_lastThresholdIndex is changed to a signed int type, then
+ // we can't bit-pack it. Instead, inflate all thresholdIndex values by 1.
ojan 2017/01/26 01:44:56 Since we're going hacky, how about initializing m_
szager1 2017/01/30 19:37:41 The RELEASE_ASSERT is me being paranoid. This pat
unsigned m_lastThresholdIndex : 30;
+ static const unsigned kMaxThresholdIndex = (unsigned)0x40000000;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698