OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ResizeObservation_h | 5 #ifndef ResizeObservation_h |
6 #define ResizeObservation_h | 6 #define ResizeObservation_h |
7 | 7 |
8 #include "core/observer/ResizeObserverEntry.h" | 8 #include "core/observer/ResizeObserverEntry.h" |
9 #include "platform/geometry/LayoutSize.h" | 9 #include "platform/geometry/LayoutSize.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class Element; | 14 class Element; |
15 class ResizeObserver; | 15 class ResizeObserver; |
16 | 16 |
17 // ResizeObservation represents an element that is being observed. | 17 // ResizeObservation represents an element that is being observed. |
18 class CORE_EXPORT ResizeObservation final : public GarbageCollected<ResizeObserv
ation> { | 18 class CORE_EXPORT ResizeObservation final : public GarbageCollected<ResizeObserv
ation> { |
19 public: | 19 public: |
20 ResizeObservation(Element* target, ResizeObserver*); | 20 ResizeObservation(Element* target, ResizeObserver*); |
21 | 21 |
22 Element* target() const { return m_target; } | 22 Element* target() const { return m_target; } |
23 size_t targetDepth(); | 23 size_t targetDepth(); |
24 void setObservationSize(const LayoutSize&); | 24 void setObservationSize(const LayoutSize&); |
25 // True if observationSize differs from target's current size. | 25 // True if observationSize differs from target's current size. |
26 bool observationSizeOutOfSync() const; | 26 bool observationSizeOutOfSync() const; |
| 27 void elementSizeChanged(); |
27 | 28 |
28 static LayoutSize getTargetSize(Element* target); | 29 static LayoutSize getTargetSize(Element* target); |
29 | 30 |
30 DECLARE_TRACE(); | 31 DECLARE_TRACE(); |
31 | 32 |
32 private: | 33 private: |
33 WeakMember<Element> m_target; | 34 WeakMember<Element> m_target; |
34 Member<ResizeObserver> m_observer; | 35 Member<ResizeObserver> m_observer; |
35 // Target size sent in last observation notification. | 36 // Target size sent in last observation notification. |
36 LayoutSize m_observationSize; | 37 LayoutSize m_observationSize; |
| 38 bool m_elementSizeChanged; |
37 }; | 39 }; |
38 | 40 |
39 } // namespace blink | 41 } // namespace blink |
40 | 42 |
41 #endif // ResizeObservation_h | 43 #endif // ResizeObservation_h |
OLD | NEW |