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

Side by Side Diff: third_party/WebKit/Source/core/observer/ResizeObserver.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ResizeObserver_h
6 #define ResizeObserver_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Handle.h"
10
11 namespace blink {
12
13 class Document;
14 class Element;
15 class ResizeObserverCallback;
16 class ResizeObserverEntry;
17 class ResizeObservation;
18
19 // ResizeObserver represents ResizeObserver javascript api:
20 // https://github.com/WICG/ResizeObserver/
21 class ResizeObserver final : public GarbageCollectedFinalized<ResizeObserver>, p ublic ScriptWrappable {
22 DEFINE_WRAPPERTYPEINFO();
23 public:
24 static ResizeObserver* create(Document&, ResizeObserverCallback*);
25
26 virtual ~ResizeObserver() {};
27
28 // API methods
29 void observe(Element*);
30 void unobserve(Element*);
31 void disconnect();
32
33 DECLARE_TRACE();
34
35 // returns true if observations were found.
36 bool gatherObservations();
37
38 void deliverObservations();
39
40 void clearObservations();
41
42 private:
43
44 using ObservationList = HeapLinkedHashSet<WeakMember<ResizeObservation>>;
45
46 explicit ResizeObserver(ResizeObserverCallback*);
47
48 Member<ResizeObserverCallback> m_callback;
49
50 // List of elements we are observing
51 ObservationList m_observations;
52
53 // List of elements that have changes
54 HeapVector<Member<ResizeObservation>> m_activeObservations;
55
56 };
57
58
59 } // namespace blink
60
61 #endif // ResizeObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698