summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTableCell.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/rendering/RenderTableCell.cpp
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/rendering/RenderTableCell.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTableCell.cpp73
1 files changed, 52 insertions, 21 deletions
diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp
index f43e5c1a0..5b690f4c7 100644
--- a/Source/WebCore/rendering/RenderTableCell.cpp
+++ b/Source/WebCore/rendering/RenderTableCell.cpp
@@ -58,8 +58,10 @@ void RenderTableCell::willBeDestroyed()
RenderBlock::willBeDestroyed();
- if (recalcSection)
+ if (recalcSection) {
recalcSection->setNeedsCellRecalc();
+ recalcSection->removeCachedCollapsedBorders(this);
+ }
}
unsigned RenderTableCell::colSpan() const
@@ -392,6 +394,14 @@ static CollapsedBorderValue chooseBorder(const CollapsedBorderValue& border1, co
CollapsedBorderValue RenderTableCell::collapsedStartBorder(IncludeBorderColorOrNot includeColor) const
{
+ CollapsedBorderValue result = computeCollapsedStartBorder(includeColor);
+ if (includeColor)
+ section()->setCachedCollapsedBorder(this, CBSStart, result);
+ return result;
+}
+
+CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderColorOrNot includeColor) const
+{
RenderTable* table = this->table();
bool isStartColumn = col() == 0;
@@ -455,6 +465,14 @@ CollapsedBorderValue RenderTableCell::collapsedStartBorder(IncludeBorderColorOrN
CollapsedBorderValue RenderTableCell::collapsedEndBorder(IncludeBorderColorOrNot includeColor) const
{
+ CollapsedBorderValue result = computeCollapsedEndBorder(includeColor);
+ if (includeColor)
+ section()->setCachedCollapsedBorder(this, CBSEnd, result);
+ return result;
+}
+
+CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderColorOrNot includeColor) const
+{
RenderTable* table = this->table();
bool isEndColumn = table->colToEffCol(col() + colSpan() - 1) == table->numEffCols() - 1;
@@ -521,6 +539,14 @@ CollapsedBorderValue RenderTableCell::collapsedEndBorder(IncludeBorderColorOrNot
CollapsedBorderValue RenderTableCell::collapsedBeforeBorder(IncludeBorderColorOrNot includeColor) const
{
+ CollapsedBorderValue result = computeCollapsedBeforeBorder(includeColor);
+ if (includeColor)
+ section()->setCachedCollapsedBorder(this, CBSBefore, result);
+ return result;
+}
+
+CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorderColorOrNot includeColor) const
+{
RenderTable* table = this->table();
// For before border, we need to check, in order of precedence:
@@ -599,6 +625,14 @@ CollapsedBorderValue RenderTableCell::collapsedBeforeBorder(IncludeBorderColorOr
CollapsedBorderValue RenderTableCell::collapsedAfterBorder(IncludeBorderColorOrNot includeColor) const
{
+ CollapsedBorderValue result = computeCollapsedAfterBorder(includeColor);
+ if (includeColor)
+ section()->setCachedCollapsedBorder(this, CBSAfter, result);
+ return result;
+}
+
+CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderColorOrNot includeColor) const
+{
RenderTable* table = this->table();
// For after border, we need to check, in order of precedence:
@@ -666,36 +700,32 @@ CollapsedBorderValue RenderTableCell::collapsedAfterBorder(IncludeBorderColorOrN
return result;
}
-CollapsedBorderValue RenderTableCell::collapsedLeftBorder(IncludeBorderColorOrNot includeColor) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(RenderStyle* tableStyle) const
{
- RenderStyle* tableStyle = table()->style();
if (tableStyle->isHorizontalWritingMode())
- return tableStyle->isLeftToRightDirection() ? collapsedStartBorder(includeColor) : collapsedEndBorder(includeColor);
- return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder(includeColor) : collapsedBeforeBorder(includeColor);
+ return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd);
+ return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore);
}
-CollapsedBorderValue RenderTableCell::collapsedRightBorder(IncludeBorderColorOrNot includeColor) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(RenderStyle* tableStyle) const
{
- RenderStyle* tableStyle = table()->style();
if (tableStyle->isHorizontalWritingMode())
- return tableStyle->isLeftToRightDirection() ? collapsedEndBorder(includeColor) : collapsedStartBorder(includeColor);
- return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder(includeColor) : collapsedAfterBorder(includeColor);
+ return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
+ return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter);
}
-CollapsedBorderValue RenderTableCell::collapsedTopBorder(IncludeBorderColorOrNot includeColor) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(RenderStyle* tableStyle) const
{
- RenderStyle* tableStyle = table()->style();
if (tableStyle->isHorizontalWritingMode())
- return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder(includeColor) : collapsedBeforeBorder(includeColor);
- return tableStyle->isLeftToRightDirection() ? collapsedStartBorder(includeColor) : collapsedEndBorder(includeColor);
+ return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore);
+ return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd);
}
-CollapsedBorderValue RenderTableCell::collapsedBottomBorder(IncludeBorderColorOrNot includeColor) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(RenderStyle* tableStyle) const
{
- RenderStyle* tableStyle = table()->style();
if (tableStyle->isHorizontalWritingMode())
- return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder(includeColor) : collapsedAfterBorder(includeColor);
- return tableStyle->isLeftToRightDirection() ? collapsedEndBorder(includeColor) : collapsedStartBorder(includeColor);
+ return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter);
+ return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
}
LayoutUnit RenderTableCell::borderLeft() const
@@ -923,10 +953,11 @@ void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
- CollapsedBorderValue leftVal = collapsedLeftBorder();
- CollapsedBorderValue rightVal = collapsedRightBorder();
- CollapsedBorderValue topVal = collapsedTopBorder();
- CollapsedBorderValue bottomVal = collapsedBottomBorder();
+ RenderStyle* tableStyle = table()->style();
+ CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(tableStyle);
+ CollapsedBorderValue rightVal = cachedCollapsedRightBorder(tableStyle);
+ CollapsedBorderValue topVal = cachedCollapsedTopBorder(tableStyle);
+ CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(tableStyle);
// Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
LayoutUnit topWidth = topVal.width();