Diff
Modified: trunk/Source/WebCore/ChangeLog (174652 => 174653)
--- trunk/Source/WebCore/ChangeLog 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/ChangeLog 2014-10-13 18:21:11 UTC (rev 174653)
@@ -1,3 +1,93 @@
+2014-10-13 Chris Dumez <[email protected]>
+
+ Use is<>() / downcast<>() for Table render objects
+ https://bugs.webkit.org/show_bug.cgi?id=137641
+
+ Reviewed by Mihnea Ovidenie.
+
+ Use is<>() / downcast<>() for table-related render objects and clean
+ up the surrounding code.
+
+ No new tests, no behavior change.
+
+ * accessibility/AccessibilityARIAGrid.cpp:
+ (WebCore::AccessibilityARIAGrid::addChildren):
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::tableElement):
+ (WebCore::AccessibilityTable::isDataTable):
+ (WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
+ (WebCore::AccessibilityTable::addChildren):
+ * accessibility/AccessibilityTableCell.cpp:
+ (WebCore::AccessibilityTableCell::parentTable):
+ (WebCore::AccessibilityTableCell::rowIndexRange):
+ (WebCore::AccessibilityTableCell::columnIndexRange):
+ (WebCore::AccessibilityTableCell::titleUIElement):
+ * accessibility/AccessibilityTableColumn.cpp:
+ (WebCore::AccessibilityTableColumn::headerObject):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::removeNode):
+ * editing/TextIterator.cpp:
+ (WebCore::shouldEmitTabBeforeNode):
+ (WebCore::shouldEmitNewlinesBeforeAndAfterNode):
+ * html/HTMLTableCellElement.cpp:
+ (WebCore::HTMLTableCellElement::parseAttribute):
+ (WebCore::HTMLTableCellElement::cellAbove):
+ * html/HTMLTableColElement.cpp:
+ (WebCore::HTMLTableColElement::parseAttribute):
+ * mathml/MathMLElement.cpp:
+ (WebCore::MathMLElement::parseAttribute):
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::recalcColumn):
+ (WebCore::shouldScaleColumns):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computePercentageLogicalHeight):
+ (WebCore::RenderBox::layoutOverflowRectForPropagation):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::addChild):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::addChild):
+ (WebCore::RenderTable::layout):
+ (WebCore::RenderTable::firstColumn):
+ (WebCore::RenderTable::recalcSections):
+ (WebCore::RenderTable::sectionAbove):
+ (WebCore::RenderTable::sectionBelow):
+ (WebCore::RenderTable::bottomSection):
+ * rendering/RenderTable.h:
+ * rendering/RenderTableCaption.cpp:
+ (WebCore::RenderTableCaption::table):
+ * rendering/RenderTableCell.h:
+ (WebCore::RenderTableCell::nextCell):
+ (WebCore::RenderTableCell::previousCell):
+ (WebCore::RenderTableRow::firstCell):
+ (WebCore::RenderTableRow::lastCell):
+ * rendering/RenderTableCol.cpp:
+ (WebCore::RenderTableCol::table):
+ (WebCore::RenderTableCol::enclosingColumnGroup):
+ (WebCore::RenderTableCol::nextColumn):
+ * rendering/RenderTableCol.h:
+ Make updateFromElement() public to allow the callers to use tighter
+ typing and devitualize the call as the class is final.
+
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::addChild):
+ * rendering/RenderTableRow.h:
+ (WebCore::RenderTableSection::firstRow):
+ (WebCore::RenderTableSection::lastRow):
+ (WebCore::RenderTableRow::nextRow):
+ (WebCore::RenderTableRow::previousRow):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::addChild):
+ (WebCore::RenderTableSection::layoutRows):
+ (WebCore::RenderTableSection::paintCell):
+ * rendering/RenderTableSection.h:
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::writeTextRun):
+ (WebCore::writeSimpleLine):
+
2014-10-08 Jer Noble <[email protected]>
MediaPlayer::characteristicChanged() is not called when new tracks are found in SourceBufferPrivateAVFObjC
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp (174652 => 174653)
--- trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -117,12 +117,11 @@
for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {
bool footerSection = false;
if (RenderObject* childRenderer = child->renderer()) {
- if (childRenderer->isTableSection()) {
- if (RenderTableSection* childSection = toRenderTableSection(childRenderer)) {
- if (childSection == childSection->table()->footer()) {
- footerSections.append(child);
- footerSection = true;
- }
+ if (is<RenderTableSection>(*childRenderer)) {
+ RenderTableSection& childSection = downcast<RenderTableSection>(*childRenderer);
+ if (&childSection == childSection.table()->footer()) {
+ footerSections.append(child);
+ footerSection = true;
}
}
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (174652 => 174653)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -92,16 +92,16 @@
HTMLTableElement* AccessibilityTable::tableElement() const
{
- if (!m_renderer->isTable())
+ if (!is<RenderTable>(*m_renderer))
return nullptr;
- RenderTable* table = toRenderTable(m_renderer);
- if (is<HTMLTableElement>(table->element()))
- return downcast<HTMLTableElement>(table->element());
+ RenderTable& table = downcast<RenderTable>(*m_renderer);
+ if (is<HTMLTableElement>(table.element()))
+ return downcast<HTMLTableElement>(table.element());
// If the table has a display:table-row-group, then the RenderTable does not have a pointer to it's HTMLTableElement.
// We can instead find it by asking the firstSection for its parent.
- RenderTableSection* firstBody = table->firstBody();
+ RenderTableSection* firstBody = table.firstBody();
if (!firstBody || !firstBody->element())
return nullptr;
@@ -127,16 +127,14 @@
if (node() && node()->hasEditableStyle())
return true;
- if (!m_renderer->isTable())
+ if (!is<RenderTable>(*m_renderer))
return false;
// This employs a heuristic to determine if this table should appear.
// Only "data" tables should be exposed as tables.
// Unfortunately, there is no good way to determine the difference
// between a "layout" table and a "data" table.
- RenderTable* table = toRenderTable(m_renderer);
- HTMLTableElement* tableElement = this->tableElement();
- if (tableElement) {
+ if (HTMLTableElement* tableElement = this->tableElement()) {
// If there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table.
if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElement->tFoot() || tableElement->caption())
return true;
@@ -146,16 +144,17 @@
return true;
// If there's a colgroup or col element, it's probably a data table.
- for (const auto& child : childrenOfType<Element>(*tableElement)) {
+ for (const auto& child : childrenOfType<HTMLElement>(*tableElement)) {
if (child.hasTagName(colTag) || child.hasTagName(colgroupTag))
return true;
}
}
+ RenderTable& table = downcast<RenderTable>(*m_renderer);
// go through the cell's and check for tell-tale signs of "data" table status
// cells have borders, or use attributes like headers, abbr, scope or axis
- table->recalcSectionsIfNeeded();
- RenderTableSection* firstBody = table->firstBody();
+ table.recalcSectionsIfNeeded();
+ RenderTableSection* firstBody = table.firstBody();
if (!firstBody)
return false;
@@ -171,7 +170,7 @@
return true;
// Store the background color of the table to check against cell's background colors.
- const RenderStyle& tableStyle = table->style();
+ const RenderStyle& tableStyle = table.style();
Color tableBGColor = tableStyle.visitedDependentColor(CSSPropertyBackgroundColor);
// check enough of the cells to find if the table matches our criteria
@@ -206,16 +205,16 @@
if (cell->width() < 1 || cell->height() < 1)
continue;
- validCellCount++;
+ ++validCellCount;
bool isTHCell = cellElement->hasTagName(thTag);
// If the first row is comprised of all <th> tags, assume it is a data table.
if (!row && isTHCell)
- headersInFirstRowCount++;
+ ++headersInFirstRowCount;
// If the first column is comprised of all <th> tags, assume it is a data table.
if (!col && isTHCell)
- headersInFirstColumnCount++;
+ ++headersInFirstColumnCount;
// In this case, the developer explicitly assigned a "data" table attribute.
if (is<HTMLTableCellElement>(*cellElement)) {
@@ -233,25 +232,25 @@
// If a cell has matching bordered sides, call it a (fully) bordered cell.
if ((cell->borderTop() > 0 && cell->borderBottom() > 0)
|| (cell->borderLeft() > 0 && cell->borderRight() > 0))
- borderedCellCount++;
+ ++borderedCellCount;
// Also keep track of each individual border, so we can catch tables where most
// cells have a bottom border, for example.
if (cell->borderTop() > 0)
- cellsWithTopBorder++;
+ ++cellsWithTopBorder;
if (cell->borderBottom() > 0)
- cellsWithBottomBorder++;
+ ++cellsWithBottomBorder;
if (cell->borderLeft() > 0)
- cellsWithLeftBorder++;
+ ++cellsWithLeftBorder;
if (cell->borderRight() > 0)
- cellsWithRightBorder++;
+ ++cellsWithRightBorder;
// If the cell has a different color from the table and there is cell spacing,
// then it is probably a data table cell (spacing and colors take the place of borders).
Color cellColor = renderStyle.visitedDependentColor(CSSPropertyBackgroundColor);
- if (table->hBorderSpacing() > 0 && table->vBorderSpacing() > 0
+ if (table.hBorderSpacing() > 0 && table.vBorderSpacing() > 0
&& tableBGColor != cellColor && cellColor.alpha() != 1)
- backgroundDifferenceCellCount++;
+ ++backgroundDifferenceCellCount;
// If we've found 10 "good" cells, we don't need to keep searching.
if (borderedCellCount >= 10 || backgroundDifferenceCellCount >= 10)
@@ -327,7 +326,7 @@
// Gtk+ ATs expect all tables to be exposed as tables.
#if PLATFORM(GTK) || PLATFORM(EFL)
- Element* tableNode = toRenderTable(m_renderer)->element();
+ Element* tableNode = downcast<RenderTable>(*m_renderer).element();
return is<HTMLTableElement>(tableNode);
#endif
@@ -356,17 +355,17 @@
ASSERT(!m_haveChildren);
m_haveChildren = true;
- if (!m_renderer || !m_renderer->isTable())
+ if (!is<RenderTable>(m_renderer))
return;
- RenderTable* table = toRenderTable(m_renderer);
+ RenderTable& table = downcast<RenderTable>(*m_renderer);
// Go through all the available sections to pull out the rows and add them as children.
- table->recalcSectionsIfNeeded();
+ table.recalcSectionsIfNeeded();
unsigned maxColumnCount = 0;
- RenderTableSection* footer = table->footer();
+ RenderTableSection* footer = table.footer();
- for (RenderTableSection* tableSection = table->topSection(); tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
+ for (RenderTableSection* tableSection = table.topSection(); tableSection; tableSection = table.sectionBelow(tableSection, SkipEmptySections)) {
if (tableSection == footer)
continue;
addChildrenFromSection(tableSection, maxColumnCount);
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (174652 => 174653)
--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -75,7 +75,7 @@
AccessibilityTable* AccessibilityTableCell::parentTable() const
{
- if (!m_renderer || !m_renderer->isTableCell())
+ if (!is<RenderTableCell>(m_renderer))
return nullptr;
// If the document no longer exists, we might not have an axObjectCache.
@@ -87,7 +87,7 @@
// By using only get() implies that the AXTable must be created before AXTableCells. This should
// always be the case when AT clients access a table.
// https://bugs.webkit.org/show_bug.cgi?id=42652
- AccessibilityObject* parentTable = axObjectCache()->get(toRenderTableCell(m_renderer)->table());
+ AccessibilityObject* parentTable = axObjectCache()->get(downcast<RenderTableCell>(*m_renderer).table());
if (!parentTable || !parentTable->isTable())
return nullptr;
return toAccessibilityTable(parentTable);
@@ -224,16 +224,16 @@
void AccessibilityTableCell::rowIndexRange(std::pair<unsigned, unsigned>& rowRange)
{
- if (!m_renderer || !m_renderer->isTableCell())
+ if (!is<RenderTableCell>(m_renderer))
return;
- RenderTableCell* renderCell = toRenderTableCell(m_renderer);
- rowRange.first = renderCell->rowIndex();
- rowRange.second = renderCell->rowSpan();
+ RenderTableCell& renderCell = downcast<RenderTableCell>(*m_renderer);
+ rowRange.first = renderCell.rowIndex();
+ rowRange.second = renderCell.rowSpan();
// since our table might have multiple sections, we have to offset our row appropriately
- RenderTableSection* section = renderCell->section();
- RenderTable* table = renderCell->table();
+ RenderTableSection* section = renderCell.section();
+ RenderTable* table = renderCell.table();
if (!table || !section)
return;
@@ -253,10 +253,10 @@
void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange)
{
- if (!m_renderer || !m_renderer->isTableCell())
+ if (!is<RenderTableCell>(m_renderer))
return;
- const RenderTableCell& cell = *toRenderTableCell(m_renderer);
+ const RenderTableCell& cell = downcast<RenderTableCell>(*m_renderer);
columnRange.first = cell.table()->colToEffCol(cell.col());
columnRange.second = cell.table()->colToEffCol(cell.col() + cell.colSpan()) - columnRange.first;
}
@@ -266,7 +266,7 @@
// Try to find if the first cell in this row is a <th>. If it is,
// then it can act as the title ui element. (This is only in the
// case when the table is not appearing as an AXTable.)
- if (isTableCell() || !m_renderer || !m_renderer->isTableCell())
+ if (isTableCell() || !is<RenderTableCell>(m_renderer))
return nullptr;
// Table cells that are th cannot have title ui elements, since by definition
@@ -275,21 +275,21 @@
if (node && node->hasTagName(thTag))
return nullptr;
- RenderTableCell* renderCell = toRenderTableCell(m_renderer);
+ RenderTableCell& renderCell = downcast<RenderTableCell>(*m_renderer);
// If this cell is in the first column, there is no need to continue.
- int col = renderCell->col();
+ int col = renderCell.col();
if (!col)
return nullptr;
- int row = renderCell->rowIndex();
+ int row = renderCell.rowIndex();
- RenderTableSection* section = renderCell->section();
+ RenderTableSection* section = renderCell.section();
if (!section)
return nullptr;
RenderTableCell* headerCell = section->primaryCellAt(row, 0);
- if (!headerCell || headerCell == renderCell)
+ if (!headerCell || headerCell == &renderCell)
return nullptr;
if (!headerCell->element() || !headerCell->element()->hasTagName(thTag))
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (174652 => 174653)
--- trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -89,23 +89,17 @@
return nullptr;
}
- if (!renderer->isTable())
+ if (!is<RenderTable>(*renderer))
return nullptr;
- RenderTable* table = toRenderTable(renderer);
-
- AccessibilityObject* headerObject = nullptr;
-
- // try the <thead> section first. this doesn't require th tags
- headerObject = headerObjectForSection(table->header(), false);
+ RenderTable& table = downcast<RenderTable>(*renderer);
- if (headerObject)
+ // try the <thead> section first. this doesn't require th tags
+ if (auto* headerObject = headerObjectForSection(table.header(), false))
return headerObject;
// now try for <th> tags in the first body
- headerObject = headerObjectForSection(table->firstBody(), true);
-
- return headerObject;
+ return headerObjectForSection(table.firstBody(), true);
}
AccessibilityObject* AccessibilityTableColumn::headerObjectForSection(RenderTableSection* section, bool thTagRequired)
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (174652 => 174653)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -386,8 +386,8 @@
// Make sure empty cell has some height, if a placeholder can be inserted.
document().updateLayoutIgnorePendingStylesheets();
- RenderObject *r = node->renderer();
- if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
+ RenderObject* renderer = node->renderer();
+ if (is<RenderTableCell>(renderer) && downcast<RenderTableCell>(*renderer).contentHeight() <= 0) {
Position firstEditablePosition = firstEditablePositionInNode(node.get());
if (firstEditablePosition.isNotNull())
insertBlockPlaceholder(firstEditablePosition);
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (174652 => 174653)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -785,7 +785,7 @@
return false;
// Want a tab before every cell other than the first one.
- RenderTableCell& cell = toRenderTableCell(*renderer);
+ RenderTableCell& cell = downcast<RenderTableCell>(*renderer);
RenderTable* table = cell.table();
return table && (table->cellBefore(&cell) || table->cellAbove(&cell));
}
@@ -840,14 +840,14 @@
// Need to make an exception for table row elements, because they are neither
// "inline" or "RenderBlock", but we want newlines for them.
- if (renderer->isTableRow()) {
- RenderTable* table = toRenderTableRow(*renderer).table();
+ if (is<RenderTableRow>(*renderer)) {
+ RenderTable* table = downcast<RenderTableRow>(*renderer).table();
if (table && !table->isInline())
return true;
}
return !renderer->isInline()
- && renderer->isRenderBlock()
+ && is<RenderBlock>(*renderer)
&& !renderer->isFloatingOrOutOfFlowPositioned()
&& !renderer->isBody()
&& !renderer->isRubyText();
Modified: trunk/Source/WebCore/html/HTMLTableCellElement.cpp (174652 => 174653)
--- trunk/Source/WebCore/html/HTMLTableCellElement.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/html/HTMLTableCellElement.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -105,11 +105,11 @@
void HTMLTableCellElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == rowspanAttr) {
- if (renderer() && renderer()->isTableCell())
- toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
+ if (is<RenderTableCell>(renderer()))
+ downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged();
} else if (name == colspanAttr) {
- if (renderer() && renderer()->isTableCell())
- toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
+ if (is<RenderTableCell>(renderer()))
+ downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged();
} else
HTMLTablePartElement::parseAttribute(name, value);
}
@@ -165,12 +165,12 @@
HTMLTableCellElement* HTMLTableCellElement::cellAbove() const
{
- auto cellRenderer = renderer();
- if (!cellRenderer || !cellRenderer->isTableCell())
+ auto* cellRenderer = renderer();
+ if (!is<RenderTableCell>(cellRenderer))
return nullptr;
- auto tableCellRenderer = toRenderTableCell(cellRenderer);
- auto cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
+ auto& tableCellRenderer = downcast<RenderTableCell>(*cellRenderer);
+ auto* cellAboveRenderer = tableCellRenderer.table()->cellAbove(&tableCellRenderer);
if (!cellAboveRenderer)
return nullptr;
Modified: trunk/Source/WebCore/html/HTMLTableColElement.cpp (174652 => 174653)
--- trunk/Source/WebCore/html/HTMLTableColElement.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/html/HTMLTableColElement.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -67,15 +67,15 @@
if (name == spanAttr) {
int newSpan = value.toInt();
m_span = newSpan ? newSpan : 1;
- if (renderer() && renderer()->isRenderTableCol())
- renderer()->updateFromElement();
+ if (is<RenderTableCol>(renderer()))
+ downcast<RenderTableCol>(*renderer()).updateFromElement();
} else if (name == widthAttr) {
if (!value.isEmpty()) {
- if (renderer() && renderer()->isRenderTableCol()) {
- RenderTableCol* col = toRenderTableCol(renderer());
+ if (is<RenderTableCol>(renderer())) {
+ RenderTableCol& col = downcast<RenderTableCol>(*renderer());
int newWidth = width().toInt();
- if (newWidth != col->width())
- col->setNeedsLayoutAndPrefWidthsRecalc();
+ if (newWidth != col.width())
+ col.setNeedsLayoutAndPrefWidthsRecalc();
}
}
} else
Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (174652 => 174653)
--- trunk/Source/WebCore/mathml/MathMLElement.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -212,11 +212,11 @@
void MathMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == rowspanAttr) {
- if (renderer() && renderer()->isTableCell() && hasTagName(mtdTag))
- toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
+ if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag))
+ downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged();
} else if (name == columnspanAttr) {
- if (renderer() && renderer()->isTableCell() && hasTagName(mtdTag))
- toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
+ if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag))
+ downcast<RenderTableCell>(renderer())->colSpanOrRowSpanChanged();
} else
StyledElement::parseAttribute(name, value);
}
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -26,6 +26,7 @@
#include "RenderTableCell.h"
#include "RenderTableCol.h"
#include "RenderTableSection.h"
+#include "RenderView.h"
namespace WebCore {
@@ -44,20 +45,20 @@
{
Layout& columnLayout = m_layoutStruct[effCol];
- RenderTableCell* fixedContributor = 0;
- RenderTableCell* maxContributor = 0;
+ RenderTableCell* fixedContributor = nullptr;
+ RenderTableCell* maxContributor = nullptr;
for (RenderObject* child = m_table->firstChild(); child; child = child->nextSibling()) {
- if (child->isRenderTableCol()){
+ if (is<RenderTableCol>(*child)) {
// RenderTableCols don't have the concept of preferred logical width, but we need to clear their dirty bits
// so that if we call setPreferredWidthsDirty(true) on a col or one of its descendants, we'll mark it's
// ancestors as dirty.
- toRenderTableCol(child)->clearPreferredLogicalWidthsDirtyBits();
- } else if (child->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(child);
- unsigned numRows = section->numRows();
- for (unsigned i = 0; i < numRows; i++) {
- RenderTableSection::CellStruct current = section->cellAt(i, effCol);
+ downcast<RenderTableCol>(*child).clearPreferredLogicalWidthsDirtyBits();
+ } else if (is<RenderTableSection>(*child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(*child);
+ unsigned numRows = section.numRows();
+ for (unsigned i = 0; i < numRows; ++i) {
+ RenderTableSection::CellStruct current = section.cellAt(i, effCol);
RenderTableCell* cell = current.primaryCell();
if (current.inColSpan || !cell)
@@ -120,7 +121,7 @@
default:
break;
}
- } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) {
+ } else if (!effCol || section.primaryCellAt(i, effCol - 1) != cell) {
// This spanning cell originates in this column. Insert the cell into spanning cells list.
insertSpanCell(cell);
}
@@ -132,7 +133,7 @@
if (columnLayout.logicalWidth.isFixed()) {
if (m_table->document().inQuirksMode() && columnLayout.maxLogicalWidth > columnLayout.logicalWidth.value() && fixedContributor != maxContributor) {
columnLayout.logicalWidth = Length();
- fixedContributor = 0;
+ fixedContributor = nullptr;
}
}
@@ -186,25 +187,25 @@
// a cell, then don't bloat the maxwidth by examining percentage growth.
bool scale = true;
while (table) {
- Length tw = table->style().width();
- if ((tw.isAuto() || tw.isPercent()) && !table->isOutOfFlowPositioned()) {
- RenderBlock* cb = table->containingBlock();
- while (cb && !cb->isRenderView() && !cb->isTableCell() &&
- cb->style().width().isAuto() && !cb->isOutOfFlowPositioned())
- cb = cb->containingBlock();
+ Length tableWidth = table->style().width();
+ if ((tableWidth.isAuto() || tableWidth.isPercent()) && !table->isOutOfFlowPositioned()) {
+ RenderBlock* containingBlock = table->containingBlock();
+ while (containingBlock && !is<RenderView>(*containingBlock) && !is<RenderTableCell>(*containingBlock)
+ && containingBlock->style().width().isAuto() && !containingBlock->isOutOfFlowPositioned())
+ containingBlock = containingBlock->containingBlock();
- table = 0;
- if (cb && cb->isTableCell() &&
- (cb->style().width().isAuto() || cb->style().width().isPercent())) {
- RenderTableCell* cell = toRenderTableCell(cb);
- if (cell->colSpan() > 1 || cell->table()->style().width().isAuto())
+ table = nullptr;
+ if (is<RenderTableCell>(containingBlock)
+ && (containingBlock->style().width().isAuto() || containingBlock->style().width().isPercent())) {
+ RenderTableCell& cell = downcast<RenderTableCell>(*containingBlock);
+ if (cell.colSpan() > 1 || cell.table()->style().width().isAuto())
scale = false;
else
- table = cell->table();
+ table = cell.table();
}
}
else
- table = 0;
+ table = nullptr;
}
return scale;
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -368,8 +368,8 @@
minLogicalWidth = 0;
}
- if (isTableCell()) {
- Length tableCellWidth = toRenderTableCell(this)->styleOrColLogicalWidth();
+ if (is<RenderTableCell>(*this)) {
+ Length tableCellWidth = downcast<RenderTableCell>(*this).styleOrColLogicalWidth();
if (tableCellWidth.isFixed() && tableCellWidth.value() > 0)
maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(tableCellWidth.value()));
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -2812,7 +2812,7 @@
else if (hasOverrideContainingBlockLogicalHeight())
availableHeight = overrideContainingBlockContentLogicalHeight();
#endif
- else if (cb->isTableCell()) {
+ else if (is<RenderTableCell>(*cb)) {
if (!skippedAutoHeightContainingBlock) {
// Table cells violate what the CSS spec says to do with heights. Basically we
// don't care if the cell specified a height or not. We just always make ourselves
@@ -2825,8 +2825,8 @@
// 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 = toRenderTableCell(cb);
- if (scrollsOverflowY() && (!cell->style().logicalHeight().isAuto() || !cell->table()->style().logicalHeight().isAuto()))
+ RenderTableCell& cell = downcast<RenderTableCell>(*cb);
+ if (scrollsOverflowY() && (!cell.style().logicalHeight().isAuto() || !cell.table()->style().logicalHeight().isAuto()))
return 0;
return -1;
}
@@ -4740,18 +4740,18 @@
|| style().logicalMaxHeight().isPercent();
}
-static void markBoxForRelayoutAfterSplit(RenderBox* box)
+static void markBoxForRelayoutAfterSplit(RenderBox& box)
{
// FIXME: The table code should handle that automatically. If not,
// we should fix it and remove the table part checks.
- if (box->isTable()) {
+ if (is<RenderTable>(box)) {
// Because we may have added some sections with already computed column structures, we need to
// sync the table structure with them now. This avoids crashes when adding new cells to the table.
- toRenderTable(box)->forceSectionsRecalc();
- } else if (box->isTableSection())
- toRenderTableSection(box)->setNeedsCellRecalc();
+ downcast<RenderTable>(box).forceSectionsRecalc();
+ } else if (is<RenderTableSection>(box))
+ downcast<RenderTableSection>(box).setNeedsCellRecalc();
- box->setNeedsLayoutAndPrefWidthsRecalc();
+ box.setNeedsLayoutAndPrefWidthsRecalc();
}
RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChild)
@@ -4771,12 +4771,12 @@
// We need to invalidate the |parentBox| before inserting the new node
// so that the table repainting logic knows the structure is dirty.
// See for example RenderTableCell:clippedOverflowRectForRepaint.
- markBoxForRelayoutAfterSplit(parentBox);
+ markBoxForRelayoutAfterSplit(*parentBox);
parentBox->insertChildInternal(postBox, boxToSplit->nextSibling(), NotifyChildren);
boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true);
- markBoxForRelayoutAfterSplit(boxToSplit);
- markBoxForRelayoutAfterSplit(postBox);
+ markBoxForRelayoutAfterSplit(*boxToSplit);
+ markBoxForRelayoutAfterSplit(*postBox);
beforeChild = postBox;
} else
@@ -4784,7 +4784,7 @@
}
if (didSplitParentAnonymousBoxes)
- markBoxForRelayoutAfterSplit(this);
+ markBoxForRelayoutAfterSplit(*this);
ASSERT(beforeChild->parent() == this);
return beforeChild;
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -468,24 +468,24 @@
{
bool needsTable = false;
- if (newChild->isRenderTableCol()) {
- RenderTableCol* newTableColumn = toRenderTableCol(newChild);
- bool isColumnInColumnGroup = newTableColumn->isTableColumn() && isRenderTableCol();
- needsTable = !isTable() && !isColumnInColumnGroup;
- } else if (newChild->isTableCaption())
- needsTable = !isTable();
- else if (newChild->isTableSection())
- needsTable = !isTable();
- else if (newChild->isTableRow())
- needsTable = !isTableSection();
- else if (newChild->isTableCell())
- needsTable = !isTableRow();
+ if (is<RenderTableCol>(*newChild)) {
+ RenderTableCol& newTableColumn = downcast<RenderTableCol>(*newChild);
+ bool isColumnInColumnGroup = newTableColumn.isTableColumn() && is<RenderTableCol>(*this);
+ needsTable = !is<RenderTable>(*this) && !isColumnInColumnGroup;
+ } else if (is<RenderTableCaption>(*newChild))
+ needsTable = !is<RenderTable>(*this);
+ else if (is<RenderTableSection>(*newChild))
+ needsTable = !is<RenderTable>(*this);
+ else if (is<RenderTableRow>(*newChild))
+ needsTable = !is<RenderTableSection>(*this);
+ else if (is<RenderTableCell>(*newChild))
+ needsTable = !is<RenderTableRow>(*this);
if (needsTable) {
RenderTable* table;
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : m_lastChild;
- if (afterChild && afterChild->isAnonymous() && afterChild->isTable() && !afterChild->isBeforeContent())
- table = toRenderTable(afterChild);
+ if (afterChild && afterChild->isAnonymous() && is<RenderTable>(*afterChild) && !afterChild->isBeforeContent())
+ table = downcast<RenderTable>(afterChild);
else {
table = RenderTable::createAnonymousWithParentRenderer(this);
addChild(table, beforeChild);
@@ -494,7 +494,7 @@
} else
insertChildInternal(newChild, beforeChild, NotifyChildren);
- if (is<RenderText>(newChild))
+ if (is<RenderText>(*newChild))
downcast<RenderText>(*newChild).styleDidChange(StyleDifferenceEqual, nullptr);
// SVG creates renderers for <g display="none">, as SVG requires children of hidden
@@ -506,7 +506,7 @@
// To avoid the problem alltogether, detect early if we're inside a hidden SVG subtree
// and stop creating layers at all for these cases - they're not used anyways.
if (newChild->hasLayer() && !layerCreationAllowedForSubtree())
- toRenderLayerModelObject(newChild)->layer()->removeOnlyThisLayer();
+ downcast<RenderLayerModelObject>(*newChild).layer()->removeOnlyThisLayer();
SVGRenderSupport::childAdded(*this, *newChild);
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -5622,8 +5622,8 @@
LayoutRect result;
if (renderer().isInline() && renderer().isRenderInline())
result = toRenderInline(renderer()).linesVisualOverflowBoundingBox();
- else if (renderer().isTableRow()) {
- RenderTableRow& tableRow = toRenderTableRow(renderer());
+ else if (is<RenderTableRow>(renderer())) {
+ RenderTableRow& tableRow = downcast<RenderTableRow>(renderer());
// Our bounding box is just the union of all of our cells' border/overflow rects.
for (RenderTableCell* cell = tableRow.firstCell(); cell; cell = cell->nextCell()) {
LayoutRect bbox = cell->borderBoxRect();
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -139,28 +139,28 @@
{
bool wrapInAnonymousSection = !child->isOutOfFlowPositioned();
- if (child->isTableCaption())
+ if (is<RenderTableCaption>(*child))
wrapInAnonymousSection = false;
- else if (child->isRenderTableCol()) {
+ else if (is<RenderTableCol>(*child)) {
m_hasColElements = true;
wrapInAnonymousSection = false;
- } else if (child->isTableSection()) {
+ } else if (is<RenderTableSection>(*child)) {
switch (child->style().display()) {
case TABLE_HEADER_GROUP:
resetSectionPointerIfNotBefore(m_head, beforeChild);
if (!m_head) {
- m_head = toRenderTableSection(child);
+ m_head = downcast<RenderTableSection>(child);
} else {
resetSectionPointerIfNotBefore(m_firstBody, beforeChild);
if (!m_firstBody)
- m_firstBody = toRenderTableSection(child);
+ m_firstBody = downcast<RenderTableSection>(child);
}
wrapInAnonymousSection = false;
break;
case TABLE_FOOTER_GROUP:
resetSectionPointerIfNotBefore(m_foot, beforeChild);
if (!m_foot) {
- m_foot = toRenderTableSection(child);
+ m_foot = downcast<RenderTableSection>(child);
wrapInAnonymousSection = false;
break;
}
@@ -168,18 +168,18 @@
case TABLE_ROW_GROUP:
resetSectionPointerIfNotBefore(m_firstBody, beforeChild);
if (!m_firstBody)
- m_firstBody = toRenderTableSection(child);
+ m_firstBody = downcast<RenderTableSection>(child);
wrapInAnonymousSection = false;
break;
default:
ASSERT_NOT_REACHED();
}
- } else if (child->isTableCell() || child->isTableRow())
+ } else if (is<RenderTableCell>(*child) || is<RenderTableRow>(*child))
wrapInAnonymousSection = true;
else
wrapInAnonymousSection = true;
- if (child->isTableSection())
+ if (is<RenderTableSection>(*child))
setNeedsSectionRecalc();
if (!wrapInAnonymousSection) {
@@ -190,32 +190,32 @@
return;
}
- if (!beforeChild && lastChild() && lastChild()->isTableSection() && lastChild()->isAnonymous() && !lastChild()->isBeforeContent()) {
- toRenderTableSection(lastChild())->addChild(child);
+ if (!beforeChild && is<RenderTableSection>(lastChild()) && lastChild()->isAnonymous() && !lastChild()->isBeforeContent()) {
+ downcast<RenderTableSection>(*lastChild()).addChild(child);
return;
}
if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
RenderObject* section = beforeChild->previousSibling();
- if (section && section->isTableSection() && section->isAnonymous()) {
- toRenderTableSection(section)->addChild(child);
+ if (is<RenderTableSection>(section) && section->isAnonymous()) {
+ downcast<RenderTableSection>(*section).addChild(child);
return;
}
}
RenderObject* lastBox = beforeChild;
- while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableSection() && lastBox->style().display() != TABLE_CAPTION && lastBox->style().display() != TABLE_COLUMN_GROUP)
+ while (lastBox && lastBox->parent()->isAnonymous() && !is<RenderTableSection>(*lastBox) && lastBox->style().display() != TABLE_CAPTION && lastBox->style().display() != TABLE_COLUMN_GROUP)
lastBox = lastBox->parent();
if (lastBox && lastBox->isAnonymous() && !isAfterContent(lastBox) && lastBox->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(lastBox);
- if (beforeChild == section)
- beforeChild = section->firstRow();
- section->addChild(child, beforeChild);
+ RenderTableSection& section = downcast<RenderTableSection>(*lastBox);
+ if (beforeChild == §ion)
+ beforeChild = section.firstRow();
+ section.addChild(child, beforeChild);
return;
}
- if (beforeChild && !beforeChild->isTableSection() && beforeChild->style().display() != TABLE_CAPTION && beforeChild->style().display() != TABLE_COLUMN_GROUP)
- beforeChild = 0;
+ if (beforeChild && !is<RenderTableSection>(*beforeChild) && beforeChild->style().display() != TABLE_CAPTION && beforeChild->style().display() != TABLE_COLUMN_GROUP)
+ beforeChild = nullptr;
RenderTableSection* section = RenderTableSection::createAnonymousWithParentRenderer(this);
addChild(section, beforeChild);
@@ -459,8 +459,8 @@
bool collapsing = collapseBorders();
for (auto& child : childrenOfType<RenderElement>(*this)) {
- if (child.isTableSection()) {
- RenderTableSection& section = toRenderTableSection(child);
+ if (is<RenderTableSection>(child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(child);
if (m_columnLogicalWidthChanged)
section.setChildNeedsLayout(MarkOnlyThis);
section.layoutIfNeeded();
@@ -468,8 +468,8 @@
if (collapsing)
section.recalcOuterBorder();
ASSERT(!section.needsLayout());
- } else if (child.isRenderTableCol()) {
- toRenderTableCol(child).layoutIfNeeded();
+ } else if (is<RenderTableCol>(child)) {
+ downcast<RenderTableCol>(child).layoutIfNeeded();
ASSERT(!child.needsLayout());
}
}
@@ -851,15 +851,15 @@
RenderTableCol* RenderTable::firstColumn() const
{
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isRenderTableCol())
- return toRenderTableCol(child);
+ if (is<RenderTableCol>(*child))
+ return downcast<RenderTableCol>(child);
// We allow only table-captions before columns or column-groups.
- if (!child->isTableCaption())
- return 0;
+ if (!is<RenderTableCaption>(*child))
+ return nullptr;
}
- return 0;
+ return nullptr;
}
void RenderTable::updateColumnCache() const
@@ -1006,31 +1006,31 @@
m_hasColElements = true;
break;
case TABLE_HEADER_GROUP:
- if (child->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(child);
+ if (is<RenderTableSection>(*child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(*child);
if (!m_head)
- m_head = section;
+ m_head = §ion;
else if (!m_firstBody)
- m_firstBody = section;
- section->recalcCellsIfNeeded();
+ m_firstBody = §ion;
+ section.recalcCellsIfNeeded();
}
break;
case TABLE_FOOTER_GROUP:
- if (child->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(child);
+ if (is<RenderTableSection>(*child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(*child);
if (!m_foot)
- m_foot = section;
+ m_foot = §ion;
else if (!m_firstBody)
- m_firstBody = section;
- section->recalcCellsIfNeeded();
+ m_firstBody = §ion;
+ section.recalcCellsIfNeeded();
}
break;
case TABLE_ROW_GROUP:
- if (child->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(child);
+ if (is<RenderTableSection>(*child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(*child);
if (!m_firstBody)
- m_firstBody = section;
- section->recalcCellsIfNeeded();
+ m_firstBody = §ion;
+ section.recalcCellsIfNeeded();
}
break;
default:
@@ -1284,17 +1284,17 @@
recalcSectionsIfNeeded();
if (section == m_head)
- return 0;
+ return nullptr;
RenderObject* prevSection = section == m_foot ? lastChild() : section->previousSibling();
while (prevSection) {
- if (prevSection->isTableSection() && prevSection != m_head && prevSection != m_foot && (skipEmptySections == DoNotSkipEmptySections || toRenderTableSection(prevSection)->numRows()))
+ if (is<RenderTableSection>(*prevSection) && prevSection != m_head && prevSection != m_foot && (skipEmptySections == DoNotSkipEmptySections || downcast<RenderTableSection>(*prevSection).numRows()))
break;
prevSection = prevSection->previousSibling();
}
if (!prevSection && m_head && (skipEmptySections == DoNotSkipEmptySections || m_head->numRows()))
prevSection = m_head;
- return toRenderTableSection(prevSection);
+ return downcast<RenderTableSection>(prevSection);
}
RenderTableSection* RenderTable::sectionBelow(const RenderTableSection* section, SkipEmptySectionsValue skipEmptySections) const
@@ -1302,17 +1302,17 @@
recalcSectionsIfNeeded();
if (section == m_foot)
- return 0;
+ return nullptr;
RenderObject* nextSection = section == m_head ? firstChild() : section->nextSibling();
while (nextSection) {
- if (nextSection->isTableSection() && nextSection != m_head && nextSection != m_foot && (skipEmptySections == DoNotSkipEmptySections || toRenderTableSection(nextSection)->numRows()))
+ if (is<RenderTableSection>(*nextSection) && nextSection != m_head && nextSection != m_foot && (skipEmptySections == DoNotSkipEmptySections || downcast<RenderTableSection>(*nextSection).numRows()))
break;
nextSection = nextSection->nextSibling();
}
if (!nextSection && m_foot && (skipEmptySections == DoNotSkipEmptySections || m_foot->numRows()))
nextSection = m_foot;
- return toRenderTableSection(nextSection);
+ return downcast<RenderTableSection>(nextSection);
}
RenderTableSection* RenderTable::bottomSection() const
@@ -1323,11 +1323,11 @@
return m_foot;
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
- if (child->isTableSection())
- return toRenderTableSection(child);
+ if (is<RenderTableSection>(*child))
+ return downcast<RenderTableSection>(child);
}
- return 0;
+ return nullptr;
}
RenderTableCell* RenderTable::cellAbove(const RenderTableCell* cell) const
Modified: trunk/Source/WebCore/rendering/RenderTable.h (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTable.h 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2014-10-13 18:21:11 UTC (rev 174653)
@@ -381,8 +381,6 @@
return m_foot;
}
-RENDER_OBJECT_TYPE_CASTS(RenderTable, isTable())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTable, isTable())
Modified: trunk/Source/WebCore/rendering/RenderTableCaption.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableCaption.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableCaption.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -55,7 +55,7 @@
RenderTable* RenderTableCaption::table() const
{
- return toRenderTable(parent());
+ return downcast<RenderTable>(parent());
}
}
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2014-10-13 18:21:11 UTC (rev 174653)
@@ -74,9 +74,9 @@
RenderTableCell* nextCell() const;
RenderTableCell* previousCell() const;
- RenderTableRow* row() const { return toRenderTableRow(parent()); }
- RenderTableSection* section() const { return toRenderTableSection(parent()->parent()); }
- RenderTable* table() const { return toRenderTable(parent()->parent()->parent()); }
+ RenderTableRow* row() const { return downcast<RenderTableRow>(parent()); }
+ RenderTableSection* section() const { return downcast<RenderTableSection>(parent()->parent()); }
+ RenderTable* table() const { return downcast<RenderTable>(parent()->parent()->parent()); }
unsigned rowIndex() const
{
@@ -294,26 +294,24 @@
int m_intrinsicPaddingAfter;
};
-RENDER_OBJECT_TYPE_CASTS(RenderTableCell, isTableCell())
-
inline RenderTableCell* RenderTableCell::nextCell() const
{
- return toRenderTableCell(RenderBlockFlow::nextSibling());
+ return downcast<RenderTableCell>(RenderBlockFlow::nextSibling());
}
inline RenderTableCell* RenderTableCell::previousCell() const
{
- return toRenderTableCell(RenderBlockFlow::previousSibling());
+ return downcast<RenderTableCell>(RenderBlockFlow::previousSibling());
}
inline RenderTableCell* RenderTableRow::firstCell() const
{
- return toRenderTableCell(RenderBox::firstChild());
+ return downcast<RenderTableCell>(RenderBox::firstChild());
}
inline RenderTableCell* RenderTableRow::lastCell() const
{
- return toRenderTableCell(RenderBox::lastChild());
+ return downcast<RenderTableCell>(RenderBox::lastChild());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderTableCol.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableCol.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableCol.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -30,6 +30,7 @@
#include "HTMLTableColElement.h"
#include "RenderIterator.h"
#include "RenderTable.h"
+#include "RenderTableCaption.h"
#include "RenderTableCell.h"
namespace WebCore {
@@ -139,44 +140,44 @@
RenderTable* RenderTableCol::table() const
{
auto table = parent();
- if (table && !table->isTable())
+ if (table && !is<RenderTable>(*table))
table = table->parent();
- return table && table->isTable() ? toRenderTable(table) : 0;
+ return is<RenderTable>(table) ? downcast<RenderTable>(table) : nullptr;
}
RenderTableCol* RenderTableCol::enclosingColumnGroup() const
{
- if (!parent()->isRenderTableCol())
- return 0;
+ if (!is<RenderTableCol>(*parent()))
+ return nullptr;
- RenderTableCol* parentColumnGroup = toRenderTableCol(parent());
- ASSERT(parentColumnGroup->isTableColumnGroup());
+ RenderTableCol& parentColumnGroup = downcast<RenderTableCol>(*parent());
+ ASSERT(parentColumnGroup.isTableColumnGroup());
ASSERT(isTableColumn());
- return parentColumnGroup;
+ return &parentColumnGroup;
}
RenderTableCol* RenderTableCol::nextColumn() const
{
// If |this| is a column-group, the next column is the colgroup's first child column.
if (RenderObject* firstChild = this->firstChild())
- return toRenderTableCol(firstChild);
+ return downcast<RenderTableCol>(firstChild);
// Otherwise it's the next column along.
RenderObject* next = nextSibling();
// Failing that, the child is the last column in a column-group, so the next column is the next column/column-group after its column-group.
- if (!next && parent()->isRenderTableCol())
+ if (!next && is<RenderTableCol>(*parent()))
next = parent()->nextSibling();
- for (; next && !next->isRenderTableCol(); next = next->nextSibling()) {
+ for (; next && !is<RenderTableCol>(*next); next = next->nextSibling()) {
// We allow captions mixed with columns and column-groups.
- if (next->isTableCaption())
+ if (is<RenderTableCaption>(*next))
continue;
- return 0;
+ return nullptr;
}
- return toRenderTableCol(next);
+ return downcast<RenderTableCol>(next);
}
const BorderValue& RenderTableCol::borderAdjoiningCellStartBorder(const RenderTableCell*) const
Modified: trunk/Source/WebCore/rendering/RenderTableCol.h (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableCol.h 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableCol.h 2014-10-13 18:21:11 UTC (rev 174653)
@@ -75,11 +75,11 @@
virtual LayoutUnit offsetTop() const override;
virtual LayoutUnit offsetWidth() const override;
virtual LayoutUnit offsetHeight() const override;
+ virtual void updateFromElement() override;
private:
virtual const char* renderName() const override { return "RenderTableCol"; }
virtual bool isRenderTableCol() const override { return true; }
- virtual void updateFromElement() override;
virtual void computePreferredLogicalWidths() override { ASSERT_NOT_REACHED(); }
virtual void insertedIntoTree() override;
@@ -100,8 +100,6 @@
unsigned m_span;
};
-RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableCol, isRenderTableCol())
Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableRow.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -109,28 +109,28 @@
void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
{
- if (!child->isTableCell()) {
+ if (!is<RenderTableCell>(*child)) {
RenderObject* last = beforeChild;
if (!last)
last = lastCell();
- if (last && last->isAnonymous() && last->isTableCell() && !last->isBeforeOrAfterContent()) {
- RenderTableCell* cell = toRenderTableCell(last);
- if (beforeChild == cell)
- beforeChild = cell->firstChild();
- cell->addChild(child, beforeChild);
+ if (last && last->isAnonymous() && is<RenderTableCell>(*last) && !last->isBeforeOrAfterContent()) {
+ RenderTableCell& cell = downcast<RenderTableCell>(*last);
+ if (beforeChild == &cell)
+ beforeChild = cell.firstChild();
+ cell.addChild(child, beforeChild);
return;
}
if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
RenderObject* cell = beforeChild->previousSibling();
- if (cell && cell->isTableCell() && cell->isAnonymous()) {
- toRenderTableCell(cell)->addChild(child);
+ if (is<RenderTableCell>(cell) && cell->isAnonymous()) {
+ downcast<RenderTableCell>(*cell).addChild(child);
return;
}
}
// If beforeChild is inside an anonymous cell, insert into the cell.
- if (last && !last->isTableCell() && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) {
+ if (last && !is<RenderTableCell>(*last) && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) {
last->parent()->addChild(child, beforeChild);
return;
}
@@ -144,14 +144,14 @@
if (beforeChild && beforeChild->parent() != this)
beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
- RenderTableCell* cell = toRenderTableCell(child);
+ RenderTableCell& cell = downcast<RenderTableCell>(*child);
// Generated content can result in us having a null section so make sure to null check our parent.
if (parent())
- section()->addCell(cell, this);
+ section()->addCell(&cell, this);
- ASSERT(!beforeChild || beforeChild->isTableCell());
- RenderBox::addChild(cell, beforeChild);
+ ASSERT(!beforeChild || is<RenderTableCell>(*beforeChild));
+ RenderBox::addChild(&cell, beforeChild);
if (beforeChild || nextRow())
section()->setNeedsCellRecalc();
Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableRow.h 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h 2014-10-13 18:21:11 UTC (rev 174653)
@@ -43,8 +43,8 @@
RenderTableCell* firstCell() const;
RenderTableCell* lastCell() const;
- RenderTableSection* section() const { return toRenderTableSection(parent()); }
- RenderTable* table() const { return toRenderTable(parent()->parent()); }
+ RenderTableSection* section() const { return downcast<RenderTableSection>(parent()); }
+ RenderTable* table() const { return downcast<RenderTable>(parent()->parent()); }
void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
@@ -119,26 +119,24 @@
unsigned m_rowIndex : 31;
};
-RENDER_OBJECT_TYPE_CASTS(RenderTableRow, isTableRow())
-
inline RenderTableRow* RenderTableSection::firstRow() const
{
- return toRenderTableRow(RenderBox::firstChild());
+ return downcast<RenderTableRow>(RenderBox::firstChild());
}
inline RenderTableRow* RenderTableSection::lastRow() const
{
- return toRenderTableRow(RenderBox::lastChild());
+ return downcast<RenderTableRow>(RenderBox::lastChild());
}
inline RenderTableRow* RenderTableRow::nextRow() const
{
- return toRenderTableRow(RenderBox::nextSibling());
+ return downcast<RenderTableRow>(RenderBox::nextSibling());
}
inline RenderTableRow* RenderTableRow::previousRow() const
{
- return toRenderTableRow(RenderBox::previousSibling());
+ return downcast<RenderTableRow>(RenderBox::previousSibling());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -33,6 +33,7 @@
#include "RenderTableCell.h"
#include "RenderTableCol.h"
#include "RenderTableRow.h"
+#include "RenderTextControl.h"
#include "RenderView.h"
#include "StyleInheritedData.h"
#include <limits>
@@ -135,22 +136,22 @@
void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild)
{
- if (!child->isTableRow()) {
+ if (!is<RenderTableRow>(*child)) {
RenderObject* last = beforeChild;
if (!last)
last = lastRow();
if (last && last->isAnonymous() && !last->isBeforeOrAfterContent()) {
- RenderTableRow* row = toRenderTableRow(last);
- if (beforeChild == row)
- beforeChild = row->firstCell();
- row->addChild(child, beforeChild);
+ RenderTableRow& row = downcast<RenderTableRow>(*last);
+ if (beforeChild == &row)
+ beforeChild = row.firstCell();
+ row.addChild(child, beforeChild);
return;
}
if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
RenderObject* row = beforeChild->previousSibling();
- if (row && row->isTableRow() && row->isAnonymous()) {
- toRenderTableRow(row)->addChild(child);
+ if (is<RenderTableRow>(row) && row->isAnonymous()) {
+ downcast<RenderTableRow>(*row).addChild(child);
return;
}
}
@@ -158,10 +159,10 @@
// If beforeChild is inside an anonymous cell/row, insert into the cell or into
// the anonymous row containing it, if there is one.
RenderObject* lastBox = last;
- while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableRow())
+ while (lastBox && lastBox->parent()->isAnonymous() && !is<RenderTableRow>(*lastBox))
lastBox = lastBox->parent();
if (lastBox && lastBox->isAnonymous() && !lastBox->isBeforeOrAfterContent()) {
- toRenderTableRow(lastBox)->addChild(child, beforeChild);
+ downcast<RenderTableRow>(*lastBox).addChild(child, beforeChild);
return;
}
@@ -180,9 +181,9 @@
ensureRows(m_cRow);
- RenderTableRow* row = toRenderTableRow(child);
- m_grid[insertionRow].rowRenderer = row;
- row->setRowIndex(insertionRow);
+ RenderTableRow& row = downcast<RenderTableRow>(*child);
+ m_grid[insertionRow].rowRenderer = &row;
+ row.setRowIndex(insertionRow);
if (!beforeChild)
setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(m_grid[insertionRow]);
@@ -190,7 +191,7 @@
if (beforeChild && beforeChild->parent() != this)
beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
- ASSERT(!beforeChild || beforeChild->isTableRow());
+ ASSERT(!beforeChild || is<RenderTableRow>(*beforeChild));
RenderBox::addChild(child, beforeChild);
}
@@ -577,11 +578,11 @@
bool flexAllChildren = cell->style().logicalHeight().isFixed()
|| (!table()->style().logicalHeight().isAuto() && rHeight != cell->logicalHeight());
- for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) {
- if (!o->isText() && o->style().logicalHeight().isPercent() && (flexAllChildren || ((o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow())) && !o->isTextControl()))) {
+ for (RenderObject* renderer = cell->firstChild(); renderer; renderer = renderer->nextSibling()) {
+ if (!is<RenderText>(*renderer) && renderer->style().logicalHeight().isPercent() && (flexAllChildren || ((renderer->isReplaced() || (is<RenderBox>(*renderer) && downcast<RenderBox>(*renderer).scrollsOverflow())) && !is<RenderTextControl>(*renderer)))) {
// Tables with no sections do not flex.
- if (!o->isTable() || toRenderTable(o)->hasSections()) {
- o->setNeedsLayout(MarkOnlyThis);
+ if (!is<RenderTable>(*renderer) || downcast<RenderTable>(*renderer).hasSections()) {
+ renderer->setNeedsLayout(MarkOnlyThis);
cellChildrenFlex = true;
}
}
@@ -985,13 +986,13 @@
{
LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset);
PaintPhase paintPhase = paintInfo.phase;
- RenderTableRow* row = toRenderTableRow(cell->parent());
+ RenderTableRow& row = downcast<RenderTableRow>(*cell->parent());
if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) {
// We need to handle painting a stack of backgrounds. This stack (from bottom to top) consists of
// the column group, column, row group, row, and then the cell.
RenderTableCol* column = table()->colElement(cell->col());
- RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() : 0;
+ RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() : nullptr;
// Column groups and columns first.
// FIXME: Columns and column groups do not currently support opacity, and they are being painted "too late" in
@@ -1006,10 +1007,10 @@
// Paint the row next, but only if it doesn't have a layer. If a row has a layer, it will be responsible for
// painting the row background for the cell.
- if (!row->hasSelfPaintingLayer())
- cell->paintBackgroundsBehindCell(paintInfo, cellPoint, row);
+ if (!row.hasSelfPaintingLayer())
+ cell->paintBackgroundsBehindCell(paintInfo, cellPoint, &row);
}
- if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()))
+ if ((!cell->hasSelfPaintingLayer() && !row.hasSelfPaintingLayer()))
cell->paint(paintInfo, cellPoint);
}
Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTableSection.h 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h 2014-10-13 18:21:11 UTC (rev 174653)
@@ -81,7 +81,7 @@
void layoutRows();
void computeOverflowFromCells();
- RenderTable* table() const { return toRenderTable(parent()); }
+ RenderTable* table() const { return downcast<RenderTable>(parent()); }
struct CellStruct {
Vector<RenderTableCell*, 1> cells;
@@ -347,8 +347,6 @@
HashMap<std::pair<const RenderTableCell*, int>, CollapsedBorderValue > m_cellsCollapsedBorders;
};
-RENDER_OBJECT_TYPE_CASTS(RenderTableSection, isTableSection())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableSection, isTableSection())
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (174652 => 174653)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2014-10-13 17:49:16 UTC (rev 174652)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2014-10-13 18:21:11 UTC (rev 174653)
@@ -467,8 +467,8 @@
int logicalWidth = ceilf(run.left() + run.logicalWidth()) - x;
// FIXME: Table cell adjustment is temporary until results can be updated.
- if (o.containingBlock()->isTableCell())
- y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore();
+ if (is<RenderTableCell>(*o.containingBlock()))
+ y -= downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore();
ts << "text run at (" << x << "," << y << ") width " << logicalWidth;
if (!run.isLeftToRightDirection() || run.dirOverride()) {
@@ -489,8 +489,8 @@
int y = rect.y();
int logicalWidth = ceilf(rect.x() + rect.width()) - x;
- if (o.containingBlock()->isTableCell())
- y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore();
+ if (is<RenderTableCell>(*o.containingBlock()))
+ y -= downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore();
ts << "text run at (" << x << "," << y << ") width " << logicalWidth;
ts << ": "