1 | /* |
2 | * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 | * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> |
4 | * Copyright (C) 2009 Google, Inc. All rights reserved. |
5 | * Copyright (C) 2009 Apple Inc. All rights reserved. |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
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 |
19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #pragma once |
24 | |
25 | #include "RenderSVGModelObject.h" |
26 | |
27 | namespace WebCore { |
28 | |
29 | class SVGElement; |
30 | |
31 | class RenderSVGContainer : public RenderSVGModelObject { |
32 | WTF_MAKE_ISO_ALLOCATED(RenderSVGContainer); |
33 | public: |
34 | virtual ~RenderSVGContainer(); |
35 | |
36 | void paint(PaintInfo&, const LayoutPoint&) override; |
37 | void setNeedsBoundariesUpdate() final { m_needsBoundariesUpdate = true; } |
38 | bool needsBoundariesUpdate() final { return m_needsBoundariesUpdate; } |
39 | virtual bool didTransformToRootUpdate() { return false; } |
40 | bool isObjectBoundingBoxValid() const { return m_objectBoundingBoxValid; } |
41 | |
42 | protected: |
43 | RenderSVGContainer(SVGElement&, RenderStyle&&); |
44 | |
45 | const char* renderName() const override { return "RenderSVGContainer" ; } |
46 | |
47 | bool canHaveChildren() const final { return true; } |
48 | |
49 | void layout() override; |
50 | |
51 | void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) final; |
52 | |
53 | FloatRect objectBoundingBox() const final { return m_objectBoundingBox; } |
54 | FloatRect strokeBoundingBox() const final { return m_strokeBoundingBox; } |
55 | FloatRect repaintRectInLocalCoordinates() const final { return m_repaintBoundingBox; } |
56 | |
57 | bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override; |
58 | |
59 | // Allow RenderSVGTransformableContainer to hook in at the right time in layout() |
60 | virtual bool calculateLocalTransform() { return false; } |
61 | |
62 | // Allow RenderSVGViewportContainer to hook in at the right times in layout(), paint() and nodeAtFloatPoint() |
63 | virtual void calcViewport() { } |
64 | virtual void applyViewportClip(PaintInfo&) { } |
65 | virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; } |
66 | |
67 | virtual void determineIfLayoutSizeChanged() { } |
68 | |
69 | bool selfWillPaint(); |
70 | void updateCachedBoundaries(); |
71 | |
72 | private: |
73 | bool isSVGContainer() const final { return true; } |
74 | |
75 | FloatRect m_objectBoundingBox; |
76 | FloatRect m_strokeBoundingBox; |
77 | FloatRect m_repaintBoundingBox; |
78 | |
79 | bool m_objectBoundingBoxValid { false }; |
80 | bool m_needsBoundariesUpdate { true }; |
81 | }; |
82 | |
83 | } // namespace WebCore |
84 | |
85 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGContainer, isSVGContainer()) |
86 | |