Chromium Code Reviews| 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..71a63bd65b412b6b107e39940b5b4d040abefe8d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/observer/ResizeObservation.h |
| @@ -0,0 +1,66 @@ |
| +// 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 "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.
|
| +#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.
|
| +#include "core/observer/ResizeObserverEntry.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class Element; |
| +class ResizeObserver; |
| + |
| +// ResizeObservation represents an element that is being observed. |
| +class ResizeObservation : public GarbageCollectedFinalized<ResizeObservation> { |
|
szager1
2016/05/23 19:49:11
Too many blank lines.
atotic1
2016/05/25 00:15:53
Done.
|
| + |
| +public: |
| + |
| + 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.
|
| + |
| + 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.
|
| + |
| + // True if target was resized since last broadcast |
| + bool hasResized() const; |
| + |
| + 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.
|
| + |
| + int broadcastWidth() const { return m_broadcastWidth; } |
| + |
| + int broadcastHeight() const { return m_broadcastHeight; } |
| + |
| + void setBroadcastSize(int width, int height); |
| + |
| + DECLARE_TRACE(); |
| + |
| +private: |
| + |
| + WeakMember<Element> m_target; |
| + 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
|
| + 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.
|
| + int m_broadcastHeight; // Last broadcast clientHeight. |
| +}; |
| + |
| +class ResizeObservationSet : public GarbageCollectedFinalized<ResizeObservationSet> { |
|
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
|
| + |
| +public: |
| + |
| + virtual ~ResizeObservationSet() {}; |
| + |
| + void add(ResizeObservation*); |
| + void remove(ResizeObservation*); |
| + DECLARE_TRACE(); |
| + |
| +private: |
| + |
| + HeapHashSet<Member<ResizeObservation>> m_observations; |
| + |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ResizeObservation_h |