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

Unified Diff: third_party/WebKit/Source/core/observer/ResizeObserverController.h

Issue 2188983003: ResizeObserver pt5: size change notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: All CR comments addressed Created 4 years, 5 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/observer/ResizeObserverController.h
diff --git a/third_party/WebKit/Source/core/observer/ResizeObserverController.h b/third_party/WebKit/Source/core/observer/ResizeObserverController.h
index e84ef621ee747c31a93d6245c504355aaccd05e0..49265289100c0c142bd2fa88d7d7cf2deb1e378d 100644
--- a/third_party/WebKit/Source/core/observer/ResizeObserverController.h
+++ b/third_party/WebKit/Source/core/observer/ResizeObserverController.h
@@ -13,17 +13,36 @@ class ResizeObserver;
// ResizeObserverController keeps track of all ResizeObservers
// in a single Document.
+//
+// The observation API is used to integrate ResizeObserver
+// and the event loop. It delivers notification in a loop.
+// In each iteration, only notifications deeper than the
+// shallowest notification from previous iteration are delivered.
class ResizeObserverController final : public GarbageCollected<ResizeObserverController> {
public:
+ static const size_t kDepthBottom = 4096;
+
ResizeObserverController();
void addObserver(ResizeObserver&);
+ // observation API
+ // Returns depth of shallowest observed node, kDepthLimit if none.
+ size_t gatherObservations(size_t deeperThan);
+ // Returns true if gatherObservations has skipped observations
+ // because they were too shallow.
+ bool skippedObservations();
+ void deliverObservations();
+ void clearObservations();
+ void observerChanged() { m_observersChanged = true; }
+
DECLARE_TRACE();
private:
// Active observers
HeapHashSet<WeakMember<ResizeObserver>> m_observers;
+ // True if any observers were changed since last notification.
+ bool m_observersChanged;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698