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

Side by Side 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: 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 ResizeObservation_h
6 #define ResizeObservation_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
szager1 2016/05/23 19:49:10 I don't think you use this.
atotic1 2016/05/25 00:15:52 Done.
9 #include "core/dom/Element.h"
szager1 2016/05/23 19:49:10 You shouldn't need this, the forward class declara
atotic1 2016/05/25 00:15:52 Done.
10 #include "core/observer/ResizeObserverEntry.h"
11 #include "platform/heap/Handle.h"
12
13 namespace blink {
14
15 class Element;
16 class ResizeObserver;
17
18 // ResizeObservation represents an element that is being observed.
19 class ResizeObservation : public GarbageCollectedFinalized<ResizeObservation> {
szager1 2016/05/23 19:49:11 Too many blank lines.
atotic1 2016/05/25 00:15:53 Done.
20
21 public:
22
23 ResizeObservation(Element * target, ResizeObserver *);
szager1 2016/05/23 19:49:11 No space between "Element" and "*". Here and ever
atotic1 2016/05/25 00:15:53 Done.
24
25 virtual ~ResizeObservation() {};
szager1 2016/05/23 19:49:11 No spurious destructors: get rid of this and chang
atotic1 2016/05/25 00:15:52 My understanding was that unless class is GarbageC
szager1 2016/06/02 20:52:40 HeapHashSet does not have a destructor.
26
27 // True if target was resized since last broadcast
28 bool hasResized() const;
29
30 Element * target() const { return m_target; }
szager1 2016/05/23 19:49:11 No space between "Element" and "*"
atotic1 2016/05/25 00:15:53 Done.
31
32 int broadcastWidth() const { return m_broadcastWidth; }
33
34 int broadcastHeight() const { return m_broadcastHeight; }
35
36 void setBroadcastSize(int width, int height);
37
38 DECLARE_TRACE();
39
40 private:
41
42 WeakMember<Element> m_target;
43 Member<ResizeObserver> m_observer; // Used for GC only.
szager1 2016/05/23 19:49:10 I think this comment is confusing; it doesn't give
atotic1 2016/05/25 00:15:53 If I was refactoring a class, and saw a class memb
44 int m_broadcastWidth; // Last broadcast clientWidth.
szager1 2016/05/23 19:49:11 We need to use LayoutUnit everywhere, not int. Fo
szager1 2016/05/23 19:49:11 Instead of the comment, just rename the field to m
atotic1 2016/05/25 00:15:52 LayoutUnit vs int: current code returns an int, th
atotic1 2016/05/25 00:15:53 Acknowledged.
45 int m_broadcastHeight; // Last broadcast clientHeight.
46 };
47
48 class ResizeObservationSet : public GarbageCollectedFinalized<ResizeObservationS et> {
szager1 2016/05/23 19:49:10 We don't really use custom collection wrapper clas
atotic1 2016/05/25 00:15:53 That's makes for some ugly looking declarations, a
49
50 public:
51
52 virtual ~ResizeObservationSet() {};
53
54 void add(ResizeObservation*);
55 void remove(ResizeObservation*);
56 DECLARE_TRACE();
57
58 private:
59
60 HeapHashSet<Member<ResizeObservation>> m_observations;
61
62 };
63
64 } // namespace blink
65
66 #endif // ResizeObservation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698