Commit 445c34f5 authored by darin@apple.com's avatar darin@apple.com
Browse files

WebCore:

2009-07-30  Darin Adler  <darin@apple.com>

        Reviewed by David Levin.

        Use checked casts for render tree
        https://bugs.webkit.org/show_bug.cgi?id=23522

        Next step: Add casts for all the RenderTable classes and use them everywhere.

        Also added a few uses in places that were still using static_cast.
        Also made some virtual member functions private.
        Also changed RenderTable::m_tableLayout to use OwnPtr.

        * accessibility/AccessibilityTable.cpp:
        (WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
        (WebCore::AccessibilityTable::addChildren):
        (WebCore::AccessibilityTable::cellForColumnAndRow):
        * accessibility/AccessibilityTableCell.cpp:
        (WebCore::AccessibilityTableCell::parentTable):
        (WebCore::AccessibilityTableCell::rowIndexRange):
        (WebCore::AccessibilityTableCell::columnIndexRange):
        (WebCore::AccessibilityTableCell::titleUIElement):
        * accessibility/AccessibilityTableColumn.cpp:
        (WebCore::AccessibilityTableColumn::headerObject):
        * accessibility/AccessibilityTableRow.cpp:
        (WebCore::AccessibilityTableRow::parentTable):
        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::removeNode):
        * editing/TextIterator.cpp:
        (WebCore::shouldEmitTabBeforeNode):
        (WebCore::shouldEmitNewlinesBeforeAndAfterNode):
        * html/HTMLTableCellElement.cpp:
        (WebCore::HTMLTableCellElement::parseMappedAttribute):
        * html/HTMLTableColElement.cpp:
        (WebCore::HTMLTableColElement::parseMappedAttribute):
        * page/Frame.cpp:
        (WebCore::Frame::searchForLabelsAboveCell):
        * page/mac/FrameMac.mm:
        (WebCore::Frame::searchForNSLabelsAboveCell):
        * rendering/AutoTableLayout.cpp:
        (WebCore::AutoTableLayout::recalcColumn):
        (WebCore::AutoTableLayout::fullRecalc):
        (WebCore::shouldScaleColumns):
        * rendering/FixedTableLayout.cpp:
        (WebCore::FixedTableLayout::calcWidthArray):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::calcPrefWidths):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calcPercentageHeight):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::addChild):
        (WebCore::RenderObject::containingBlock):
        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::collapsedBottomBorder):
        * rendering/RenderTableCol.cpp:
        (WebCore::RenderTableCol::table):
        * rendering/RenderTableRow.cpp:
        (WebCore::RenderTableRow::addChild):
        (WebCore::RenderTableRow::layout):
        (WebCore::RenderTableRow::paint):
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::addChild):
        (WebCore::RenderTableSection::layoutRows):
        (WebCore::RenderTableSection::lowestPosition):
        (WebCore::RenderTableSection::rightmostPosition):
        (WebCore::RenderTableSection::leftmostPosition):
        (WebCore::RenderTableSection::paintObject):
        (WebCore::RenderTableSection::recalcCells):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::operator<<):
        (WebCore::writeTextRun):
        Use checked casts.

        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::styleDidChange): Updated to use OwnPtr.
        (WebCore::RenderTable::addChild): Use checked cast.
        (WebCore::RenderTable::layout): Ditto.
        (WebCore::RenderTable::setCellWidths): Ditto.
        (WebCore::RenderTable::paintObject): Ditto.
        (WebCore::RenderTable::splitColumn): Ditto.
        (WebCore::RenderTable::appendColumn): Ditto.
        (WebCore::RenderTable::colElement): Ditto.
        (WebCore::RenderTable::recalcSections): Ditto.
        (WebCore::RenderTable::outerBorderBottom): Ditto.
        (WebCore::RenderTable::outerBorderLeft): Ditto.
        (WebCore::RenderTable::outerBorderRight): Ditto.
        (WebCore::RenderTable::sectionAbove): Ditto.
        (WebCore::RenderTable::sectionBelow): Ditto.

        * rendering/RenderTable.h: Added checked cast. Made virtual
        functions private. Changed m_tableLayout to be a OwnPtr.

        * rendering/RenderTableCell.h: Added checked cast.
        * rendering/RenderTableCol.h: Ditto. Made virtual functions private.
        * rendering/RenderTableRow.h: Ditto.
        * rendering/RenderTableSection.h: Ditto.

WebKit/mac:

2009-07-30  Darin Adler  <darin@apple.com>

        Reviewed by David Levin.

        Use checked casts for render tree
        https://bugs.webkit.org/show_bug.cgi?id=23522

        * Misc/WebNSAttributedStringExtras.mm:
        (fileWrapperForElement):
        * Misc/WebNSPasteboardExtras.mm:
        (imageFromElement):
        (-[NSPasteboard _web_declareAndWriteDragImageForElement:URL:title:archive:source:]):
        * WebView/WebFrame.mm:
        (-[WebFrame _computePageRectsWithPrintWidthScaleFactor:printHeight:]):
        (-[WebFrame _accessibilityTree]):
        * WebView/WebRenderNode.mm:
        (copyRenderNode):
        Use checked casts.

WebKit/win:

2009-07-30  Darin Adler  <darin@apple.com>

        Reviewed by David Levin.

        Use checked casts for render tree
        https://bugs.webkit.org/show_bug.cgi?id=23522

        * DOMHTMLClasses.cpp:
        (DOMHTMLInputElement::isUserEdited):
        (DOMHTMLTextAreaElement::isUserEdited):
        Use checked casts.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1f9b6b3d
2009-07-30 Darin Adler <darin@apple.com>
Reviewed by David Levin.
Use checked casts for render tree
https://bugs.webkit.org/show_bug.cgi?id=23522
Next step: Add casts for all the RenderTable classes and use them everywhere.
Also added a few uses in places that were still using static_cast.
Also made some virtual member functions private.
Also changed RenderTable::m_tableLayout to use OwnPtr.
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
(WebCore::AccessibilityTable::addChildren):
(WebCore::AccessibilityTable::cellForColumnAndRow):
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::parentTable):
(WebCore::AccessibilityTableCell::rowIndexRange):
(WebCore::AccessibilityTableCell::columnIndexRange):
(WebCore::AccessibilityTableCell::titleUIElement):
* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::headerObject):
* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::parentTable):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode):
* editing/TextIterator.cpp:
(WebCore::shouldEmitTabBeforeNode):
(WebCore::shouldEmitNewlinesBeforeAndAfterNode):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::parseMappedAttribute):
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::parseMappedAttribute):
* page/Frame.cpp:
(WebCore::Frame::searchForLabelsAboveCell):
* page/mac/FrameMac.mm:
(WebCore::Frame::searchForNSLabelsAboveCell):
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::fullRecalc):
(WebCore::shouldScaleColumns):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::calcPrefWidths):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::calcPercentageHeight):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::addChild):
(WebCore::RenderObject::containingBlock):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::collapsedBottomBorder):
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::table):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::addChild):
(WebCore::RenderTableRow::layout):
(WebCore::RenderTableRow::paint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addChild):
(WebCore::RenderTableSection::layoutRows):
(WebCore::RenderTableSection::lowestPosition):
(WebCore::RenderTableSection::rightmostPosition):
(WebCore::RenderTableSection::leftmostPosition):
(WebCore::RenderTableSection::paintObject):
(WebCore::RenderTableSection::recalcCells):
* rendering/RenderTreeAsText.cpp:
(WebCore::operator<<):
(WebCore::writeTextRun):
Use checked casts.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::styleDidChange): Updated to use OwnPtr.
(WebCore::RenderTable::addChild): Use checked cast.
(WebCore::RenderTable::layout): Ditto.
(WebCore::RenderTable::setCellWidths): Ditto.
(WebCore::RenderTable::paintObject): Ditto.
(WebCore::RenderTable::splitColumn): Ditto.
(WebCore::RenderTable::appendColumn): Ditto.
(WebCore::RenderTable::colElement): Ditto.
(WebCore::RenderTable::recalcSections): Ditto.
(WebCore::RenderTable::outerBorderBottom): Ditto.
(WebCore::RenderTable::outerBorderLeft): Ditto.
(WebCore::RenderTable::outerBorderRight): Ditto.
(WebCore::RenderTable::sectionAbove): Ditto.
(WebCore::RenderTable::sectionBelow): Ditto.
* rendering/RenderTable.h: Added checked cast. Made virtual
functions private. Changed m_tableLayout to be a OwnPtr.
* rendering/RenderTableCell.h: Added checked cast.
* rendering/RenderTableCol.h: Ditto. Made virtual functions private.
* rendering/RenderTableRow.h: Ditto.
* rendering/RenderTableSection.h: Ditto.
2009-07-31 Brady Eidson <beidson@apple.com>
 
Reviewed by John Sullivan.
......
......@@ -84,7 +84,7 @@ bool AccessibilityTable::isTableExposableThroughAccessibility()
if (ariaRole != UnknownRole)
return false;
RenderTable* table = static_cast<RenderTable*>(m_renderer);
RenderTable* table = toRenderTable(m_renderer);
// this employs a heuristic to determine if this table should appear.
// Only "data" tables should be exposed as tables.
......@@ -212,7 +212,7 @@ void AccessibilityTable::addChildren()
if (!m_renderer || !m_renderer->isTable())
return;
RenderTable* table = static_cast<RenderTable*>(m_renderer);
RenderTable* table = toRenderTable(m_renderer);
AXObjectCache* axCache = m_renderer->document()->axObjectCache();
// go through all the available sections to pull out the rows
......@@ -374,7 +374,7 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
if (!hasChildren())
addChildren();
RenderTable* table = static_cast<RenderTable*>(m_renderer);
RenderTable* table = toRenderTable(m_renderer);
RenderTableSection* tableSection = table->header();
if (!tableSection)
tableSection = table->firstBody();
......
......@@ -67,7 +67,7 @@ AccessibilityObject* AccessibilityTableCell::parentTable() const
if (!m_renderer || !m_renderer->isTableCell())
return false;
return axObjectCache()->getOrCreate(static_cast<RenderTableCell*>(m_renderer)->table());
return axObjectCache()->getOrCreate(toRenderTableCell(m_renderer)->table());
}
bool AccessibilityTableCell::isTableCell() const
......@@ -92,7 +92,7 @@ void AccessibilityTableCell::rowIndexRange(pair<int, int>& rowRange)
if (!m_renderer || !m_renderer->isTableCell())
return;
RenderTableCell* renderCell = static_cast<RenderTableCell*>(m_renderer);
RenderTableCell* renderCell = toRenderTableCell(m_renderer);
rowRange.first = renderCell->row();
rowRange.second = renderCell->rowSpan();
......@@ -122,7 +122,7 @@ void AccessibilityTableCell::columnIndexRange(pair<int, int>& columnRange)
if (!m_renderer || !m_renderer->isTableCell())
return;
RenderTableCell* renderCell = static_cast<RenderTableCell*>(m_renderer);
RenderTableCell* renderCell = toRenderTableCell(m_renderer);
columnRange.first = renderCell->col();
columnRange.second = renderCell->colSpan();
}
......@@ -141,7 +141,7 @@ AccessibilityObject* AccessibilityTableCell::titleUIElement() const
if (node && node->hasTagName(thTag))
return 0;
RenderTableCell* renderCell = static_cast<RenderTableCell*>(m_renderer);
RenderTableCell* renderCell = toRenderTableCell(m_renderer);
// If this cell is in the first column, there is no need to continue.
int col = renderCell->col();
......
......@@ -105,7 +105,7 @@ AccessibilityObject* AccessibilityTableColumn::headerObject()
if (!renderer->isTable())
return 0;
RenderTable* table = static_cast<RenderTable*>(renderer);
RenderTable* table = toRenderTable(renderer);
AccessibilityObject* headerObject = 0;
......
......@@ -87,7 +87,7 @@ AccessibilityObject* AccessibilityTableRow::parentTable() const
if (!m_renderer || !m_renderer->isTableRow())
return 0;
return axObjectCache()->getOrCreate(static_cast<RenderTableRow*>(m_renderer)->table());
return axObjectCache()->getOrCreate(toRenderTableRow(m_renderer)->table());
}
AccessibilityObject* AccessibilityTableRow::headerObject()
......
......@@ -364,7 +364,7 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
// make sure empty cell has some height
updateLayout();
RenderObject *r = node->renderer();
if (r && r->isTableCell() && static_cast<RenderTableCell*>(r)->contentHeight() <= 0)
if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0)
insertBlockPlaceholder(Position(node, 0));
return;
}
......
......@@ -599,7 +599,7 @@ static bool shouldEmitTabBeforeNode(Node* node)
return false;
// Want a tab before every cell other than the first one
RenderTableCell* rc = static_cast<RenderTableCell*>(r);
RenderTableCell* rc = toRenderTableCell(r);
RenderTable* t = rc->table();
return t && (t->cellBefore(rc) || t->cellAbove(rc));
}
......@@ -649,7 +649,7 @@ static bool shouldEmitNewlinesBeforeAndAfterNode(Node* node)
// Need to make an exception for table row elements, because they are neither
// "inline" or "RenderBlock", but we want newlines for them.
if (r->isTableRow()) {
RenderTable* t = static_cast<RenderTableRow*>(r)->table();
RenderTable* t = toRenderTableRow(r)->table();
if (t && !t->isInline())
return true;
}
......
......@@ -92,12 +92,12 @@ void HTMLTableCellElement::parseMappedAttribute(MappedAttribute *attr)
rSpan = !attr->isNull() ? attr->value().toInt() : 1;
rSpan = max(1, min(rSpan, maxRowspan));
if (renderer() && renderer()->isTableCell())
static_cast<RenderTableCell*>(renderer())->updateFromElement();
toRenderTableCell(renderer())->updateFromElement();
} else if (attr->name() == colspanAttr) {
cSpan = !attr->isNull() ? attr->value().toInt() : 1;
cSpan = max(1, cSpan);
if (renderer() && renderer()->isTableCell())
static_cast<RenderTableCell*>(renderer())->updateFromElement();
toRenderTableCell(renderer())->updateFromElement();
} else if (attr->name() == nowrapAttr) {
if (!attr->isNull())
addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueWebkitNowrap);
......
......@@ -79,12 +79,12 @@ void HTMLTableColElement::parseMappedAttribute(MappedAttribute *attr)
if (attr->name() == spanAttr) {
_span = !attr->isNull() ? attr->value().toInt() : 1;
if (renderer() && renderer()->isTableCol())
static_cast<RenderTableCol*>(renderer())->updateFromElement();
renderer()->updateFromElement();
} else if (attr->name() == widthAttr) {
if (!attr->value().isEmpty()) {
addCSSLength(attr, CSSPropertyWidth, attr->value());
if (renderer() && renderer()->isTableCol()) {
RenderTableCol* col = static_cast<RenderTableCol*>(renderer());
RenderTableCol* col = toRenderTableCol(renderer());
int newWidth = width().toInt();
if (newWidth != col->width())
col->setNeedsLayoutAndPrefWidthsRecalc();
......
......@@ -387,10 +387,11 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
{
RenderTableCell* cellRenderer = static_cast<RenderTableCell*>(cell->renderer());
RenderObject* cellRenderer = cell->renderer();
if (cellRenderer && cellRenderer->isTableCell()) {
RenderTableCell* cellAboveRenderer = cellRenderer->table()->cellAbove(cellRenderer);
RenderTableCell* tableCellRenderer = toRenderTableCell(cellRenderer);
RenderTableCell* cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
if (cellAboveRenderer) {
HTMLTableCellElement* aboveCell =
......
......@@ -147,10 +147,11 @@ static RegularExpression* regExpForLabels(NSArray* labels)
NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
{
RenderTableCell* cellRenderer = static_cast<RenderTableCell*>(cell->renderer());
RenderObject* cellRenderer = cell->renderer();
if (cellRenderer && cellRenderer->isTableCell()) {
RenderTableCell* cellAboveRenderer = cellRenderer->table()->cellAbove(cellRenderer);
RenderTableCell* tableCellRenderer = toRenderTableCell(cellRenderer);
RenderTableCell* cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
if (cellAboveRenderer) {
HTMLTableCellElement* aboveCell =
......
......@@ -60,9 +60,9 @@ void AutoTableLayout::recalcColumn(int effCol)
while (child) {
if (child->isTableCol())
static_cast<RenderTableCol*>(child)->calcPrefWidths();
toRenderTableCol(child)->calcPrefWidths();
else if (child->isTableSection()) {
RenderTableSection* section = static_cast<RenderTableSection*>(child);
RenderTableSection* section = toRenderTableSection(child);
int numRows = section->numRows();
RenderTableCell* last = 0;
for (int i = 0; i < numRows; i++) {
......@@ -169,7 +169,7 @@ void AutoTableLayout::fullRecalc()
int cCol = 0;
while (child) {
if (child->isTableCol()) {
RenderTableCol *col = static_cast<RenderTableCol*>(child);
RenderTableCol *col = toRenderTableCol(child);
int span = col->span();
if (col->firstChild()) {
grpWidth = col->style()->width();
......@@ -227,7 +227,7 @@ static bool shouldScaleColumns(RenderTable* table)
if (tw.isPercent())
scale = false;
else {
RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
RenderTableCell* cell = toRenderTableCell(cb);
if (cell->colSpan() > 1 || cell->table()->style()->width().isAuto())
scale = false;
else
......
......@@ -93,7 +93,7 @@ int FixedTableLayout::calcWidthArray(int)
Length grpWidth;
while (child) {
if (child->isTableCol()) {
RenderTableCol* col = static_cast<RenderTableCol*>(child);
RenderTableCol* col = toRenderTableCol(child);
if (col->firstChild())
grpWidth = col->style()->width();
else {
......@@ -128,7 +128,7 @@ int FixedTableLayout::calcWidthArray(int)
currentEffectiveColumn++;
}
}
static_cast<RenderTableCol*>(child)->calcPrefWidths();
toRenderTableCol(child)->calcPrefWidths();
} else
break;
......@@ -156,7 +156,7 @@ int FixedTableLayout::calcWidthArray(int)
child = firstRow->firstChild();
while (child) {
if (child->isTableCell()) {
RenderTableCell* cell = static_cast<RenderTableCell*>(child);
RenderTableCell* cell = toRenderTableCell(child);
if (cell->prefWidthsDirty())
cell->calcPrefWidths();
......
......@@ -3921,7 +3921,7 @@ void RenderBlock::calcPrefWidths()
}
if (isTableCell()) {
Length w = static_cast<const RenderTableCell*>(this)->styleOrColWidth();
Length w = toRenderTableCell(this)->styleOrColWidth();
if (w.isFixed() && w.value() > 0)
m_maxPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(w.value()));
}
......
......@@ -1499,7 +1499,7 @@ int RenderBox::calcPercentageHeight(const Length& height)
// no size and allow the flexing of the table or the cell to its specified height to cause us
// to grow to fill the space. This could end up being wrong in some cases, but it is
// preferable to the alternative (sizing intrinsically and making the row end up too big).
RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
RenderTableCell* cell = toRenderTableCell(cb);
if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
return 0;
return -1;
......
......@@ -360,16 +360,16 @@ private:
static bool s_hadOverflowClip;
};
inline RenderBox* toRenderBox(RenderObject* o)
inline RenderBox* toRenderBox(RenderObject* object)
{
ASSERT(!o || o->isBox());
return static_cast<RenderBox*>(o);
ASSERT(!object || object->isBox());
return static_cast<RenderBox*>(object);
}
inline const RenderBox* toRenderBox(const RenderObject* o)
inline const RenderBox* toRenderBox(const RenderObject* object)
{
ASSERT(!o || o->isBox());
return static_cast<const RenderBox*>(o);
ASSERT(!object || object->isBox());
return static_cast<const RenderBox*>(object);
}
// This will catch anyone doing an unnecessary cast.
......
......@@ -114,16 +114,16 @@ private:
static bool s_layerWasSelfPainting;
};
inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o)
inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* object)
{
ASSERT(!o || o->isBoxModelObject());
return static_cast<RenderBoxModelObject*>(o);
ASSERT(!object || object->isBoxModelObject());
return static_cast<RenderBoxModelObject*>(object);
}
inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* o)
inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* object)
{
ASSERT(!o || o->isBoxModelObject());
return static_cast<const RenderBoxModelObject*>(o);
ASSERT(!object || object->isBoxModelObject());
return static_cast<const RenderBoxModelObject*>(object);
}
// This will catch anyone doing an unnecessary cast.
......
......@@ -74,16 +74,16 @@ protected:
bool m_default;
};
inline RenderButton* toRenderButton(RenderObject* o)
inline RenderButton* toRenderButton(RenderObject* object)
{
ASSERT(!o || o->isRenderButton());
return static_cast<RenderButton*>(o);
ASSERT(!object || object->isRenderButton());
return static_cast<RenderButton*>(object);
}
inline const RenderButton* toRenderButton(const RenderObject* o)
inline const RenderButton* toRenderButton(const RenderObject* object)
{
ASSERT(!o || o->isRenderButton());
return static_cast<const RenderButton*>(o);
ASSERT(!object || object->isRenderButton());
return static_cast<const RenderButton*>(object);
}
// This will catch anyone doing an unnecessary cast.
......
......@@ -103,16 +103,16 @@ protected:
friend class RenderImageScaleObserver;
};
inline RenderImage* toRenderImage(RenderObject* o)
inline RenderImage* toRenderImage(RenderObject* object)
{
ASSERT(!o || o->isRenderImage());
return static_cast<RenderImage*>(o);
ASSERT(!object || object->isRenderImage());
return static_cast<RenderImage*>(object);
}
inline const RenderImage* toRenderImage(const RenderObject* o)
inline const RenderImage* toRenderImage(const RenderObject* object)
{
ASSERT(!o || o->isRenderImage());
return static_cast<const RenderImage*>(o);
ASSERT(!object || object->isRenderImage());
return static_cast<const RenderImage*>(object);
}
// This will catch anyone doing an unnecessary cast.
......
......@@ -285,7 +285,7 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild)
RenderTable* table;
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : children->lastChild();
if (afterChild && afterChild->isAnonymous() && afterChild->isTable())
table = static_cast<RenderTable*>(afterChild);
table = toRenderTable(afterChild);
else {
table = new (renderArena()) RenderTable(document() /* is anonymous */);
RefPtr<RenderStyle> newStyle = RenderStyle::create();
......@@ -595,7 +595,7 @@ void RenderObject::setLayerNeedsFullRepaint()
RenderBlock* RenderObject::containingBlock() const
{
if (isTableCell()) {
const RenderTableCell* cell = static_cast<const RenderTableCell*>(this);
const RenderTableCell* cell = toRenderTableCell(this);
if (parent() && cell->section())
return cell->table();
return 0;
......
Supports Markdown
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