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

Side by Side Diff: third_party/WebKit/Source/core/observer/ResizeObservation.cpp

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 #include "core/observer/ResizeObservation.h"
6
7 #include "core/observer/ResizeObserver.h"
8
9 namespace blink {
10
11 ResizeObservation::ResizeObservation(Element * target, ResizeObserver * observer ) :
szager1 2016/05/23 19:49:10 Colon goes on next line; refer to existing class d
atotic1 2016/05/25 00:15:52 Done.
12 m_target(target),
szager1 2016/05/23 19:49:10 Comma goes at the beginning of the next line, for
atotic1 2016/05/25 00:15:52 Done.
13 m_observer(observer),
14 m_broadcastWidth(target->clientWidth()),
15 m_broadcastHeight(target->clientHeight())
16 {
17 m_target->ensureResizeObserverData().add(this);
18 }
19
20 bool ResizeObservation::hasResized() const
21 {
22 if (!m_target)
23 return false;
24 return (m_target->clientWidth() != m_broadcastWidth
25 || m_target->clientHeight() != m_broadcastHeight);
26 }
27
28 void ResizeObservation::setBroadcastSize(int width, int height)
29 {
30 m_broadcastWidth = width;
31 m_broadcastHeight = height;
32 }
33
34 DEFINE_TRACE(ResizeObservation)
35 {
36 visitor->trace(m_target);
37 visitor->trace(m_observer);
38 }
39
40 void ResizeObservationSet::add(ResizeObservation* obs)
41 {
42 m_observations.add(obs);
43 }
44
45 void ResizeObservationSet::remove(ResizeObservation* obs)
46 {
47 m_observations.remove(obs);
48 }
49
50 DEFINE_TRACE(ResizeObservationSet)
51 {
52 visitor->trace(m_observations);
53 }
54
55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698