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/ResizeObserverEntry.h" | |
6 | |
7 #include "core/dom/ClientRect.h" | |
8 #include "core/dom/DOMRectReadOnly.h" | |
9 #include "core/dom/Element.h" | |
10 #include "core/layout/LayoutBox.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class ResizeObservation; | |
15 | |
16 ResizeObserverEntry::ResizeObserverEntry(Element* target) | |
17 : m_target(target) | |
18 { | |
19 if (!m_target) | |
20 return; | |
21 LayoutBox* layout = m_target->layoutBox(); | |
22 if (!layout) | |
23 return; | |
24 m_contentRect.setSize(layout->contentSize()); | |
szager1
2016/06/02 20:52:41
m_contentRect = layout->contentBoxRect();
atotic1
2016/06/08 18:59:22
Why? m_contentRect gets the size from layout, and
| |
25 m_contentRect.setLocation(LayoutPoint(layout->paddingLeft(), layout->padding Top())); | |
26 } | |
27 | |
28 ClientRect* ResizeObserverEntry::contentRect() const | |
29 { | |
30 return ClientRect::create( FloatRect( | |
31 m_contentRect.x(), m_contentRect.y(), | |
32 m_contentRect.width(), m_contentRect.height() | |
33 )); | |
34 // FIXME(atotic): should return DOMReadOnlyRect once GeometryInterfaces land | |
35 // return DOMRectReadOnly::create(m_contentRect.x(), m_contentRect.y(), | |
36 // m_contentRect.width(), m_contentRect.height()); | |
37 | |
38 } | |
39 | |
40 LayoutSize ResizeObserverEntry::contentSize() const | |
41 { | |
42 return m_contentRect.size(); | |
43 } | |
44 | |
45 | |
46 DEFINE_TRACE(ResizeObserverEntry) | |
47 { | |
48 visitor->trace(m_target); | |
49 } | |
50 | |
51 } // namespace blink | |
OLD | NEW |