OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2009 Google, Inc. All rights reserved. | 4 * Copyright (C) 2009 Google, Inc. All rights reserved. |
5 * Copyright (C) 2009 Apple Inc. All rights reserved. | 5 * Copyright (C) 2009 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #ifndef RenderSVGRoot_h | 23 #ifndef RenderSVGRoot_h |
24 #define RenderSVGRoot_h | 24 #define RenderSVGRoot_h |
25 | 25 |
26 #include "core/rendering/RenderReplaced.h" | 26 #include "core/rendering/RenderReplaced.h" |
27 #include "platform/geometry/FloatRect.h" | |
28 | 27 |
29 namespace blink { | 28 namespace blink { |
30 | 29 |
31 class SVGElement; | 30 class SVGElement; |
32 | 31 |
33 class RenderSVGRoot FINAL : public RenderReplaced { | 32 class RenderSVGRoot FINAL : public RenderReplaced { |
34 public: | 33 public: |
35 explicit RenderSVGRoot(SVGElement*); | 34 explicit RenderSVGRoot(SVGElement*); |
36 virtual ~RenderSVGRoot(); | 35 virtual ~RenderSVGRoot(); |
37 virtual void trace(Visitor*) OVERRIDE; | 36 virtual void trace(Visitor*) OVERRIDE; |
38 | 37 |
39 bool isEmbeddedThroughSVGImage() const; | 38 bool isEmbeddedThroughSVGImage() const; |
40 bool isEmbeddedThroughFrameContainingSVGDocument() const; | 39 bool isEmbeddedThroughFrameContainingSVGDocument() const; |
41 | 40 |
42 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const OVERRIDE; | 41 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const OVERRIDE; |
43 | 42 |
44 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | |
45 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | |
46 | |
47 // If you have a RenderSVGRoot, use firstChild or lastChild instead. | 43 // If you have a RenderSVGRoot, use firstChild or lastChild instead. |
48 void slowFirstChild() const WTF_DELETED_FUNCTION; | 44 void slowFirstChild() const WTF_DELETED_FUNCTION; |
49 void slowLastChild() const WTF_DELETED_FUNCTION; | 45 void slowLastChild() const WTF_DELETED_FUNCTION; |
50 | 46 |
51 const RenderObjectChildList* children() const { return &m_children; } | |
52 RenderObjectChildList* children() { return &m_children; } | |
53 | |
54 bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; } | 47 bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; } |
55 virtual void setNeedsBoundariesUpdate() OVERRIDE { m_needsBoundariesOrTransf
ormUpdate = true; } | 48 virtual void setNeedsBoundariesUpdate() OVERRIDE { m_needsBoundariesOrTransf
ormUpdate = true; } |
56 virtual void setNeedsTransformUpdate() OVERRIDE { m_needsBoundariesOrTransfo
rmUpdate = true; } | 49 virtual void setNeedsTransformUpdate() OVERRIDE { m_needsBoundariesOrTransfo
rmUpdate = true; } |
57 | 50 |
58 IntSize containerSize() const { return m_containerSize; } | 51 IntSize containerSize() const { return m_containerSize; } |
59 void setContainerSize(const IntSize& containerSize) | 52 void setContainerSize(const IntSize& containerSize) |
60 { | 53 { |
61 // SVGImage::draw() does a view layout prior to painting, | 54 // SVGImage::draw() does a view layout prior to painting, |
62 // and we need that layout to know of the new size otherwise | 55 // and we need that layout to know of the new size otherwise |
63 // the rendering may be incorrectly using the old size. | 56 // the rendering may be incorrectly using the old size. |
64 if (m_containerSize != containerSize) | 57 if (m_containerSize != containerSize) |
65 setNeedsLayoutAndFullPaintInvalidation(); | 58 setNeedsLayoutAndFullPaintInvalidation(); |
66 m_containerSize = containerSize; | 59 m_containerSize = containerSize; |
67 } | 60 } |
68 | 61 |
69 // localToBorderBoxTransform maps local SVG viewport coordinates to local CS
S box coordinates. | 62 // localToBorderBoxTransform maps local SVG viewport coordinates to local CS
S box coordinates. |
70 const AffineTransform& localToBorderBoxTransform() const { return m_localToB
orderBoxTransform; } | 63 const AffineTransform& localToBorderBoxTransform() const { return m_localToB
orderBoxTransform; } |
71 | 64 |
72 private: | 65 private: |
| 66 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
| 67 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
| 68 |
| 69 const RenderObjectChildList* children() const { return &m_children; } |
| 70 RenderObjectChildList* children() { return &m_children; } |
| 71 |
73 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(
); } | 72 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(
); } |
74 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu
rn children(); } | 73 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu
rn children(); } |
75 | 74 |
76 virtual const char* renderName() const OVERRIDE { return "RenderSVGRoot"; } | 75 virtual const char* renderName() const OVERRIDE { return "RenderSVGRoot"; } |
77 virtual bool isSVGRoot() const OVERRIDE { return true; } | 76 virtual bool isSVGRoot() const OVERRIDE { return true; } |
78 virtual bool isSVG() const OVERRIDE { return true; } | 77 virtual bool isSVG() const OVERRIDE { return true; } |
79 | 78 |
80 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = Com
puteActual) const OVERRIDE; | 79 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = Com
puteActual) const OVERRIDE; |
81 virtual LayoutUnit computeReplacedLogicalHeight() const OVERRIDE; | 80 virtual LayoutUnit computeReplacedLogicalHeight() const OVERRIDE; |
82 virtual void layout() OVERRIDE; | 81 virtual void layout() OVERRIDE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool m_isLayoutSizeChanged : 1; | 123 bool m_isLayoutSizeChanged : 1; |
125 bool m_needsBoundariesOrTransformUpdate : 1; | 124 bool m_needsBoundariesOrTransformUpdate : 1; |
126 bool m_hasBoxDecorationBackground : 1; | 125 bool m_hasBoxDecorationBackground : 1; |
127 }; | 126 }; |
128 | 127 |
129 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGRoot, isSVGRoot()); | 128 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGRoot, isSVGRoot()); |
130 | 129 |
131 } // namespace blink | 130 } // namespace blink |
132 | 131 |
133 #endif // RenderSVGRoot_h | 132 #endif // RenderSVGRoot_h |
OLD | NEW |