Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |