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

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

Issue 2005593002: Initial ResizeObserver implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix global-interface-listing test 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/ResizeObservation.h
diff --git a/third_party/WebKit/Source/core/observer/ResizeObservation.h b/third_party/WebKit/Source/core/observer/ResizeObservation.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4e9081aea34281231f05c1ceda7abef43da63cf
--- /dev/null
+++ b/third_party/WebKit/Source/core/observer/ResizeObservation.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ResizeObservation_h
+#define ResizeObservation_h
+
+#include "core/observer/ResizeObserverEntry.h"
+#include "platform/geometry/LayoutSize.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class Element;
+class ResizeObserver;
+
+// ResizeObservation represents an element that is being observed.
+class ResizeObservation : public GarbageCollected<ResizeObservation> {
+public:
+ ResizeObservation(Element* target, ResizeObserver*);
+
+ // True if target was resized since last broadcast
+ bool hasResized() const;
+
+ Element* target() const { return m_target; }
+
+ LayoutSize broadcastSize() const { return m_broadcastSize; }
+
+ void setBroadcastSize(const LayoutSize& size) { m_broadcastSize = size; }
+
+ DECLARE_TRACE();
+
+private:
+
+ WeakMember<Element> m_target;
+ // m_observer only purpose is to maintain a strong reference
+ // to the ResizeObserver, to prevent it from being garbage-collected.
+ Member<ResizeObserver> m_observer;
+ LayoutSize m_broadcastSize;
+};
+
+
+
+} // namespace blink
+
+#endif // ResizeObservation_h

Powered by Google App Engine
This is Rietveld 408576698