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

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: Created 4 years, 7 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"
szager1 2016/05/23 19:49:11 I don't think you use this.
9 #include "core/dom/Element.h"
szager1 2016/05/23 19:49:12 You shouldn't need this, the forward class declara
10 #include "core/observer/ResizeObserverEntry.h"
szager1 2016/05/23 19:49:12 I don't think you use this.
11 #include "platform/heap/Handle.h"
12
13 namespace blink {
14
15 class Document;
16 class Element;
17 class ResizeObserverCallback;
18 class ResizeObserverEntry;
szager1 2016/05/23 19:49:11 I don't think you use this.
19 class ResizeObservation;
20
21 // ResizeObserver represents ResizeObserver javascript api:
22 // https://github.com/WICG/ResizeObserver/
23 class ResizeObserver final : public GarbageCollectedFinalized<ResizeObserver>, p ublic ScriptWrappable {
24 DEFINE_WRAPPERTYPEINFO();
25
26 public:
27 static ResizeObserver* create(Document&, ResizeObserverCallback*);
28
29 virtual ~ResizeObserver() {};
szager1 2016/05/23 19:49:12 No unnecessary destructors, switch class to Garbag
30
31 // API methods
32 void observe(Element*);
33 void unobserve(Element*);
34 void disconnect();
35
36 DECLARE_TRACE();
37
38 void gatherObservations();
szager1 2016/05/23 19:49:12 Too much whitespace.
39
40 bool hasObservations() const { return !m_activeObservations.isEmpty(); }
41
42 void deliverObservations();
43
44 private:
45
46 // FIXME(atotic): for GC, I need an ordered list of WeakMembers here.
47 using ObservationList = HeapVector<Member<ResizeObservation>>;
szager1 2016/05/23 19:49:11 No typedef's or "using", just use full type everyw
48
49 ObservationList::iterator find(Element*);
50
51 explicit ResizeObserver(ResizeObserverCallback*);
52
53 Member<ResizeObserverCallback> m_callback;
54
55 // List of elements we are observing
56 ObservationList m_observations;
57
58 // List of elements that have changes
59 HeapVector<Member<ResizeObservation>> m_activeObservations;
60
61 };
62
63
64 } // namespace blink
65
66 #endif // ResizeObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698