2009-02-07  David Hyatt  <hyatt@apple.com>

        This patch changes the base class of RenderInline from RenderBox to RenderBoxModelObject.  This shift
        in base class knocks 32 bytes off the size of every RenderInline.  All of the necessary functions
        for both RenderInline and RenderBox have either been pulled up into RenderBoxModelObject for sharing
        or split into two functions (one in each derived class).

        Reviewed by Anders and Antti

        * dom/Element.cpp:
        (WebCore::Element::offsetLeft):
        (WebCore::Element::offsetTop):
        (WebCore::Element::offsetWidth):
        (WebCore::Element::offsetHeight):
        (WebCore::Element::offsetParent):
        (WebCore::Element::clientWidth):
        (WebCore::Element::clientHeight):
        (WebCore::Element::scrollWidth):
        (WebCore::Element::scrollHeight):
        * dom/Node.cpp:
        (WebCore::Node::renderBox):
        (WebCore::Node::renderBoxModelObject):
        * dom/Node.h:
        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::isKeyboardFocusable):
        * rendering/InlineBox.h:
        (WebCore::InlineBox::boxModelObject):
        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::marginLeft):
        (WebCore::InlineFlowBox::marginRight):
        (WebCore::InlineFlowBox::placeBoxesHorizontally):
        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
        (WebCore::InlineFlowBox::placeBoxesVertically):
        (WebCore::InlineFlowBox::shrinkBoxesWithNoTextChildren):
        * rendering/InlineFlowBox.h:
        (WebCore::InlineFlowBox::borderLeft):
        (WebCore::InlineFlowBox::borderRight):
        (WebCore::InlineFlowBox::paddingLeft):
        (WebCore::InlineFlowBox::paddingRight):
        * rendering/RenderBlock.cpp:
        (WebCore::getBorderPaddingMargin):
        (WebCore::RenderBlock::calcInlinePrefWidths):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::imageChanged):
        (WebCore::RenderBox::calcReplacedWidthUsing):
        (WebCore::RenderBox::calcReplacedHeightUsing):
        (WebCore::RenderBox::containingBlockWidthForPositioned):
        (WebCore::RenderBox::containingBlockHeightForPositioned):
        (WebCore::RenderBox::calcAbsoluteHorizontal):
        (WebCore::RenderBox::calcAbsoluteHorizontalValues):
        (WebCore::RenderBox::calcAbsoluteVertical):
        (WebCore::RenderBox::calcAbsoluteVerticalValues):
        (WebCore::RenderBox::calcAbsoluteHorizontalReplaced):
        (WebCore::RenderBox::calcAbsoluteVerticalReplaced):
        (WebCore::RenderBox::positionForCoordinates):
        * rendering/RenderBox.h:
        (WebCore::RenderBox::borderBoundingBox):
        (WebCore::RenderBox::offsetHeight):
        (WebCore::RenderBox::marginTop):
        (WebCore::RenderBox::marginBottom):
        (WebCore::RenderBox::marginLeft):
        (WebCore::RenderBox::marginRight):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::offsetLeft):
        (WebCore::RenderBoxModelObject::offsetTop):
        (WebCore::RenderBoxModelObject::paddingTop):
        (WebCore::RenderBoxModelObject::paddingBottom):
        (WebCore::RenderBoxModelObject::paddingLeft):
        (WebCore::RenderBoxModelObject::paddingRight):
        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
        (WebCore::RenderBoxModelObject::calculateBackgroundSize):
        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
        * rendering/RenderBoxModelObject.h:
        (WebCore::RenderBoxModelObject::borderTop):
        (WebCore::RenderBoxModelObject::borderBottom):
        (WebCore::RenderBoxModelObject::borderLeft):
        (WebCore::RenderBoxModelObject::borderRight):
        (WebCore::RenderBoxModelObject::hasHorizontalBordersPaddingOrMargin):
        (WebCore::RenderBoxModelObject::hasHorizontalBordersOrPadding):
        (WebCore::RenderBoxModelObject::childBecameNonInline):
        (WebCore::RenderBoxModelObject::isBoxModelObject):
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::RenderInline):
        (WebCore::RenderInline::destroy):
        (WebCore::RenderInline::styleDidChange):
        (WebCore::nextContinuation):
        (WebCore::RenderInline::continuationBefore):
        (WebCore::RenderInline::addChildIgnoringContinuation):
        (WebCore::RenderInline::splitInlines):
        (WebCore::RenderInline::splitFlow):
        (WebCore::RenderInline::addChildToContinuation):
        (WebCore::RenderInline::absoluteRects):
        (WebCore::RenderInline::offsetLeft):
        (WebCore::RenderInline::offsetTop):
        (WebCore::RenderInline::marginLeft):
        (WebCore::RenderInline::marginRight):
        (WebCore::RenderInline::positionForCoordinates):
        (WebCore::RenderInline::clippedOverflowRectForRepaint):
        (WebCore::RenderInline::rectWithOutlineForRepaint):
        (WebCore::RenderInline::computeRectForRepaint):
        (WebCore::RenderInline::updateDragState):
        (WebCore::RenderInline::childBecameNonInline):
        (WebCore::RenderInline::updateHitTestResult):
        (WebCore::RenderInline::imageChanged):
        (WebCore::RenderInline::addFocusRingRects):
        * rendering/RenderInline.h:
        (WebCore::RenderInline::marginTop):
        (WebCore::RenderInline::marginBottom):
        (WebCore::RenderInline::continuation):
        (WebCore::RenderInline::setContinuation):
        * rendering/RenderLineBoxList.cpp:
        (WebCore::RenderLineBoxList::paint):
        (WebCore::RenderLineBoxList::hitTest):
        * rendering/RenderLineBoxList.h:
        * rendering/RenderObject.cpp:
        (WebCore::addLayers):
        (WebCore::RenderObject::removeLayers):
        (WebCore::RenderObject::moveLayers):
        (WebCore::RenderObject::findNextLayer):
        (WebCore::RenderObject::enclosingLayer):
        (WebCore::RenderObject::enclosingCompositingLayer):
        (WebCore::RenderObject::setLayerNeedsFullRepaint):
        (WebCore::RenderObject::handleDynamicFloatPositionChange):
        (WebCore::RenderObject::destroy):
        (WebCore::RenderObject::offsetParent):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::isInlineContinuation):
        * rendering/RenderSVGTSpan.cpp:
        (WebCore::RenderSVGTSpan::absoluteRects):
        (WebCore::RenderSVGTSpan::absoluteQuads):
        * rendering/RenderSVGTextPath.cpp:
        (WebCore::RenderSVGTextPath::absoluteRects):
        (WebCore::RenderSVGTextPath::absoluteQuads):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::operator<<):
        * rendering/RenderView.cpp:
        (WebCore::RenderView::setBestTruncatedAt):
        * rendering/RenderView.h:
        * rendering/bidi.cpp:
        (WebCore::getBorderPaddingMargin):
        (WebCore::inlineWidth):
        (WebCore::RenderBlock::layoutInlineChildren):
        (WebCore::inlineFlowRequiresLineBox):
        (WebCore::requiresLineBox):
        (WebCore::RenderBlock::findNextLineBreak):
        * wml/WMLAElement.cpp:
        (WebCore::WMLAElement::isKeyboardFocusable):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 985fc28..c177644 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -89,7 +89,7 @@
 static bool isLineEmpty = true;
 static bool previousLineBrokeCleanly = true;
 
-static int getBorderPaddingMargin(RenderBox* child, bool endOfInline)
+static int getBorderPaddingMargin(RenderBoxModelObject* child, bool endOfInline)
 {
     bool leftSide = (child->style()->direction() == LTR) ? !endOfInline : endOfInline;
     if (leftSide)
@@ -102,11 +102,11 @@
     unsigned lineDepth = 1;
     int extraWidth = 0;
     RenderObject* parent = child->parent();
-    while (parent->isBox() && parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
+    while (parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
         if (start && !child->previousSibling())
-            extraWidth += getBorderPaddingMargin(toRenderBox(parent), false);
+            extraWidth += getBorderPaddingMargin(toRenderBoxModelObject(parent), false);
         if (end && !child->nextSibling())
-            extraWidth += getBorderPaddingMargin(toRenderBox(parent), true);
+            extraWidth += getBorderPaddingMargin(toRenderBoxModelObject(parent), true);
         child = parent;
         parent = child->parent();
     }
@@ -796,7 +796,6 @@
         bool endOfInline = false;
         RenderObject* o = bidiFirst(this, 0, false);
         Vector<FloatWithRect> floats;
-        int containerWidth = max(0, containingBlockWidth());
         while (o) {
             o->invalidateVerticalPosition();
             if (o->isReplaced() || o->isFloating() || o->isPositioned()) {
@@ -822,10 +821,6 @@
             } else if (o->isText() || (o->isRenderInline() && !endOfInline)) {
                 if (fullLayout || o->selfNeedsLayout())
                     o->dirtyLineBoxes(fullLayout);
-                
-                // Calculate margins of inline flows so that they can be used later by line layout.
-                if (o->isRenderInline())
-                    toRenderInline(o)->calcMargins(containerWidth);
                 o->setNeedsLayout(false);
             }
             o = bidiNext(this, o, 0, false, &endOfInline);
@@ -1384,12 +1379,12 @@
     return object->style()->preserveNewline();
 }
 
-static bool inlineFlowRequiresLineBox(RenderBox* flow)
+static bool inlineFlowRequiresLineBox(RenderInline* flow)
 {
     // FIXME: Right now, we only allow line boxes for inlines that are truly empty.
     // We need to fix this, though, because at the very least, inlines containing only
     // ignorable whitespace should should also have line boxes. 
-    return flow->isRenderInline() && !flow->firstChild() && flow->hasHorizontalBordersPaddingOrMargin();
+    return !flow->firstChild() && flow->hasHorizontalBordersPaddingOrMargin();
 }
 
 static inline bool requiresLineBox(const InlineIterator& it)
@@ -1397,7 +1392,7 @@
     if (it.obj->isFloatingOrPositioned())
         return false;
 
-    if (it.obj->isRenderInline() && !inlineFlowRequiresLineBox(toRenderBox(it.obj)))
+    if (it.obj->isRenderInline() && !inlineFlowRequiresLineBox(toRenderInline(it.obj)))
         return false;
 
     if (!shouldCollapseWhiteSpace(it.obj->style()) || it.obj->isBR())
@@ -1684,7 +1679,7 @@
             // Right now, we should only encounter empty inlines here.
             ASSERT(!o->firstChild());
     
-            RenderBox* flowBox = toRenderBox(o);
+            RenderInline* flowBox = toRenderInline(o);
             
             // Now that some inline flows have line boxes, if we are already ignoring spaces, we need 
             // to make sure that we stop to include this object and then start ignoring spaces again.