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

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: Observe content box, not clientWidth Created 4 years, 6 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 "core/dom/Element.h"
szager1 2016/06/02 20:52:41 Move this to .cpp file.
atotic1 2016/06/08 18:59:22 Done.
10 #include "core/observer/ResizeObserverEntry.h"
szager1 2016/06/02 20:52:41 ditto
atotic1 2016/06/08 18:59:22 Done. What was I thinking here?
11 #include "platform/heap/Handle.h"
12
13 namespace blink {
14
15 class Document;
16 class Element;
17 class ResizeObserverCallback;
18 class ResizeObserverEntry;
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 {
szager1 2016/06/02 20:52:41 No Finalized, no destructors; see previous comment
atotic1 2016/06/08 18:59:22 This one has to be finalized because HeapLinkedHas
24 DEFINE_WRAPPERTYPEINFO();
25
26 public:
27 static ResizeObserver* create(Document&, ResizeObserverCallback*);
28
29 virtual ~ResizeObserver() {};
30
31 // API methods
32 void observe(Element*);
33 void unobserve(Element*);
34 void disconnect();
35
36 DECLARE_TRACE();
37
38 // returns true if observations were found.
39 bool gatherObservations();
40
41 void deliverObservations();
42
43 private:
44
45 using ObservationList = HeapLinkedHashSet<WeakMember<ResizeObservation>>;
46
47 explicit ResizeObserver(ResizeObserverCallback*);
48
49 Member<ResizeObserverCallback> m_callback;
50
51 // List of elements we are observing
52 ObservationList m_observations;
53
54 // List of elements that have changes
55 HeapVector<Member<ResizeObservation>> m_activeObservations;
56
57 };
58
59
60 } // namespace blink
61
62 #endif // ResizeObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698