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

Unified Diff: Source/core/rendering/RenderTableRow.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/RenderTableRow.cpp
diff --git a/Source/core/rendering/RenderTableRow.cpp b/Source/core/rendering/RenderTableRow.cpp
index 8a41cc73839af44d50e0c00ffa785e0a497123b2..7e4557f8d9a450e358a647500a0f574a671c7b94 100644
--- a/Source/core/rendering/RenderTableRow.cpp
+++ b/Source/core/rendering/RenderTableRow.cpp
@@ -1,10 +1,10 @@
-/**
+/*
* Copyright (C) 1997 Martin Jones (mjones@kde.org)
* (C) 1997 Torben Weis (weis@kde.org)
* (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, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -111,7 +111,7 @@ void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
if (!child->isTableCell()) {
RenderObject* last = beforeChild;
if (!last)
- last = lastChild();
+ last = lastCell();
if (last && last->isAnonymous() && last->isTableCell() && !last->isBeforeOrAfterContent()) {
RenderTableCell* lastCell = toRenderTableCell(last);
if (beforeChild == lastCell)
@@ -152,7 +152,7 @@ void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
ASSERT(!beforeChild || beforeChild->isTableCell());
RenderBox::addChild(cell, beforeChild);
- if (beforeChild || nextSibling())
+ if (beforeChild || nextRow())
section()->setNeedsCellRecalc();
}
@@ -163,16 +163,13 @@ void RenderTableRow::layout()
// Table rows do not add translation.
LayoutStateMaintainer statePusher(*this, LayoutSize());
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isTableCell()) {
- SubtreeLayoutScope layouter(*child);
- RenderTableCell* cell = toRenderTableCell(child);
- if (!cell->needsLayout())
- cell->markForPaginationRelayoutIfNeeded(layouter);
- if (cell->needsLayout()) {
- cell->computeAndSetBlockDirectionMargins(table());
- cell->layout();
- }
+ for (RenderTableCell* cell = firstCell(); cell; cell = cell->nextCell()) {
+ SubtreeLayoutScope layouter(*cell);
+ if (!cell->needsLayout())
+ cell->markForPaginationRelayoutIfNeeded(layouter);
+ if (cell->needsLayout()) {
+ cell->computeAndSetBlockDirectionMargins(table());
+ cell->layout();
}
}
@@ -185,14 +182,12 @@ void RenderTableRow::layout()
// We cannot call repaint() because our clippedOverflowRectForRepaint() is taken from the
// parent table, and being mid-layout, that is invalid. Instead, we repaint our cells.
if (selfNeedsLayout() && checkForRepaint()) {
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isTableCell()) {
- if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
- // FIXME: Is this needed with repaint After Layout?
- child->setShouldDoFullRepaintAfterLayout(true);
- } else {
- child->repaint();
- }
+ for (RenderTableCell* cell = firstCell(); cell; cell = cell->nextCell()) {
+ if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
+ // FIXME: Is this needed with repaint After Layout?
+ cell->setShouldDoFullRepaintAfterLayout(true);
+ } else {
+ cell->repaint();
}
}
}
@@ -206,14 +201,14 @@ bool RenderTableRow::nodeAtPoint(const HitTestRequest& request, HitTestResult& r
{
// Table rows cannot ever be hit tested. Effectively they do not exist.
// Just forward to our children always.
- for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
+ for (RenderTableCell* cell = lastCell(); cell; cell = cell->previousCell()) {
// 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->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer()) {
- LayoutPoint cellPoint = flipForWritingModeForChild(toRenderTableCell(child), accumulatedOffset);
- if (child->nodeAtPoint(request, result, locationInContainer, cellPoint, action)) {
+ if (!cell->hasSelfPaintingLayer()) {
+ LayoutPoint cellPoint = flipForWritingModeForChild(cell, accumulatedOffset);
+ if (cell->nodeAtPoint(request, result, locationInContainer, cellPoint, action)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(cellPoint));
return true;
}
@@ -237,16 +232,12 @@ void RenderTableRow::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
paintOutlineForRowIfNeeded(paintInfo, paintOffset);
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isTableCell()) {
- // Paint the row background behind the cell.
- if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground) {
- RenderTableCell* cell = toRenderTableCell(child);
- cell->paintBackgroundsBehindCell(paintInfo, paintOffset, this);
- }
- if (!toRenderBox(child)->hasSelfPaintingLayer())
- child->paint(paintInfo, paintOffset);
- }
+ for (RenderTableCell* cell = firstCell(); cell; cell = cell->nextCell()) {
+ // Paint the row background behind the cell.
+ if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground)
+ cell->paintBackgroundsBehindCell(paintInfo, paintOffset, this);
+ if (!cell->hasSelfPaintingLayer())
+ cell->paint(paintInfo, paintOffset);
}
}

Powered by Google App Engine
This is Rietveld 408576698