CollapsedBorderValue RenderTableCell::collapsedAfterBorder() const { RenderTable* table = this->table(); // For after border, we need to check, in order of precedence: // (1) Our after border. int before = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode()); int after = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode()); CollapsedBorderValue result = CollapsedBorderValue(&style()->borderAfter(), style()->visitedDependentColor(after), BCELL); RenderTableCell* nextCell = table->cellBelow(this); if (nextCell) { // (2) An after cell's before border. result = chooseBorder(result, CollapsedBorderValue(&nextCell->style()->borderBefore(), nextCell->style()->visitedDependentColor(before), BCELL)); if (!result.exists()) return result; } // (3) Our row's after border. (FIXME: Deal with rowspan!) result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderAfter(), parent()->style()->visitedDependentColor(after), BROW)); if (!result.exists()) return result; // (4) The next row's before border. if (nextCell) { result = chooseBorder(result, CollapsedBorderValue(&nextCell->parent()->style()->borderBefore(), nextCell->parent()->style()->visitedDependentColor(before), BROW)); if (!result.exists()) return result; } // Now check row groups. RenderTableSection* currSection = section(); if (row() + rowSpan() >= currSection->numRows()) { // (5) Our row group's after border. result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderAfter(), currSection->style()->visitedDependentColor(after), BROWGROUP)); if (!result.exists()) return result; // (6) Following row group's before border. currSection = table->sectionBelow(currSection); if (currSection) { result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBefore(), currSection->style()->visitedDependentColor(before), BROWGROUP)); if (!result.exists()) return result; } } if (!currSection) { // (8) Our column and column group's after borders. RenderTableCol* colElt = table->colElement(col()); if (colElt) { result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderAfter(), colElt->style()->visitedDependentColor(after), BCOL)); if (!result.exists()) return result; if (colElt->parent()->isTableCol()) { result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderAfter(), colElt->parent()->style()->visitedDependentColor(after), BCOLGROUP)); if (!result.exists()) return result; } } // (9) The table's after border. result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderAfter(), table->style()->visitedDependentColor(after), BTABLE)); if (!result.exists()) return result; } return result; }