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

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: Initialize margin members to Fixed 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 48b1823d9307297a3f8e1e373aaf31135623d3ba..e07cdb2ec39e1e26f7ed235fb6af548770bde982 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);
@@ -47,7 +53,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();
@@ -56,6 +62,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;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698