Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: Source/core/rendering/RenderTableSection.cpp

Issue 294783004: Use tighter typing in table rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo / bug and update copyrights Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderTableSection.cpp
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index a9d026ae2c83c043f92aba7ae1240e7d0968b347..d0a084548b88747e373da801b6e489cc70f29e3e 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -4,7 +4,7 @@
* (C) 1998 Waldo Bastian (bastian@kde.org)
* (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* This library is free software; you can redistribute it and/or
@@ -124,7 +124,7 @@ void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild
if (!child->isTableRow()) {
RenderObject* last = beforeChild;
if (!last)
- last = lastChild();
+ last = lastRow();
if (last && last->isAnonymous() && !last->isBeforeOrAfterContent()) {
if (beforeChild == last)
beforeChild = last->slowFirstChild();
@@ -1084,7 +1084,7 @@ int RenderTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons
if (sb.style() > BHIDDEN)
borderWidth = sb.width();
- const BorderValue& rb = side == BorderBefore ? firstChild()->style()->borderBefore() : lastChild()->style()->borderAfter();
+ const BorderValue& rb = side == BorderBefore ? firstRow()->style()->borderBefore() : lastRow()->style()->borderAfter();
if (rb.style() == BHIDDEN)
return -1;
if (rb.style() > BHIDDEN && rb.width() > borderWidth)
@@ -1497,26 +1497,18 @@ void RenderTableSection::recalcCells()
m_cRow = 0;
m_grid.clear();
- for (RenderObject* row = firstChild(); row; row = row->nextSibling()) {
- if (row->isTableRow()) {
- unsigned insertionRow = m_cRow;
- m_cRow++;
- m_cCol = 0;
- ensureRows(m_cRow);
+ for (RenderTableRow* row = firstRow(); row; row = row->nextRow()) {
+ unsigned insertionRow = m_cRow;
+ ++m_cRow;
+ m_cCol = 0;
+ ensureRows(m_cRow);
- RenderTableRow* tableRow = toRenderTableRow(row);
- m_grid[insertionRow].rowRenderer = tableRow;
- tableRow->setRowIndex(insertionRow);
- setRowLogicalHeightToRowStyleLogicalHeight(m_grid[insertionRow]);
-
- for (RenderObject* cell = tableRow->firstChild(); cell; cell = cell->nextSibling()) {
- if (!cell->isTableCell())
- continue;
+ m_grid[insertionRow].rowRenderer = row;
+ row->setRowIndex(insertionRow);
+ setRowLogicalHeightToRowStyleLogicalHeight(m_grid[insertionRow]);
- RenderTableCell* tableCell = toRenderTableCell(cell);
- addCell(tableCell, tableRow);
- }
- }
+ for (RenderTableCell* cell = row->firstCell(); cell; cell = cell->nextCell())
+ addCell(cell, row);
}
m_grid.shrinkToFit();
@@ -1531,12 +1523,8 @@ void RenderTableSection::rowLogicalHeightChanged(unsigned rowIndex)
setRowLogicalHeightToRowStyleLogicalHeight(m_grid[rowIndex]);
- for (RenderObject* cell = m_grid[rowIndex].rowRenderer->firstChild(); cell; cell = cell->nextSibling()) {
- if (!cell->isTableCell())
- continue;
-
- updateLogicalHeightForCell(m_grid[rowIndex], toRenderTableCell(cell));
- }
+ for (RenderTableCell* cell = m_grid[rowIndex].rowRenderer->firstCell(); cell; cell = cell->nextCell())
+ updateLogicalHeightForCell(m_grid[rowIndex], cell);
}
void RenderTableSection::setNeedsCellRecalc()
@@ -1622,7 +1610,7 @@ void RenderTableSection::splitColumn(unsigned pos, unsigned first)
bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
// If we have no children then we have nothing to do.
- if (!firstChild())
+ if (!firstRow())
return false;
// Table sections cannot ever be hit tested. Effectively they do not exist.
@@ -1633,14 +1621,14 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul
return false;
if (hasOverflowingCell()) {
- for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
+ for (RenderTableRow* row = lastRow(); row; row = row->previousRow()) {
// FIXME: We have to skip over inline flows, since they can show up inside table rows
// at the moment (a demoted inline <form> for example). If we ever implement a
// table-specific hit-test method (which we should do for performance reasons anyway),
// then we can remove this check.
- if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer()) {
- LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
- if (child->nodeAtPoint(request, result, locationInContainer, childPoint, action)) {
+ if (!row->hasSelfPaintingLayer()) {
+ LayoutPoint childPoint = flipForWritingModeForChild(row, adjustedLocation);
+ if (row->nodeAtPoint(request, result, locationInContainer, childPoint, action)) {
updateHitTestResult(result, toLayoutPoint(locationInContainer.point() - childPoint));
return true;
}
« Source/core/rendering/RenderBlock.h ('K') | « Source/core/rendering/RenderTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698