summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RenderTable.cpp')
-rw-r--r--WebCore/rendering/RenderTable.cpp96
1 files changed, 57 insertions, 39 deletions
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index 61e05ad..0a61a93 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -648,6 +648,25 @@ void RenderTable::appendColumn(int span)
setNeedsLayoutAndPrefWidthsRecalc();
}
+RenderTableCol* RenderTable::nextColElement(RenderTableCol* current) const
+{
+ RenderObject* next = current->firstChild();
+ if (!next)
+ next = current->nextSibling();
+ if (!next && current->parent()->isTableCol())
+ next = current->parent()->nextSibling();
+
+ while (next) {
+ if (next->isTableCol())
+ return toRenderTableCol(next);
+ if (next != m_caption)
+ return 0;
+ next = next->nextSibling();
+ }
+
+ return 0;
+}
+
RenderTableCol* RenderTable::colElement(int col, bool* startEdge, bool* endEdge) const
{
if (!m_hasColElements)
@@ -656,32 +675,31 @@ RenderTableCol* RenderTable::colElement(int col, bool* startEdge, bool* endEdge)
int cCol = 0;
while (child) {
- if (child->isTableCol()) {
- RenderTableCol* colElem = toRenderTableCol(child);
- int span = colElem->span();
- if (!colElem->firstChild()) {
- int startCol = cCol;
- int endCol = cCol + span - 1;
- cCol += span;
- if (cCol > col) {
- if (startEdge)
- *startEdge = startCol == col;
- if (endEdge)
- *endEdge = endCol == col;
- return colElem;
- }
- }
-
- RenderObject* next = child->firstChild();
- if (!next)
- next = child->nextSibling();
- if (!next && child->parent()->isTableCol())
- next = child->parent()->nextSibling();
- child = next;
- } else if (child == m_caption)
- child = child->nextSibling();
- else
+ if (child->isTableCol())
break;
+ if (child != m_caption)
+ return 0;
+ child = child->nextSibling();
+ }
+ if (!child)
+ return 0;
+
+ RenderTableCol* colElem = toRenderTableCol(child);
+ while (colElem) {
+ int span = colElem->span();
+ if (!colElem->firstChild()) {
+ int startCol = cCol;
+ int endCol = cCol + span - 1;
+ cCol += span;
+ if (cCol > col) {
+ if (startEdge)
+ *startEdge = startCol == col;
+ if (endEdge)
+ *endEdge = endCol == col;
+ return colElem;
+ }
+ }
+ colElem = nextColElement(colElem);
}
return 0;
@@ -773,7 +791,7 @@ int RenderTable::calcBorderLeft() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = tb.width;
+ borderWidth = tb.width();
int leftmostColumn = style()->direction() == RTL ? numEffCols() - 1 : 0;
RenderTableCol* colGroup = colElement(leftmostColumn);
@@ -782,7 +800,7 @@ int RenderTable::calcBorderLeft() const
if (gb.style() == BHIDDEN)
return 0;
if (gb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(gb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(gb.width()));
}
RenderTableSection* firstNonEmptySection = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
@@ -795,7 +813,7 @@ int RenderTable::calcBorderLeft() const
return 0;
if (sb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(sb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, leftmostColumn);
@@ -809,9 +827,9 @@ int RenderTable::calcBorderLeft() const
return 0;
if (cb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(cb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(cb.width()));
if (rb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(rb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
}
}
return borderWidth / 2;
@@ -832,7 +850,7 @@ int RenderTable::calcBorderRight() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = tb.width;
+ borderWidth = tb.width();
int rightmostColumn = style()->direction() == RTL ? 0 : numEffCols() - 1;
RenderTableCol* colGroup = colElement(rightmostColumn);
@@ -841,7 +859,7 @@ int RenderTable::calcBorderRight() const
if (gb.style() == BHIDDEN)
return 0;
if (gb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(gb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(gb.width()));
}
RenderTableSection* firstNonEmptySection = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
@@ -854,7 +872,7 @@ int RenderTable::calcBorderRight() const
return 0;
if (sb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(sb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, rightmostColumn);
@@ -868,9 +886,9 @@ int RenderTable::calcBorderRight() const
return 0;
if (cb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(cb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(cb.width()));
if (rb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<unsigned>(rb.width));
+ borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
}
}
return (borderWidth + 1) / 2;
@@ -921,7 +939,7 @@ int RenderTable::outerBorderTop() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<int>(tb.width / 2));
+ borderWidth = max(borderWidth, static_cast<int>(tb.width() / 2));
return borderWidth;
}
@@ -947,7 +965,7 @@ int RenderTable::outerBorderBottom() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = max(borderWidth, static_cast<int>((tb.width + 1) / 2));
+ borderWidth = max(borderWidth, static_cast<int>((tb.width() + 1) / 2));
return borderWidth;
}
@@ -962,7 +980,7 @@ int RenderTable::outerBorderLeft() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = tb.width / 2;
+ borderWidth = tb.width() / 2;
bool allHidden = true;
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
@@ -992,7 +1010,7 @@ int RenderTable::outerBorderRight() const
if (tb.style() == BHIDDEN)
return 0;
if (tb.style() > BHIDDEN)
- borderWidth = (tb.width + 1) / 2;
+ borderWidth = (tb.width() + 1) / 2;
bool allHidden = true;
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {