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 #include "core/observer/ResizeObserverEntry.h" | 5 #include "core/observer/ResizeObserverEntry.h" |
6 | 6 |
7 #include "core/dom/ClientRect.h" | 7 #include "core/dom/ClientRect.h" |
8 #include "core/dom/DOMRectReadOnly.h" | |
9 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
10 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
11 #include "core/observer/ResizeObservation.h" | 10 #include "core/observer/ResizeObservation.h" |
12 | 11 |
13 namespace blink { | 12 namespace blink { |
14 | 13 |
15 class ResizeObservation; | 14 class ResizeObservation; |
16 | 15 |
17 ResizeObserverEntry::ResizeObserverEntry(Element* target) | 16 ResizeObserverEntry::ResizeObserverEntry(Element* target) |
18 : m_target(target) | 17 : m_target(target) |
19 { | 18 { |
| 19 FloatSize size = FloatSize(ResizeObservation::getTargetSize(m_target)); |
| 20 FloatPoint location; |
| 21 LayoutBox* layout = m_target ? m_target->layoutBox() : nullptr; |
| 22 if (layout) { |
| 23 location = FloatPoint(layout->paddingLeft(), layout->paddingTop()); |
| 24 } |
| 25 m_contentRect = ClientRect::create(FloatRect(location, size)); |
| 26 } |
| 27 |
| 28 LayoutSize ResizeObserverEntry::contentSize() const |
| 29 { |
| 30 return LayoutSize(m_contentRect->width(), m_contentRect->height()); |
20 } | 31 } |
21 | 32 |
22 DEFINE_TRACE(ResizeObserverEntry) | 33 DEFINE_TRACE(ResizeObserverEntry) |
23 { | 34 { |
24 visitor->trace(m_target); | 35 visitor->trace(m_target); |
25 visitor->trace(m_contentRect); | 36 visitor->trace(m_contentRect); |
26 } | 37 } |
27 | 38 |
28 } // namespace blink | 39 } // namespace blink |
OLD | NEW |