Swap RenderBox and RenderContainer. Make leaf RenderObjects actually derive off...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Sep 2004 00:10:41 +0000 (00:10 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Sep 2004 00:10:41 +0000 (00:10 +0000)
        Reviewed by kocienda

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::addChildToFlow):
        * khtml/rendering/render_box.cpp:
        (RenderBox::RenderBox):
        (RenderBox::detach):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_container.cpp:
        (RenderContainer::RenderContainer):
        (RenderContainer::detach):
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::detach):
        (RenderFlow::dirtyLineBoxes):
        (RenderFlow::createInlineBox):
        (RenderFlow::getAbsoluteRepaintRect):
        (RenderFlow::lowestPosition):
        (RenderFlow::rightmostPosition):
        (RenderFlow::leftmostPosition):
        (RenderFlow::caretPos):
        * khtml/rendering/render_flow.h:
        (khtml::RenderFlow::RenderFlow):
        * khtml/rendering/render_frames.cpp:
        (RenderFrameSet::RenderFrameSet):
        (RenderFrameSet::nodeAtPoint):
        (RenderFrameSet::dump):
        * khtml/rendering/render_frames.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::addChildToFlow):
        * khtml/rendering/render_replaced.cpp:
        * khtml/rendering/render_replaced.h:
        (khtml::RenderReplaced::setIntrinsicHeight):
        * khtml/rendering/render_table.cpp:
        (RenderTableSection::RenderTableSection):
        (RenderTableSection::detach):
        (RenderTableSection::setStyle):
        * khtml/rendering/render_table.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_block.cpp
WebCore/khtml/rendering/render_box.cpp
WebCore/khtml/rendering/render_box.h
WebCore/khtml/rendering/render_container.cpp
WebCore/khtml/rendering/render_container.h
WebCore/khtml/rendering/render_flow.cpp
WebCore/khtml/rendering/render_flow.h
WebCore/khtml/rendering/render_frames.cpp
WebCore/khtml/rendering/render_frames.h
WebCore/khtml/rendering/render_inline.cpp
WebCore/khtml/rendering/render_replaced.cpp
WebCore/khtml/rendering/render_replaced.h
WebCore/khtml/rendering/render_table.cpp
WebCore/khtml/rendering/render_table.h

index acafb6c7adaee15e893c68d4c08ad8a2e498f69b..aaa212d3d7ec727a431647f88e850116cb8209cd 100644 (file)
@@ -1,3 +1,46 @@
+2004-09-02  David Hyatt  <hyatt@apple.com>
+
+       Swap RenderBox and RenderContainer.  Make leaf RenderObjects actually derive off of RenderBox instead.
+       
+        Reviewed by kocienda
+
+        * khtml/rendering/render_block.cpp:
+        (khtml::RenderBlock::addChildToFlow):
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::RenderBox):
+        (RenderBox::detach):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::RenderContainer):
+        (RenderContainer::detach):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::detach):
+        (RenderFlow::dirtyLineBoxes):
+        (RenderFlow::createInlineBox):
+        (RenderFlow::getAbsoluteRepaintRect):
+        (RenderFlow::lowestPosition):
+        (RenderFlow::rightmostPosition):
+        (RenderFlow::leftmostPosition):
+        (RenderFlow::caretPos):
+        * khtml/rendering/render_flow.h:
+        (khtml::RenderFlow::RenderFlow):
+        * khtml/rendering/render_frames.cpp:
+        (RenderFrameSet::RenderFrameSet):
+        (RenderFrameSet::nodeAtPoint):
+        (RenderFrameSet::dump):
+        * khtml/rendering/render_frames.h:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::addChildToFlow):
+        * khtml/rendering/render_replaced.cpp:
+        * khtml/rendering/render_replaced.h:
+        (khtml::RenderReplaced::setIntrinsicHeight):
+        * khtml/rendering/render_table.cpp:
+        (RenderTableSection::RenderTableSection):
+        (RenderTableSection::detach):
+        (RenderTableSection::setStyle):
+        * khtml/rendering/render_table.h:
+
 2004-09-02  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by me
index 5a2326b7441f103101991e1feb4170360fc01ff0..5f01d29eba148a3a4a8c9f34c978edb8f4b95abf 100644 (file)
@@ -163,13 +163,13 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
 
             // no suitable existing anonymous box - create a new one
             RenderBlock* newBox = createAnonymousBlock();
-            RenderBox::addChild(newBox,beforeChild);
+            RenderContainer::addChild(newBox,beforeChild);
             newBox->addChild(newChild);
             return;
         }
     }
 
-    RenderBox::addChild(newChild,beforeChild);
+    RenderContainer::addChild(newChild,beforeChild);
     // ### care about aligned stuff
 
     if ( madeBoxesNonInline )
index 35b5d6de3ff0f9dbddf85d9339d845b7acb8b7b7..b9d207c62e112851010209dd5e5489fbcfbfcf64 100644 (file)
@@ -50,7 +50,7 @@ using namespace khtml;
 #define TABLECELLMARGIN -0x4000
 
 RenderBox::RenderBox(DOM::NodeImpl* node)
-    : RenderContainer(node)
+    : RenderObject(node)
 {
     m_minWidth = -1;
     m_maxWidth = -1;
@@ -140,7 +140,7 @@ void RenderBox::detach()
         m_inlineBoxWrapper = 0;
     }
 
-    RenderContainer::detach();
+    RenderObject::detach();
     
     if (layer)
         layer->detach(arena);
index 79c7cb9dd853cc0427ed60fa65f02a11b72adc72..3529bfbdbc7e2b484cd019442796a4e3b180bf63 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef RENDER_BOX_H
 #define RENDER_BOX_H
 
-#include "render_container.h"
+#include "render_object.h"
 #include "misc/loader.h"
 #include "render_layer.h"
 
@@ -34,7 +34,7 @@ namespace khtml {
     enum WidthType { Width, MinWidth, MaxWidth };
     enum HeightType { Height, MinHeight, MaxHeight };
     
-class RenderBox : public RenderContainer
+class RenderBox : public RenderObject
 {
 
 
index a0d554e2499b73c1f6e7485d8f10d88d9f2d4ac4..d41a2e5a70564482896ce974915e332e98af4933 100644 (file)
@@ -45,7 +45,7 @@ using DOM::Position;
 using namespace khtml;
 
 RenderContainer::RenderContainer(DOM::NodeImpl* node)
-    : RenderObject(node)
+    : RenderBox(node)
 {
     m_first = 0;
     m_last = 0;
@@ -72,7 +72,7 @@ void RenderContainer::detach()
     m_first = 0;
     m_last = 0;
 
-    RenderObject::detach();
+    RenderBox::detach();
 }
 
 bool RenderContainer::canHaveChildren() const
index cb999a73fc74d28654c1f9273aef519fe8871fcb..568eb56ac7ed0ee4b7e8444d1c7068bde7c18882 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef render_container_h
 #define render_container_h
 
-#include "render_object.h"
+#include "render_box.h"
 
 namespace DOM {
     class Position;
@@ -35,7 +35,7 @@ namespace khtml
 /**
  * Base class for rendering objects that can have children
  */
-class RenderContainer : public RenderObject
+class RenderContainer : public RenderBox
 {
 public:
     RenderContainer(DOM::NodeImpl* node);
index b1de92986b1ef10dbaa2b178b86025592a10ff6d..1703322c314d115c432d78b8e1a0f0a22598841d 100644 (file)
@@ -194,7 +194,7 @@ void RenderFlow::detach()
     }
 
     deleteLineBoxes();
-    RenderBox::detach();
+    RenderContainer::detach();
 }
 
 void RenderFlow::dirtyLinesFromChangedChild(RenderObject* child, bool adding)
@@ -280,7 +280,7 @@ short RenderFlow::lineHeight(bool firstLine, bool isRootLineBox) const
 void RenderFlow::dirtyLineBoxes(bool fullLayout, bool isRootLineBox)
 {
     if (!isRootLineBox && isReplaced())
-        return RenderBox::dirtyLineBoxes(isRootLineBox);
+        return RenderContainer::dirtyLineBoxes(isRootLineBox);
     
     if (fullLayout)
         deleteLineBoxes();
@@ -294,7 +294,7 @@ InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox, bool isRootLineB
 {
     if (!isRootLineBox &&
        (isReplaced() || makePlaceHolderBox))                     // Inline tables and inline blocks
-        return RenderBox::createInlineBox(false, isRootLineBox);  // (or positioned element placeholders).
+        return RenderContainer::createInlineBox(false, isRootLineBox);  // (or positioned element placeholders).
 
     InlineFlowBox* flowBox = 0;
     if (isInlineFlow())
@@ -419,13 +419,13 @@ QRect RenderFlow::getAbsoluteRepaintRect()
         }
     }
 
-    return RenderBox::getAbsoluteRepaintRect();
+    return RenderContainer::getAbsoluteRepaintRect();
 }
 
 int
 RenderFlow::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
 {
-    int bottom = RenderBox::lowestPosition(includeOverflowInterior, includeSelf);
+    int bottom = RenderContainer::lowestPosition(includeOverflowInterior, includeSelf);
     if (!includeOverflowInterior && hasOverflowClip())
         return bottom;
 
@@ -445,7 +445,7 @@ RenderFlow::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
 
 int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
 {
-    int right = RenderBox::rightmostPosition(includeOverflowInterior, includeSelf);
+    int right = RenderContainer::rightmostPosition(includeOverflowInterior, includeSelf);
     if (!includeOverflowInterior && hasOverflowClip())
         return right;
 
@@ -465,7 +465,7 @@ int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf
 
 int RenderFlow::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
 {
-    int left = RenderBox::leftmostPosition(includeOverflowInterior, includeSelf);
+    int left = RenderContainer::leftmostPosition(includeOverflowInterior, includeSelf);
     if (!includeOverflowInterior && hasOverflowClip())
         return left;
     
@@ -487,7 +487,7 @@ void RenderFlow::caretPos(int offset, bool override, int &_x, int &_y, int &widt
 {
     if (firstChild() || style()->display() == INLINE) {
         // Do the normal calculation
-        RenderBox::caretPos(offset, override, _x, _y, width, height);
+        RenderContainer::caretPos(offset, override, _x, _y, width, height);
         return;
     }
 
index 7d0ec4b010da9d2c2d5cbb96e67e56e75b7a7875..cb0f83f09a75c4e0a552e528b0d2560abbf3eea9 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef RENDER_FLOW_H
 #define RENDER_FLOW_H
 
-#include "render_box.h"
+#include "render_container.h"
 #include "bidi.h"
 #include "render_line.h"
 
@@ -39,11 +39,11 @@ namespace khtml {
  * behaviour of text, so putting the layouting routines in the inline
  * elements is impossible.
  */
-class RenderFlow : public RenderBox
+class RenderFlow : public RenderContainer
 {
 public:
     RenderFlow(DOM::NodeImpl* node)
-      : RenderBox(node), m_lineHeight(-1)
+      : RenderContainer(node), m_lineHeight(-1)
     { m_continuation = 0; m_firstLineBox = 0; m_lastLineBox = 0;}
 
     virtual RenderFlow* continuation() const { return m_continuation; }
index 39226d0e5fe70fab01980525ee23cb3ef9524d08..a5c8a7fbdd67c2e4c7887b7fb4ca3be3bf2bd976 100644 (file)
@@ -53,7 +53,7 @@ using namespace khtml;
 using namespace DOM;
 
 RenderFrameSet::RenderFrameSet( HTMLFrameSetElementImpl *frameSet)
-    : RenderBox(frameSet)
+    : RenderContainer(frameSet)
 {
   // init RenderObject attributes
     setInline(false);
@@ -88,7 +88,7 @@ RenderFrameSet::~RenderFrameSet()
 bool RenderFrameSet::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
                                  HitTestAction hitTestAction, bool inside)
 {
-    RenderBox::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction, inside);
+    RenderContainer::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction, inside);
 
     inside = m_resizing || canResize(_x, _y);
 
@@ -550,7 +550,7 @@ void RenderFrameSet::dump(QTextStream *stream, QString ind) const
   for (i = 0; i < (uint)element()->totalCols(); i++)
     *stream << " vSplitvar(" << i << ")=" << m_vSplitVar[i];
 
-  RenderBox::dump(stream,ind);
+  RenderContainer::dump(stream,ind);
 }
 #endif
 
index 6b9e3a741f58616681d9c071df182833d52d8223..57eefd4f8cdf5883525d451efe756b1f6d80223b 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef __render_frames_h__
 #define __render_frames_h__
 
+#include "render_container.h"
 #include "rendering/render_replaced.h"
 #include "xml/dom_nodeimpl.h"
 #include "html/html_baseimpl.h"
@@ -39,7 +40,7 @@ namespace khtml
 {
   struct ChildFrame;
 
-class RenderFrameSet : public RenderBox
+class RenderFrameSet : public RenderContainer
 {
   friend class DOM::HTMLFrameSetElementImpl;
 public:
@@ -88,7 +89,7 @@ private:
     bool m_clientresizing;
 };
 
-class RenderPart : public khtml::RenderWidget
+class RenderPart : public RenderWidget
 {
     Q_OBJECT
 public:
@@ -125,7 +126,7 @@ public slots:
     virtual void slotViewCleared();
 };
 
-class RenderFrame : public khtml::RenderPart
+class RenderFrame : public RenderPart
 {
     Q_OBJECT
 public:
@@ -141,7 +142,7 @@ public slots:
 };
 
 // I can hardly call the class RenderObject ;-)
-class RenderPartObject : public khtml::RenderPart
+class RenderPartObject : public RenderPart
 {
     Q_OBJECT
 public:
index 5db68d890bbc07d30cc0912e3ee374724d36cdd0..d56ff7a3a5486408091604d199a917783a81814b 100644 (file)
@@ -107,7 +107,7 @@ void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeCh
         return;
     }
 
-    RenderBox::addChild(newChild,beforeChild);
+    RenderContainer::addChild(newChild,beforeChild);
 
     newChild->setNeedsLayoutAndMinMaxRecalc();
 }
index 39a444e76a89d084ec0b51f5ad0f44f39f3c7471..e532988b09192bb7881705debc8d6de0011ecda3 100644 (file)
@@ -108,12 +108,6 @@ short RenderReplaced::baselinePosition( bool, bool ) const
     return height()+marginTop()+marginBottom();
 }
 
-bool RenderReplaced::canHaveChildren() const
-{
-    // We should not really be a RenderContainer subclass.
-    return false;
-}
-
 long RenderReplaced::caretMinOffset() const 
 { 
     return 0; 
index 122149826cdb29adc153bd0753dddf26af0c00ab..834a2a2f298fc14f954fb2c787d3af8d247aeba1 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef render_replaced_h
 #define render_replaced_h
 
-#include "render_box.h"
+#include "render_container.h"
 #include <qobject.h>
 class KHTMLView;
 class QWidget;
@@ -54,8 +54,6 @@ public:
     void setIntrinsicWidth(int w) {  m_intrinsicWidth = w; }
     void setIntrinsicHeight(int h) { m_intrinsicHeight = h; }
 
-    virtual bool canHaveChildren() const;
-
     virtual long caretMinOffset() const;
     virtual long caretMaxOffset() const;
     virtual unsigned long caretMaxRenderedOffset() const;
index eea4b6f283aebc3295ce83139f94f1bb3d5734d5..c354ec4c3eec6108a610b69dc250c15ecab7ad94 100644 (file)
@@ -811,7 +811,7 @@ void RenderTable::dump(QTextStream *stream, QString ind) const
 // --------------------------------------------------------------------------
 
 RenderTableSection::RenderTableSection(DOM::NodeImpl* node)
-    : RenderBox(node)
+    : RenderContainer(node)
 {
     // init RenderObject attributes
     setInline(false);   // our object is not Inline
@@ -833,7 +833,7 @@ void RenderTableSection::detach()
     if (table())
         table()->setNeedSectionRecalc();
 
-    RenderBox::detach();
+    RenderContainer::detach();
 }
 
 void RenderTableSection::setStyle(RenderStyle* _style)
@@ -844,7 +844,7 @@ void RenderTableSection::setStyle(RenderStyle* _style)
     else if (_style->display() != TABLE_FOOTER_GROUP && _style->display() != TABLE_HEADER_GROUP)
         _style->setDisplay(TABLE_ROW_GROUP);
 
-    RenderBox::setStyle(_style);
+    RenderContainer::setStyle(_style);
 }
 
 void RenderTableSection::addChild(RenderObject *child, RenderObject *beforeChild)
index bda6e61f8cc9983bdef126e93abfd26fe970c9f2..53c343383e448d07567d20fa92efd3cf0e135dab 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <qcolor.h>
 
-#include "render_box.h"
 #include "render_block.h"
 #include "render_style.h"
 #include "misc/khtmllayout.h"
@@ -203,7 +202,7 @@ protected:
 
 // -------------------------------------------------------------------------
 
-class RenderTableSection : public RenderBox
+class RenderTableSection : public RenderContainer
 {
 public:
     RenderTableSection(DOM::NodeImpl* node);