2009-01-28 David Hyatt <hyatt@apple.com>
Move createInlineBox out of RenderFlow and down into RenderInline and RenderBlock.
Reviewed by Beth Dakin
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::createInlineBox):
* rendering/RenderBlock.h:
* rendering/RenderFlow.cpp:
* rendering/RenderFlow.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::createInlineBox):
* rendering/RenderInline.h:
* rendering/bidi.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 2642dd8..5856583 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -346,6 +346,15 @@
m_lineBoxes.deleteLineBoxTree(renderArena());
}
+InlineBox* RenderBlock::createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool /*isOnlyRun*/)
+{
+ if (!isRootLineBox && (isReplaced() || makePlaceHolderBox)) // Inline tables and inline blocks
+ return RenderContainer::createInlineBox(false, isRootLineBox); // (or positioned element placeholders).
+ InlineFlowBox* flowBox = new (renderArena()) RootInlineBox(this);
+ m_lineBoxes.appendLineBox(flowBox);
+ return flowBox;
+}
+
void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
{
// makeChildrenNonInline takes a block whose children are *all* inline and it
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 2aca5bf..4baf87f 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -121,6 +121,8 @@
virtual void borderFitAdjust(int& x, int& w) const; // Shrink the box in which the border paints if border-fit is set.
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
+
// Called to lay out the legend for a fieldset.
virtual RenderObject* layoutLegend(bool /*relayoutChildren*/) { return 0; }
diff --git a/WebCore/rendering/RenderFlow.cpp b/WebCore/rendering/RenderFlow.cpp
index 663f64e..23ad2db2 100644
--- a/WebCore/rendering/RenderFlow.cpp
+++ b/WebCore/rendering/RenderFlow.cpp
@@ -258,23 +258,6 @@
}
}
-InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool /*isOnlyRun*/)
-{
- if (!isRootLineBox &&
- (isReplaced() || makePlaceHolderBox)) // Inline tables and inline blocks
- return RenderContainer::createInlineBox(false, isRootLineBox); // (or positioned element placeholders).
-
- InlineFlowBox* flowBox = 0;
- if (isRenderInline())
- flowBox = new (renderArena()) InlineFlowBox(this);
- else
- flowBox = new (renderArena()) RootInlineBox(this);
-
- m_lineBoxes.appendLineBox(flowBox);
-
- return flowBox;
-}
-
void RenderFlow::paintLines(PaintInfo& paintInfo, int tx, int ty)
{
// Only paint during the foreground/selection phases.
diff --git a/WebCore/rendering/RenderFlow.h b/WebCore/rendering/RenderFlow.h
index 55cf204..4ad3ad4 100644
--- a/WebCore/rendering/RenderFlow.h
+++ b/WebCore/rendering/RenderFlow.h
@@ -62,7 +62,6 @@
InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); }
InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); }
- virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
void paintLines(PaintInfo&, int tx, int ty);
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index c874276..eab4ae5 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -527,6 +527,13 @@
}
}
+InlineBox* RenderInline::createInlineBox(bool, bool, bool)
+{
+ InlineFlowBox* flowBox = new (renderArena()) InlineFlowBox(this);
+ m_lineBoxes.appendLineBox(flowBox);
+ return flowBox;
+}
+
int RenderInline::lineHeight(bool firstLine, bool /*isRootLineBox*/) const
{
if (firstLine && document()->usesFirstLineRules()) {
diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h
index 47e03d2..106e7e8 100644
--- a/WebCore/rendering/RenderInline.h
+++ b/WebCore/rendering/RenderInline.h
@@ -77,6 +77,8 @@
return IntRect(0, 0, boundingBox.width(), boundingBox.height());
}
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
+
virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
RenderBox* continuation() const { return m_continuation; }
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index b9e621c..c57eb7c 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -29,6 +29,7 @@
#include "InlineTextBox.h"
#include "Logging.h"
#include "RenderArena.h"
+#include "RenderInline.h"
#include "RenderLayer.h"
#include "RenderListMarker.h"
#include "RenderView.h"