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

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

Issue 1559593002: Add root margin support for IntersectionObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-no-root-margin
Patch Set: rebaseline Created 4 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/IntersectionObserver.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.h b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
index 34a89d2615172d6f5baee6413d314695c37434e9..9072dde26eeabe8fa9b92f57df16bb469db5dcbd 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
@@ -34,9 +34,15 @@ public:
Element* root() { return m_root.get(); }
LayoutObject* rootLayoutObject();
+ bool hasPercentMargin() const;
+ const Length& topMargin() const { return m_topMargin; }
+ const Length& rightMargin() const { return m_rightMargin; }
+ const Length& bottomMargin() const { return m_bottomMargin; }
+ const Length& leftMargin() const { return m_leftMargin; }
bool isDescendantOfRoot(const Element*) const;
void computeIntersectionObservations(double timestamp);
void enqueueIntersectionObserverEntry(IntersectionObserverEntry&);
+ void applyRootMargin(LayoutRect&) const;
unsigned firstThresholdGreaterThan(float ratio) const;
void deliver();
void setActive(bool);
@@ -46,7 +52,7 @@ public:
DECLARE_TRACE();
private:
- explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const Vector<float>& thresholds);
+ explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const Vector<Length>& rootMargin, const Vector<float>& thresholds);
void checkRootAndDetachIfNeeded();
@@ -55,6 +61,10 @@ private:
HeapHashSet<WeakMember<IntersectionObservation>> m_observations;
HeapVector<Member<IntersectionObserverEntry>> m_entries;
Vector<float> m_thresholds;
+ Length m_topMargin;
+ Length m_rightMargin;
+ Length m_bottomMargin;
+ Length m_leftMargin;
ojan 2016/01/12 01:08:49 This object is getting quite large. I don't think
szager1 2016/01/12 19:24:43 Acknowledged. I would expect that the number of o
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698