Commit 02dc7346 authored by akling@apple.com's avatar akling@apple.com

Replace InlineBox::destroy() with regular virtual destruction.

<https://webkit.org/b/123550>

Move logic out of destroy() and its overloads into good ol' virtual
destructors instead.

Reviewed by Anders Carlsson.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent abc6f1a4
2013-10-30 Andreas Kling <akling@apple.com>
Replace InlineBox::destroy() with regular virtual destruction.
<https://webkit.org/b/123550>
Move logic out of destroy() and its overloads into good ol' virtual
destructors instead.
Reviewed by Anders Carlsson.
2013-10-30 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org>
Simplifying MediaStream and MediStreamDescriptor creation
......
......@@ -66,11 +66,6 @@ void InlineBox::removeFromParent()
parent()->removeChild(this);
}
void InlineBox::destroy()
{
delete this;
}
#ifndef NDEBUG
const char* InlineBox::boxName() const
{
......@@ -170,7 +165,7 @@ void InlineBox::deleteLine()
else if (renderer().isLineBreak())
toRenderLineBreak(renderer()).setInlineBoxWrapper(0);
}
destroy();
delete this;
}
void InlineBox::extractLine()
......
......@@ -63,8 +63,6 @@ public:
virtual ~InlineBox();
virtual void destroy();
virtual void deleteLine();
virtual void extractLine();
virtual void attachLine();
......
......@@ -221,7 +221,7 @@ void InlineFlowBox::deleteLine()
#endif
removeLineBoxFromRenderObject();
destroy();
delete this;
}
void InlineFlowBox::removeLineBoxFromRenderObject()
......
......@@ -67,11 +67,10 @@ COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT
typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap;
static InlineTextBoxOverflowMap* gTextBoxesWithOverflow;
void InlineTextBox::destroy()
InlineTextBox::~InlineTextBox()
{
if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow)
gTextBoxesWithOverflow->remove(this);
InlineBox::destroy();
}
void InlineTextBox::markDirty(bool dirty)
......@@ -245,7 +244,7 @@ LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const
void InlineTextBox::deleteLine()
{
renderer().removeTextBox(*this);
destroy();
delete this;
}
void InlineTextBox::extractLine()
......
......@@ -54,11 +54,11 @@ public:
setBehavesLikeText(true);
}
virtual ~InlineTextBox();
RenderText& renderer() const { return toRenderText(InlineBox::renderer()); }
const RenderStyle& lineStyle() const { return isFirstLine() ? renderer().firstLineStyle() : renderer().style(); }
virtual void destroy() OVERRIDE FINAL;
InlineTextBox* prevTextBox() const { return m_prevTextBox; }
InlineTextBox* nextTextBox() const { return m_nextTextBox; }
void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
......
......@@ -113,8 +113,7 @@ void RenderBlockFlow::willBeDestroyed()
// Mark as being destroyed to avoid trouble with merges in removeChild().
m_beingDestroyed = true;
if (lineGridBox())
lineGridBox()->destroy();
delete lineGridBox();
if (renderNamedFlowFragment())
setRenderNamedFlowFragment(0);
......
......@@ -242,8 +242,7 @@ public:
{
if (!m_rareData)
m_rareData = adoptPtr(new RenderBlockFlowRareData(*this));
if (m_rareData->m_lineGridBox)
m_rareData->m_lineGridBox->destroy();
delete m_rareData->m_lineGridBox;
m_rareData->m_lineGridBox = box;
}
void layoutLineGridBox();
......
......@@ -1949,8 +1949,8 @@ void RenderBox::dirtyLineBoxes(bool fullLayout)
{
if (m_inlineBoxWrapper) {
if (fullLayout) {
m_inlineBoxWrapper->destroy();
m_inlineBoxWrapper = 0;
delete m_inlineBoxWrapper;
m_inlineBoxWrapper = nullptr;
} else
m_inlineBoxWrapper->dirtyLineBoxes();
}
......@@ -1981,7 +1981,7 @@ void RenderBox::positionLineBox(InlineBox* box)
// Nuke the box.
box->removeFromParent();
box->destroy();
delete box;
} else if (isReplaced()) {
setLocation(roundedLayoutPoint(box->topLeft()));
// m_inlineBoxWrapper should already be 0. Deleting it is a safeguard against security issues.
......@@ -1997,8 +1997,8 @@ void RenderBox::deleteLineBoxWrapper()
if (m_inlineBoxWrapper) {
if (!documentBeingDestroyed())
m_inlineBoxWrapper->removeFromParent();
m_inlineBoxWrapper->destroy();
m_inlineBoxWrapper = 0;
delete m_inlineBoxWrapper;
m_inlineBoxWrapper = nullptr;
}
}
......
......@@ -135,7 +135,7 @@ void RenderLineBoxList::deleteLineBoxes()
InlineFlowBox* next;
for (InlineFlowBox* curr = m_firstLineBox; curr; curr = next) {
next = curr->nextLineBox();
curr->destroy();
delete curr;
}
m_firstLineBox = 0;
m_lastLineBox = 0;
......
......@@ -43,8 +43,7 @@ RenderLineBreak::RenderLineBreak(HTMLElement& element, PassRef<RenderStyle> styl
RenderLineBreak::~RenderLineBreak()
{
if (m_inlineBoxWrapper)
m_inlineBoxWrapper->destroy();
delete m_inlineBoxWrapper;
}
LayoutUnit RenderLineBreak::lineHeight(bool firstLine, LineDirectionMode /*direction*/, LinePositionMode /*linePositionMode*/) const
......@@ -91,7 +90,7 @@ void RenderLineBreak::deleteInlineBoxWrapper()
return;
if (!documentBeingDestroyed())
m_inlineBoxWrapper->removeFromParent();
m_inlineBoxWrapper->destroy();
delete m_inlineBoxWrapper;
m_inlineBoxWrapper = nullptr;
}
......@@ -100,7 +99,7 @@ void RenderLineBreak::dirtyLineBoxes(bool fullLayout)
if (!m_inlineBoxWrapper)
return;
if (fullLayout) {
m_inlineBoxWrapper->destroy();
delete m_inlineBoxWrapper;
m_inlineBoxWrapper = nullptr;
return;
}
......
......@@ -1038,7 +1038,7 @@ void RenderText::positionLineBox(InlineBox* box)
// We want the box to be destroyed.
textBox->removeFromParent();
m_lineBoxes.remove(*textBox);
textBox->destroy();
delete textBox;
return;
}
......
......@@ -123,7 +123,7 @@ void RenderTextLineBoxes::deleteAll()
InlineTextBox* next;
for (auto current = m_first; current; current = next) {
next = current->nextTextBox();
current->destroy();
delete current;
}
m_first = nullptr;
m_last = nullptr;
......
......@@ -65,10 +65,9 @@ RootInlineBox::RootInlineBox(RenderBlockFlow& block)
}
void RootInlineBox::destroy()
RootInlineBox::~RootInlineBox()
{
detachEllipsisBox();
InlineFlowBox::destroy();
}
void RootInlineBox::detachEllipsisBox()
......@@ -76,7 +75,7 @@ void RootInlineBox::detachEllipsisBox()
if (hasEllipsisBox()) {
EllipsisBox* box = gEllipsisBoxMap->take(this);
box->setParent(0);
box->destroy();
delete box;
setHasEllipsisBox(false);
}
}
......
......@@ -38,8 +38,7 @@ struct GapRects;
class RootInlineBox : public InlineFlowBox {
public:
explicit RootInlineBox(RenderBlockFlow&);
virtual void destroy() OVERRIDE FINAL;
virtual ~RootInlineBox();
virtual bool isRootInlineBox() const OVERRIDE FINAL { return true; }
RenderBlockFlow& blockFlow() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment