KHtml

render_container.h
1 /*
2  * This file is part of the html renderer for KDE.
3  *
4  * Copyright (C) 2001 Antti Koivisto ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 #ifndef render_container_h
23 #define render_container_h
24 
25 #include "render_object.h"
26 
27 namespace khtml
28 {
29 
30 /**
31  * Base class for rendering objects that can have children
32  */
34 {
35 public:
36  RenderContainer(DOM::NodeImpl *node);
37 
38  RenderObject *firstChild() const override
39  {
40  return m_first;
41  }
42  RenderObject *lastChild() const override
43  {
44  return m_last;
45  }
46 
47  bool childAllowed() const override
48  {
49  // Prevent normal children when we are replaced by generated content
50  if (style()) {
51  return style()->useNormalContent();
52  }
53  return true;
54  }
55 
56  void addChild(RenderObject *newChild, RenderObject *beforeChild = nullptr) override;
57 
58  RenderObject *removeChildNode(RenderObject *child) override;
59  void appendChildNode(RenderObject *child) override;
60  void insertChildNode(RenderObject *child, RenderObject *before) override;
61 
62  void layout() override;
63  void calcMinMaxWidth() override
64  {
65  setMinMaxKnown(true);
66  }
67 
68  void removeSuperfluousAnonymousBlockChild(RenderObject *child) override;
69 
70  void setStyle(RenderStyle *_style) override;
71 
72  RenderPosition positionForCoordinates(int x, int y) override;
73 
74 protected:
75  // Generate CSS content
76  void createGeneratedContent();
77  void updateReplacedContent();
78 
79  void updatePseudoChildren();
80  void updatePseudoChild(RenderStyle::PseudoId type);
81 
82  RenderContainer *pseudoContainer(RenderStyle::PseudoId type) const;
83  void addPseudoContainer(RenderObject *child);
84 private:
85 
86  void setFirstChild(RenderObject *first)
87  {
88  m_first = first;
89  }
90  void setLastChild(RenderObject *last)
91  {
92  m_last = last;
93  }
94 
95 protected:
96 
97  RenderObject *m_first;
98  RenderObject *m_last;
99 };
100 
101 }
102 #endif
This file is part of the HTML rendering engine for KDE.
Base class for rendering objects that can have children.
Base Class for all rendering tree objects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 22 2021 22:48:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.