KHtml

RenderSVGContainer.h
1 /*
2  Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2007 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
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  aint 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 #ifndef RenderSVGContainer_h
24 #define RenderSVGContainer_h
25 
26 #if ENABLE(SVG)
27 
28 #include "RenderPath.h"
29 #include "SVGPreserveAspectRatio.h"
30 
31 namespace WebCore
32 {
33 
34 class SVGElement;
35 
36 class RenderSVGContainer : public RenderObject
37 {
38 public:
39  RenderSVGContainer(SVGStyledElement *);
40  ~RenderSVGContainer();
41 
42  RenderObject *firstChild() const override
43  {
44  return m_firstChild;
45  }
46  RenderObject *lastChild() const override
47  {
48  return m_lastChild;
49  }
50 
51  short/*khtml*/ int width() const override
52  {
53  return m_width;
54  }
55  int height() const override
56  {
57  return m_height;
58  }
59 
60  virtual bool canHaveChildren() const;
61  void addChild(RenderObject *newChild, RenderObject *beforeChild = nullptr) override;
62  void removeChild(RenderObject *) override;
63 
64  virtual void destroy();
65  void destroyLeftoverChildren();
66 
67  // uncomment if you know how line 64' ambiguoty should be solved in that case.
68  // using khtml::RenderObject::removeChildNode;
69  RenderObject *removeChildNode(RenderObject *) override;
70  // uncomment if you know how line 64' ambiguoty should be solved in that case.
71  // using khtml::RenderObject::appendChildNode;
72  void appendChildNode(RenderObject *) override;
73  // uncomment if you know how line 62' of the implementation ambiguoty should be solved in that case.
74  // using khtml::RenderObject::insertChildNode;
75  void insertChildNode(RenderObject *child, RenderObject *before) override;
76 
77  // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
78  // change in parentage is not going to affect anything.
79  virtual void moveChildNode(RenderObject *child)
80  {
81  appendChildNode(child->parent()->removeChildNode(child));
82  }
83 
84  void calcMinMaxWidth() override
85  {
86  setMinMaxKnown();
87  }
88 
89  // Some containers do not want it's children
90  // to be drawn, because they may be 'referenced'
91  // Example: <marker> children in SVG
92  void setDrawsContents(bool);
93  bool drawsContents() const;
94 
95  bool isSVGContainer() const override
96  {
97  return true;
98  }
99  const char *renderName() const override
100  {
101  return "RenderSVGContainer";
102  }
103 
104  bool requiresLayer() const override;
105  short lineHeight(bool b) const override;
106  short baselinePosition(bool b) const override;
107 
108  void layout() override;
109  void paint(PaintInfo &, int parentX, int parentY) override;
110 
111  virtual IntRect absoluteClippedOverflowRect();
112  virtual void absoluteRects(Vector<IntRect> &rects, int tx, int ty, bool topLevel = true);
113 
114  FloatRect relativeBBox(bool includeStroke = true) const override;
115 
116  virtual bool calculateLocalTransform();
117  AffineTransform localTransform() const override;
118  virtual AffineTransform viewportTransform() const;
119 
120  /*virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);*/
121 
122  bool childAllowed() const override
123  {
124  return true;
125  }
126 
127 protected:
128  virtual void applyContentTransforms(PaintInfo &);
129  virtual void applyAdditionalTransforms(PaintInfo &);
130 
131  void calcBounds();
132 
133 private:
134  int calcReplacedWidth() const;
135  int calcReplacedHeight() const;
136 
137  RenderObject *m_firstChild;
138  RenderObject *m_lastChild;
139 
140  int m_width;
141  int m_height;
142 
143  bool selfWillPaint() const;
144 
145  bool m_drawsContents : 1;
146 
147 protected:
148  IntRect m_absoluteBounds;
149  AffineTransform m_localTransform;
150 };
151 
152 } // namespace WebCore
153 
154 #endif // ENABLE(SVG)
155 #endif // RenderSVGContainer_h
156 
MESSAGECORE_EXPORT KMime::Content * firstChild(const KMime::Content *node)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.