summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTableCell.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderTableCell.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/RenderTableCell.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTableCell.cpp618
1 files changed, 303 insertions, 315 deletions
diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp
index e06a469b4..3e70320d6 100644
--- a/Source/WebCore/rendering/RenderTableCell.cpp
+++ b/Source/WebCore/rendering/RenderTableCell.cpp
@@ -48,51 +48,59 @@ using namespace HTMLNames;
struct SameSizeAsRenderTableCell : public RenderBlockFlow {
unsigned bitfields;
- int paddings[2];
+ LayoutUnit paddings[2];
};
COMPILE_ASSERT(sizeof(RenderTableCell) == sizeof(SameSizeAsRenderTableCell), RenderTableCell_should_stay_small);
-COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 8, CollapsedBorderValue_should_stay_small);
+COMPILE_ASSERT(sizeof(CollapsedBorderValue) <= 24, CollapsedBorderValue_should_stay_small);
-RenderTableCell::RenderTableCell(Element& element, PassRef<RenderStyle> style)
- : RenderBlockFlow(element, std::move(style))
+RenderTableCell::RenderTableCell(Element& element, RenderStyle&& style)
+ : RenderBlockFlow(element, WTFMove(style))
, m_column(unsetColumnIndex)
, m_cellWidthChanged(false)
- , m_intrinsicPaddingBefore(0)
- , m_intrinsicPaddingAfter(0)
+ , m_hasColSpan(false)
+ , m_hasRowSpan(false)
+ , m_hasEmptyCollapsedBeforeBorder(false)
+ , m_hasEmptyCollapsedAfterBorder(false)
+ , m_hasEmptyCollapsedStartBorder(false)
+ , m_hasEmptyCollapsedEndBorder(false)
{
// We only update the flags when notified of DOM changes in colSpanOrRowSpanChanged()
// so we need to set their initial values here in case something asks for colSpan()/rowSpan() before then.
updateColAndRowSpanFlags();
}
-RenderTableCell::RenderTableCell(Document& document, PassRef<RenderStyle> style)
- : RenderBlockFlow(document, std::move(style))
+RenderTableCell::RenderTableCell(Document& document, RenderStyle&& style)
+ : RenderBlockFlow(document, WTFMove(style))
, m_column(unsetColumnIndex)
, m_cellWidthChanged(false)
, m_hasColSpan(false)
, m_hasRowSpan(false)
- , m_intrinsicPaddingBefore(0)
- , m_intrinsicPaddingAfter(0)
+ , m_hasEmptyCollapsedBeforeBorder(false)
+ , m_hasEmptyCollapsedAfterBorder(false)
+ , m_hasEmptyCollapsedStartBorder(false)
+ , m_hasEmptyCollapsedEndBorder(false)
{
}
void RenderTableCell::willBeRemovedFromTree()
{
RenderBlockFlow::willBeRemovedFromTree();
-
- section()->setNeedsCellRecalc();
- section()->removeCachedCollapsedBorders(this);
+ if (!table() || !section())
+ return;
+ RenderTableSection* section = this->section();
+ table()->invalidateCollapsedBorders();
+ section->setNeedsCellRecalc();
}
unsigned RenderTableCell::parseColSpanFromDOM() const
{
ASSERT(element());
- if (element()->hasTagName(tdTag) || element()->hasTagName(thTag))
- return std::min<unsigned>(toHTMLTableCellElement(element())->colSpan(), maxColumnIndex);
+ if (is<HTMLTableCellElement>(*element()))
+ return std::min<unsigned>(downcast<HTMLTableCellElement>(*element()).colSpan(), maxColumnIndex);
#if ENABLE(MATHML)
if (element()->hasTagName(MathMLNames::mtdTag))
- return std::min<unsigned>(toMathMLElement(element())->colSpan(), maxColumnIndex);
+ return std::min<unsigned>(downcast<MathMLElement>(*element()).colSpan(), maxColumnIndex);
#endif
return 1;
}
@@ -100,11 +108,11 @@ unsigned RenderTableCell::parseColSpanFromDOM() const
unsigned RenderTableCell::parseRowSpanFromDOM() const
{
ASSERT(element());
- if (element()->hasTagName(tdTag) || element()->hasTagName(thTag))
- return std::min<unsigned>(toHTMLTableCellElement(element())->rowSpan(), maxRowIndex);
+ if (is<HTMLTableCellElement>(*element()))
+ return std::min<unsigned>(downcast<HTMLTableCellElement>(*element()).rowSpan(), maxRowIndex);
#if ENABLE(MATHML)
if (element()->hasTagName(MathMLNames::mtdTag))
- return std::min<unsigned>(toMathMLElement(element())->rowSpan(), maxRowIndex);
+ return std::min<unsigned>(downcast<MathMLElement>(*element()).rowSpan(), maxRowIndex);
#endif
return 1;
}
@@ -141,7 +149,7 @@ Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisC
RenderTableCol* tableCol = firstColForThisCell;
unsigned colSpanCount = colSpan();
- int colWidthSum = 0;
+ LayoutUnit colWidthSum = 0;
for (unsigned i = 1; i <= colSpanCount; i++) {
Length colWidth = tableCol->style().logicalWidth();
@@ -163,7 +171,7 @@ Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisC
// Column widths specified on <col> apply to the border box of the cell, see bug 8126.
// FIXME: Why is border/padding ignored in the negative width case?
if (colWidthSum > 0)
- return Length(std::max(0, colWidthSum - borderAndPaddingLogicalWidth().ceil()), Fixed);
+ return Length(std::max<LayoutUnit>(0, colWidthSum - borderAndPaddingLogicalWidth()), Fixed);
return Length(colWidthSum, Fixed);
}
@@ -175,27 +183,27 @@ void RenderTableCell::computePreferredLogicalWidths()
table()->recalcSectionsIfNeeded();
RenderBlockFlow::computePreferredLogicalWidths();
- if (element() && style().autoWrap()) {
- // See if nowrap was set.
- Length w = styleOrColLogicalWidth();
- String nowrap = element()->getAttribute(nowrapAttr);
- if (!nowrap.isNull() && w.isFixed())
- // Nowrap is set, but we didn't actually use it because of the
- // fixed width set on the cell. Even so, it is a WinIE/Moz trait
- // to make the minwidth of the cell into the fixed width. They do this
- // even in strict mode, so do not make this a quirk. Affected the top
- // of hiptop.com.
- m_minPreferredLogicalWidth = std::max<LayoutUnit>(w.value(), m_minPreferredLogicalWidth);
+ if (!element() || !style().autoWrap() || !element()->hasAttributeWithoutSynchronization(nowrapAttr))
+ return;
+
+ Length w = styleOrColLogicalWidth();
+ if (w.isFixed()) {
+ // Nowrap is set, but we didn't actually use it because of the
+ // fixed width set on the cell. Even so, it is a WinIE/Moz trait
+ // to make the minwidth of the cell into the fixed width. They do this
+ // even in strict mode, so do not make this a quirk. Affected the top
+ // of hiptop.com.
+ m_minPreferredLogicalWidth = std::max<LayoutUnit>(w.value(), m_minPreferredLogicalWidth);
}
}
-void RenderTableCell::computeIntrinsicPadding(int rowHeight)
+void RenderTableCell::computeIntrinsicPadding(LayoutUnit rowHeight)
{
- int oldIntrinsicPaddingBefore = intrinsicPaddingBefore();
- int oldIntrinsicPaddingAfter = intrinsicPaddingAfter();
- int logicalHeightWithoutIntrinsicPadding = pixelSnappedLogicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
+ LayoutUnit oldIntrinsicPaddingBefore = intrinsicPaddingBefore();
+ LayoutUnit oldIntrinsicPaddingAfter = intrinsicPaddingAfter();
+ LayoutUnit logicalHeightWithoutIntrinsicPadding = logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
- int intrinsicPaddingBefore = 0;
+ LayoutUnit intrinsicPaddingBefore = 0;
switch (style().verticalAlign()) {
case SUB:
case SUPER:
@@ -220,7 +228,7 @@ void RenderTableCell::computeIntrinsicPadding(int rowHeight)
break;
}
- int intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore;
+ LayoutUnit intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore;
setIntrinsicPaddingBefore(intrinsicPaddingBefore);
setIntrinsicPaddingAfter(intrinsicPaddingAfter);
@@ -234,7 +242,7 @@ void RenderTableCell::updateLogicalWidth()
{
}
-void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth)
+void RenderTableCell::setCellLogicalWidth(LayoutUnit tableLayoutLogicalWidth)
{
if (tableLayoutLogicalWidth == logicalWidth())
return;
@@ -262,18 +270,18 @@ void RenderTableCell::layout()
// of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
// table and row layout can use the correct baseline and height for this cell.
if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselinePosition() > section()->rowBaseline(rowIndex())) {
- int newIntrinsicPaddingBefore = std::max<LayoutUnit>(0, intrinsicPaddingBefore() - std::max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline));
+ LayoutUnit newIntrinsicPaddingBefore = std::max<LayoutUnit>(0, intrinsicPaddingBefore() - std::max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline));
setIntrinsicPaddingBefore(newIntrinsicPaddingBefore);
setNeedsLayout(MarkOnlyThis);
layoutBlock(cellWidthChanged());
}
-
+ invalidateHasEmptyCollapsedBorders();
setCellWidthChanged(false);
}
LayoutUnit RenderTableCell::paddingTop() const
{
- int result = computedCSSPaddingTop();
+ LayoutUnit result = computedCSSPaddingTop();
if (!isHorizontalWritingMode())
return result;
return result + (style().writingMode() == TopToBottomWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
@@ -281,7 +289,7 @@ LayoutUnit RenderTableCell::paddingTop() const
LayoutUnit RenderTableCell::paddingBottom() const
{
- int result = computedCSSPaddingBottom();
+ LayoutUnit result = computedCSSPaddingBottom();
if (!isHorizontalWritingMode())
return result;
return result + (style().writingMode() == TopToBottomWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
@@ -289,7 +297,7 @@ LayoutUnit RenderTableCell::paddingBottom() const
LayoutUnit RenderTableCell::paddingLeft() const
{
- int result = computedCSSPaddingLeft();
+ LayoutUnit result = computedCSSPaddingLeft();
if (isHorizontalWritingMode())
return result;
return result + (style().writingMode() == LeftToRightWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
@@ -297,7 +305,7 @@ LayoutUnit RenderTableCell::paddingLeft() const
LayoutUnit RenderTableCell::paddingRight() const
{
- int result = computedCSSPaddingRight();
+ LayoutUnit result = computedCSSPaddingRight();
if (isHorizontalWritingMode())
return result;
return result + (style().writingMode() == LeftToRightWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
@@ -305,12 +313,12 @@ LayoutUnit RenderTableCell::paddingRight() const
LayoutUnit RenderTableCell::paddingBefore() const
{
- return static_cast<int>(computedCSSPaddingBefore()) + intrinsicPaddingBefore();
+ return computedCSSPaddingBefore() + intrinsicPaddingBefore();
}
LayoutUnit RenderTableCell::paddingAfter() const
{
- return static_cast<int>(computedCSSPaddingAfter()) + intrinsicPaddingAfter();
+ return computedCSSPaddingAfter() + intrinsicPaddingAfter();
}
void RenderTableCell::setOverrideLogicalContentHeightFromRowHeight(LayoutUnit rowHeight)
@@ -319,11 +327,11 @@ void RenderTableCell::setOverrideLogicalContentHeightFromRowHeight(LayoutUnit ro
setOverrideLogicalContentHeight(std::max<LayoutUnit>(0, rowHeight - borderAndPaddingLogicalHeight()));
}
-LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const
+LayoutSize RenderTableCell::offsetFromContainer(RenderElement& container, const LayoutPoint& point, bool* offsetDependsOnPoint) const
{
- ASSERT(o == container());
+ ASSERT(&container == this->container());
- LayoutSize offset = RenderBlockFlow::offsetFromContainer(o, point, offsetDependsOnPoint);
+ LayoutSize offset = RenderBlockFlow::offsetFromContainer(container, point, offsetDependsOnPoint);
if (parent())
offset -= parentBox()->locationOffset();
@@ -340,11 +348,11 @@ LayoutRect RenderTableCell::clippedOverflowRectForRepaint(const RenderLayerModel
return RenderBlockFlow::clippedOverflowRectForRepaint(repaintContainer);
bool rtl = !styleForCellFlow().isLeftToRightDirection();
- int outlineSize = style().outlineSize();
- int left = std::max(borderHalfLeft(true), outlineSize);
- int right = std::max(borderHalfRight(true), outlineSize);
- int top = std::max(borderHalfTop(true), outlineSize);
- int bottom = std::max(borderHalfBottom(true), outlineSize);
+ LayoutUnit outlineSize = style().outlineSize();
+ LayoutUnit left = std::max(borderHalfLeft(true), outlineSize);
+ LayoutUnit right = std::max(borderHalfRight(true), outlineSize);
+ LayoutUnit top = std::max(borderHalfTop(true), outlineSize);
+ LayoutUnit bottom = std::max(borderHalfBottom(true), outlineSize);
if ((left && !rtl) || (right && rtl)) {
if (RenderTableCell* before = table()->cellBefore(this)) {
top = std::max(top, before->borderHalfTop(true));
@@ -375,19 +383,17 @@ LayoutRect RenderTableCell::clippedOverflowRectForRepaint(const RenderLayerModel
// FIXME: layoutDelta needs to be applied in parts before/after transforms and
// repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
r.move(view().layoutDelta());
-
- computeRectForRepaint(repaintContainer, r);
- return r;
+ return computeRectForRepaint(r, repaintContainer);
}
-void RenderTableCell::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& r, bool fixed) const
+LayoutRect RenderTableCell::computeRectForRepaint(const LayoutRect& rect, const RenderLayerModelObject* repaintContainer, RepaintContext context) const
{
if (repaintContainer == this)
- return;
- r.setY(r.y());
+ return rect;
+ LayoutRect adjustedRect = rect;
if ((!view().layoutStateEnabled() || repaintContainer) && parent())
- r.moveBy(-parentBox()->location()); // Rows are in the same coordinate space, so don't add their offset in.
- RenderBlockFlow::computeRectForRepaint(repaintContainer, r, fixed);
+ adjustedRect.moveBy(-parentBox()->location()); // Rows are in the same coordinate space, so don't add their offset in.
+ return RenderBlockFlow::computeRectForRepaint(adjustedRect, repaintContainer, context);
}
LayoutUnit RenderTableCell::cellBaselinePosition() const
@@ -395,10 +401,14 @@ LayoutUnit RenderTableCell::cellBaselinePosition() const
// <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of
// the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
// is no such line box or table-row, the baseline is the bottom of content edge of the cell box.
- LayoutUnit baseline = firstLineBaseline();
- if (baseline != -1)
- return baseline;
- return borderAndPaddingBefore() + contentLogicalHeight();
+ return firstLineBaseline().value_or(borderAndPaddingBefore() + contentLogicalHeight());
+}
+
+static inline void markCellDirtyWhenCollapsedBorderChanges(RenderTableCell* cell)
+{
+ if (!cell)
+ return;
+ cell->setNeedsLayoutAndPrefWidthsRecalc();
}
void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
@@ -407,7 +417,7 @@ void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* ol
ASSERT(!row() || row()->rowIndexWasSet());
RenderBlockFlow::styleDidChange(diff, oldStyle);
- setHasBoxDecorations(true);
+ setHasVisibleBoxDecorations(true); // FIXME: Optimize this to only set to true if necessary.
if (parent() && section() && oldStyle && style().height() != oldStyle->height())
section()->rowLogicalHeightChanged(rowIndex());
@@ -418,10 +428,15 @@ void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* ol
clearIntrinsicPadding();
// If border was changed, notify table.
- if (parent()) {
- RenderTable* table = this->table();
- if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout()&& oldStyle && oldStyle->border() != style().border())
- table->invalidateCollapsedBorders();
+ RenderTable* table = this->table();
+ if (table && oldStyle && oldStyle->border() != style().border()) {
+ table->invalidateCollapsedBorders(this);
+ if (table->collapseBorders() && diff == StyleDifferenceLayout) {
+ markCellDirtyWhenCollapsedBorderChanges(table->cellBelow(this));
+ markCellDirtyWhenCollapsedBorderChanges(table->cellAbove(this));
+ markCellDirtyWhenCollapsedBorderChanges(table->cellBefore(this));
+ markCellDirtyWhenCollapsedBorderChanges(table->cellAfter(this));
+ }
}
}
@@ -491,7 +506,7 @@ bool RenderTableCell::hasStartBorderAdjoiningTable() const
{
bool isStartColumn = !col();
bool isEndColumn = table()->colToEffCol(col() + colSpan() - 1) == table()->numEffCols() - 1;
- bool hasSameDirectionAsTable = hasSameDirectionAs(section());
+ bool hasSameDirectionAsTable = isDirectionSame(this, section());
// The table direction determines the row direction. In mixed directionality, we cannot guarantee that
// we have a common border with the table (think a ltr table with rtl start cell).
@@ -502,35 +517,51 @@ bool RenderTableCell::hasEndBorderAdjoiningTable() const
{
bool isStartColumn = !col();
bool isEndColumn = table()->colToEffCol(col() + colSpan() - 1) == table()->numEffCols() - 1;
- bool hasSameDirectionAsTable = hasSameDirectionAs(section());
+ bool hasSameDirectionAsTable = isDirectionSame(this, section());
// The table direction determines the row direction. In mixed directionality, we cannot guarantee that
// we have a common border with the table (think a ltr table with ltr end cell).
return (isStartColumn && !hasSameDirectionAsTable) || (isEndColumn && hasSameDirectionAsTable);
}
+static CollapsedBorderValue emptyBorder()
+{
+ return CollapsedBorderValue(BorderValue(), Color(), BCELL);
+}
+
CollapsedBorderValue RenderTableCell::collapsedStartBorder(IncludeBorderColorOrNot includeColor) const
{
+ if (!table() || !section())
+ return emptyBorder();
+
+ if (m_hasEmptyCollapsedStartBorder)
+ return emptyBorder();
+
+ if (table()->collapsedBordersAreValid())
+ return section()->cachedCollapsedBorder(*this, CBSStart);
+
CollapsedBorderValue result = computeCollapsedStartBorder(includeColor);
- if (includeColor)
- section()->setCachedCollapsedBorder(this, CBSStart, result);
+ setHasEmptyCollapsedBorder(CBSStart, !result.width());
+ if (includeColor && !m_hasEmptyCollapsedStartBorder)
+ section()->setCachedCollapsedBorder(*this, CBSStart, result);
return result;
}
CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderColorOrNot includeColor) const
{
- RenderTable* table = this->table();
-
// For the start border, we need to check, in order of precedence:
// (1) Our start border.
int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CollapsedBorderValue result(style().borderStart(), includeColor ? style().visitedDependentColor(startColorProperty) : Color(), BCELL);
+ RenderTable* table = this->table();
+ if (!table)
+ return result;
// (2) The end border of the preceding cell.
RenderTableCell* cellBefore = table->cellBefore(this);
if (cellBefore) {
- CollapsedBorderValue cellBeforeAdjoiningBorder = CollapsedBorderValue(cellBefore->borderAdjoiningCellAfter(this), includeColor ? cellBefore->style().visitedDependentColor(endColorProperty) : Color(), BCELL);
+ CollapsedBorderValue cellBeforeAdjoiningBorder = CollapsedBorderValue(cellBefore->borderAdjoiningCellAfter(*this), includeColor ? cellBefore->style().visitedDependentColor(endColorProperty) : Color(), BCELL);
// |result| should be the 2nd argument as |cellBefore| should win in case of equality per CSS 2.1 (Border conflict resolution, point 4).
result = chooseBorder(cellBeforeAdjoiningBorder, result);
if (!result.exists())
@@ -540,12 +571,12 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
bool startBorderAdjoinsTable = hasStartBorderAdjoiningTable();
if (startBorderAdjoinsTable) {
// (3) Our row's start border.
- result = chooseBorder(result, CollapsedBorderValue(row()->borderAdjoiningStartCell(this), includeColor ? parent()->style().visitedDependentColor(startColorProperty) : Color(), BROW));
+ result = chooseBorder(result, CollapsedBorderValue(row()->borderAdjoiningStartCell(*this), includeColor ? parent()->style().visitedDependentColor(startColorProperty) : Color(), BROW));
if (!result.exists())
return result;
// (4) Our row group's start border.
- result = chooseBorder(result, CollapsedBorderValue(section()->borderAdjoiningStartCell(this), includeColor ? section()->style().visitedDependentColor(startColorProperty) : Color(), BROWGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(section()->borderAdjoiningStartCell(*this), includeColor ? section()->style().visitedDependentColor(startColorProperty) : Color(), BROWGROUP));
if (!result.exists())
return result;
}
@@ -556,19 +587,19 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
if (RenderTableCol* colElt = table->colElement(col(), &startColEdge, &endColEdge)) {
if (colElt->isTableColumnGroup() && startColEdge) {
// The |colElt| is a column group and is also the first colgroup (in case of spanned colgroups).
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellStartBorder(this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellStartBorder(), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
} else if (!colElt->isTableColumnGroup()) {
// We first consider the |colElt| and irrespective of whether it is a spanned col or not, we apply
// its start border. This is as per HTML5 which states that: "For the purposes of the CSS table model,
// the col element is expected to be treated as if it was present as many times as its span attribute specifies".
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellStartBorder(this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOL));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellStartBorder(), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOL));
if (!result.exists())
return result;
// Next, apply the start border of the enclosing colgroup but only if it is adjacent to the cell's edge.
if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentBefore()) {
- result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellStartBorder(this), includeColor ? enclosingColumnGroup->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellStartBorder(), includeColor ? enclosingColumnGroup->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
}
@@ -580,18 +611,18 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
if (RenderTableCol* colElt = table->colElement(col() - 1, &startColEdge, &endColEdge)) {
if (colElt->isTableColumnGroup() && endColEdge) {
// The element is a colgroup and is also the last colgroup (in case of spanned colgroups).
- result = chooseBorder(CollapsedBorderValue(colElt->borderAdjoiningCellAfter(this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP), result);
+ result = chooseBorder(CollapsedBorderValue(colElt->borderAdjoiningCellAfter(*this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP), result);
if (!result.exists())
return result;
} else if (colElt->isTableColumn()) {
// Resolve the collapsing border against the col's border ignoring any 'span' as per HTML5.
- result = chooseBorder(CollapsedBorderValue(colElt->borderAdjoiningCellAfter(this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOL), result);
+ result = chooseBorder(CollapsedBorderValue(colElt->borderAdjoiningCellAfter(*this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOL), result);
if (!result.exists())
return result;
// Next, if the previous col has a parent colgroup then its end border should be applied
// but only if it is adjacent to the cell's edge.
if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentAfter()) {
- result = chooseBorder(CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellEndBorder(this), includeColor ? enclosingColumnGroup->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP), result);
+ result = chooseBorder(CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellEndBorder(), includeColor ? enclosingColumnGroup->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP), result);
if (!result.exists())
return result;
}
@@ -601,7 +632,7 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
if (startBorderAdjoinsTable) {
// (7) The table's start border.
- result = chooseBorder(result, CollapsedBorderValue(table->tableStartBorderAdjoiningCell(this), includeColor ? table->style().visitedDependentColor(startColorProperty) : Color(), BTABLE));
+ result = chooseBorder(result, CollapsedBorderValue(table->tableStartBorderAdjoiningCell(*this), includeColor ? table->style().visitedDependentColor(startColorProperty) : Color(), BTABLE));
if (!result.exists())
return result;
}
@@ -611,29 +642,40 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
CollapsedBorderValue RenderTableCell::collapsedEndBorder(IncludeBorderColorOrNot includeColor) const
{
+ if (!table() || !section())
+ return emptyBorder();
+
+ if (m_hasEmptyCollapsedEndBorder)
+ return emptyBorder();
+
+ if (table()->collapsedBordersAreValid())
+ return section()->cachedCollapsedBorder(*this, CBSEnd);
+
CollapsedBorderValue result = computeCollapsedEndBorder(includeColor);
- if (includeColor)
- section()->setCachedCollapsedBorder(this, CBSEnd, result);
+ setHasEmptyCollapsedBorder(CBSEnd, !result.width());
+ if (includeColor && !m_hasEmptyCollapsedEndBorder)
+ section()->setCachedCollapsedBorder(*this, CBSEnd, result);
return result;
}
CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderColorOrNot includeColor) const
{
- RenderTable* table = this->table();
- // Note: We have to use the effective column information instead of whether we have a cell after as a table doesn't
- // have to be regular (any row can have less cells than the total cell count).
- bool isEndColumn = table->colToEffCol(col() + colSpan() - 1) == table->numEffCols() - 1;
-
// For end border, we need to check, in order of precedence:
// (1) Our end border.
int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CollapsedBorderValue result = CollapsedBorderValue(style().borderEnd(), includeColor ? style().visitedDependentColor(endColorProperty) : Color(), BCELL);
-
+
+ RenderTable* table = this->table();
+ if (!table)
+ return result;
+ // Note: We have to use the effective column information instead of whether we have a cell after as a table doesn't
+ // have to be regular (any row can have less cells than the total cell count).
+ bool isEndColumn = table->colToEffCol(col() + colSpan() - 1) == table->numEffCols() - 1;
// (2) The start border of the following cell.
if (!isEndColumn) {
if (RenderTableCell* cellAfter = table->cellAfter(this)) {
- CollapsedBorderValue cellAfterAdjoiningBorder = CollapsedBorderValue(cellAfter->borderAdjoiningCellBefore(this), includeColor ? cellAfter->style().visitedDependentColor(startColorProperty) : Color(), BCELL);
+ CollapsedBorderValue cellAfterAdjoiningBorder = CollapsedBorderValue(cellAfter->borderAdjoiningCellBefore(*this), includeColor ? cellAfter->style().visitedDependentColor(startColorProperty) : Color(), BCELL);
result = chooseBorder(result, cellAfterAdjoiningBorder);
if (!result.exists())
return result;
@@ -643,12 +685,12 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
bool endBorderAdjoinsTable = hasEndBorderAdjoiningTable();
if (endBorderAdjoinsTable) {
// (3) Our row's end border.
- result = chooseBorder(result, CollapsedBorderValue(row()->borderAdjoiningEndCell(this), includeColor ? parent()->style().visitedDependentColor(endColorProperty) : Color(), BROW));
+ result = chooseBorder(result, CollapsedBorderValue(row()->borderAdjoiningEndCell(*this), includeColor ? parent()->style().visitedDependentColor(endColorProperty) : Color(), BROW));
if (!result.exists())
return result;
// (4) Our row group's end border.
- result = chooseBorder(result, CollapsedBorderValue(section()->borderAdjoiningEndCell(this), includeColor ? section()->style().visitedDependentColor(endColorProperty) : Color(), BROWGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(section()->borderAdjoiningEndCell(*this), includeColor ? section()->style().visitedDependentColor(endColorProperty) : Color(), BROWGROUP));
if (!result.exists())
return result;
}
@@ -659,19 +701,19 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
if (RenderTableCol* colElt = table->colElement(col() + colSpan() - 1, &startColEdge, &endColEdge)) {
if (colElt->isTableColumnGroup() && endColEdge) {
// The element is a colgroup and is also the last colgroup (in case of spanned colgroups).
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellEndBorder(this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellEndBorder(), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
} else if (!colElt->isTableColumnGroup()) {
// First apply the end border of the column irrespective of whether it is spanned or not. This is as per
// HTML5 which states that: "For the purposes of the CSS table model, the col element is expected to be
// treated as if it was present as many times as its span attribute specifies".
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellEndBorder(this), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOL));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellEndBorder(), includeColor ? colElt->style().visitedDependentColor(endColorProperty) : Color(), BCOL));
if (!result.exists())
return result;
// Next, if it has a parent colgroup then we apply its end border but only if it is adjacent to the cell.
if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentAfter()) {
- result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellEndBorder(this), includeColor ? enclosingColumnGroup->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellEndBorder(), includeColor ? enclosingColumnGroup->style().visitedDependentColor(endColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
}
@@ -683,17 +725,17 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
if (RenderTableCol* colElt = table->colElement(col() + colSpan(), &startColEdge, &endColEdge)) {
if (colElt->isTableColumnGroup() && startColEdge) {
// This case is a colgroup without any col, we only compute it if it is adjacent to the cell's edge.
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellBefore(this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellBefore(*this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
} else if (colElt->isTableColumn()) {
// Resolve the collapsing border against the col's border ignoring any 'span' as per HTML5.
- result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellBefore(this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOL));
+ result = chooseBorder(result, CollapsedBorderValue(colElt->borderAdjoiningCellBefore(*this), includeColor ? colElt->style().visitedDependentColor(startColorProperty) : Color(), BCOL));
if (!result.exists())
return result;
// If we have a parent colgroup, resolve the border only if it is adjacent to the cell.
if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentBefore()) {
- result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellStartBorder(this), includeColor ? enclosingColumnGroup->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->borderAdjoiningCellStartBorder(), includeColor ? enclosingColumnGroup->style().visitedDependentColor(startColorProperty) : Color(), BCOLGROUP));
if (!result.exists())
return result;
}
@@ -703,7 +745,7 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
if (endBorderAdjoinsTable) {
// (7) The table's end border.
- result = chooseBorder(result, CollapsedBorderValue(table->tableEndBorderAdjoiningCell(this), includeColor ? table->style().visitedDependentColor(endColorProperty) : Color(), BTABLE));
+ result = chooseBorder(result, CollapsedBorderValue(table->tableEndBorderAdjoiningCell(*this), includeColor ? table->style().visitedDependentColor(endColorProperty) : Color(), BTABLE));
if (!result.exists())
return result;
}
@@ -713,22 +755,33 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
CollapsedBorderValue RenderTableCell::collapsedBeforeBorder(IncludeBorderColorOrNot includeColor) const
{
+ if (!table() || !section())
+ return emptyBorder();
+
+ if (m_hasEmptyCollapsedBeforeBorder)
+ return emptyBorder();
+
+ if (table()->collapsedBordersAreValid())
+ return section()->cachedCollapsedBorder(*this, CBSBefore);
+
CollapsedBorderValue result = computeCollapsedBeforeBorder(includeColor);
- if (includeColor)
- section()->setCachedCollapsedBorder(this, CBSBefore, result);
+ setHasEmptyCollapsedBorder(CBSBefore, !result.width());
+ if (includeColor && !m_hasEmptyCollapsedBeforeBorder)
+ 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:
// (1) Our before border.
int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CollapsedBorderValue result = CollapsedBorderValue(style().borderBefore(), includeColor ? style().visitedDependentColor(beforeColorProperty) : Color(), BCELL);
+ RenderTable* table = this->table();
+ if (!table)
+ return result;
RenderTableCell* prevCell = table->cellAbove(this);
if (prevCell) {
// (2) A before cell's after border.
@@ -799,22 +852,33 @@ CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorder
CollapsedBorderValue RenderTableCell::collapsedAfterBorder(IncludeBorderColorOrNot includeColor) const
{
+ if (!table() || !section())
+ return emptyBorder();
+
+ if (m_hasEmptyCollapsedAfterBorder)
+ return emptyBorder();
+
+ if (table()->collapsedBordersAreValid())
+ return section()->cachedCollapsedBorder(*this, CBSAfter);
+
CollapsedBorderValue result = computeCollapsedAfterBorder(includeColor);
- if (includeColor)
- section()->setCachedCollapsedBorder(this, CBSAfter, result);
+ setHasEmptyCollapsedBorder(CBSAfter, !result.width());
+ if (includeColor && !m_hasEmptyCollapsedAfterBorder)
+ 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:
// (1) Our after border.
int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CollapsedBorderValue result = CollapsedBorderValue(style().borderAfter(), includeColor ? style().visitedDependentColor(afterColorProperty) : Color(), BCELL);
+ RenderTable* table = this->table();
+ if (!table)
+ return result;
RenderTableCell* nextCell = table->cellBelow(this);
if (nextCell) {
// (2) An after cell's before border.
@@ -874,105 +938,101 @@ CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderC
return result;
}
-inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle* styleForCellFlow) const
-{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd);
- return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore);
-}
-
-inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle* styleForCellFlow) const
-{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
- return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter);
-}
-
-inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle* styleForCellFlow) const
-{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore);
- return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd);
-}
-
-inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle* styleForCellFlow) const
-{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter);
- return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
-}
-
-inline RenderTableCell* RenderTableCell::cellAtLeft(const RenderStyle* styleForCellFlow) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle& styleForCellFlow) const
{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this);
- return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this);
+ if (styleForCellFlow.isHorizontalWritingMode())
+ return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSStart) : section()->cachedCollapsedBorder(*this, CBSEnd);
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSAfter) : section()->cachedCollapsedBorder(*this, CBSBefore);
}
-inline RenderTableCell* RenderTableCell::cellAtRight(const RenderStyle* styleForCellFlow) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle& styleForCellFlow) const
{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this);
- return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this);
+ if (styleForCellFlow.isHorizontalWritingMode())
+ return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSEnd) : section()->cachedCollapsedBorder(*this, CBSStart);
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSBefore) : section()->cachedCollapsedBorder(*this, CBSAfter);
}
-inline RenderTableCell* RenderTableCell::cellAtTop(const RenderStyle* styleForCellFlow) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle& styleForCellFlow) const
{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this);
- return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this);
+ if (styleForCellFlow.isHorizontalWritingMode())
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSAfter) : section()->cachedCollapsedBorder(*this, CBSBefore);
+ return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSStart) : section()->cachedCollapsedBorder(*this, CBSEnd);
}
-inline RenderTableCell* RenderTableCell::cellAtBottom(const RenderStyle* styleForCellFlow) const
+inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle& styleForCellFlow) const
{
- if (styleForCellFlow->isHorizontalWritingMode())
- return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this);
- return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this);
+ if (styleForCellFlow.isHorizontalWritingMode())
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSBefore) : section()->cachedCollapsedBorder(*this, CBSAfter);
+ return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSEnd) : section()->cachedCollapsedBorder(*this, CBSStart);
}
-int RenderTableCell::borderLeft() const
+LayoutUnit RenderTableCell::borderLeft() const
{
- return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlockFlow::borderLeft();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderLeft();
+ return table->collapseBorders() ? borderHalfLeft(false) : RenderBlockFlow::borderLeft();
}
-int RenderTableCell::borderRight() const
+LayoutUnit RenderTableCell::borderRight() const
{
- return table()->collapseBorders() ? borderHalfRight(false) : RenderBlockFlow::borderRight();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderRight();
+ return table->collapseBorders() ? borderHalfRight(false) : RenderBlockFlow::borderRight();
}
-int RenderTableCell::borderTop() const
+LayoutUnit RenderTableCell::borderTop() const
{
- return table()->collapseBorders() ? borderHalfTop(false) : RenderBlockFlow::borderTop();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderTop();
+ return table->collapseBorders() ? borderHalfTop(false) : RenderBlockFlow::borderTop();
}
-int RenderTableCell::borderBottom() const
+LayoutUnit RenderTableCell::borderBottom() const
{
- return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlockFlow::borderBottom();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderBottom();
+ return table->collapseBorders() ? borderHalfBottom(false) : RenderBlockFlow::borderBottom();
}
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed border drawing
// work with different block flow values instead of being hard-coded to top-to-bottom.
-int RenderTableCell::borderStart() const
+LayoutUnit RenderTableCell::borderStart() const
{
- return table()->collapseBorders() ? borderHalfStart(false) : RenderBlockFlow::borderStart();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderStart();
+ return table->collapseBorders() ? borderHalfStart(false) : RenderBlockFlow::borderStart();
}
-int RenderTableCell::borderEnd() const
+LayoutUnit RenderTableCell::borderEnd() const
{
- return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlockFlow::borderEnd();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderEnd();
+ return table->collapseBorders() ? borderHalfEnd(false) : RenderBlockFlow::borderEnd();
}
-int RenderTableCell::borderBefore() const
+LayoutUnit RenderTableCell::borderBefore() const
{
- return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlockFlow::borderBefore();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderBefore();
+ return table->collapseBorders() ? borderHalfBefore(false) : RenderBlockFlow::borderBefore();
}
-int RenderTableCell::borderAfter() const
+LayoutUnit RenderTableCell::borderAfter() const
{
- return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlockFlow::borderAfter();
+ RenderTable* table = this->table();
+ if (!table)
+ return RenderBlockFlow::borderAfter();
+ return table->collapseBorders() ? borderHalfAfter(false) : RenderBlockFlow::borderAfter();
}
-int RenderTableCell::borderHalfLeft(bool outer) const
+LayoutUnit RenderTableCell::borderHalfLeft(bool outer) const
{
const RenderStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
@@ -980,7 +1040,7 @@ int RenderTableCell::borderHalfLeft(bool outer) const
return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer);
}
-int RenderTableCell::borderHalfRight(bool outer) const
+LayoutUnit RenderTableCell::borderHalfRight(bool outer) const
{
const RenderStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
@@ -988,7 +1048,7 @@ int RenderTableCell::borderHalfRight(bool outer) const
return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer);
}
-int RenderTableCell::borderHalfTop(bool outer) const
+LayoutUnit RenderTableCell::borderHalfTop(bool outer) const
{
const RenderStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
@@ -996,7 +1056,7 @@ int RenderTableCell::borderHalfTop(bool outer) const
return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer);
}
-int RenderTableCell::borderHalfBottom(bool outer) const
+LayoutUnit RenderTableCell::borderHalfBottom(bool outer) const
{
const RenderStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
@@ -1004,35 +1064,35 @@ int RenderTableCell::borderHalfBottom(bool outer) const
return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer);
}
-int RenderTableCell::borderHalfStart(bool outer) const
+LayoutUnit RenderTableCell::borderHalfStart(bool outer) const
{
CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor);
if (border.exists())
- return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left.
+ return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), styleForCellFlow().isLeftToRightDirection() ^ outer);
return 0;
}
-int RenderTableCell::borderHalfEnd(bool outer) const
+LayoutUnit RenderTableCell::borderHalfEnd(bool outer) const
{
CollapsedBorderValue border = collapsedEndBorder(DoNotIncludeBorderColor);
if (border.exists())
- return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2;
+ return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), !(styleForCellFlow().isLeftToRightDirection() ^ outer));
return 0;
}
-int RenderTableCell::borderHalfBefore(bool outer) const
+LayoutUnit RenderTableCell::borderHalfBefore(bool outer) const
{
CollapsedBorderValue border = collapsedBeforeBorder(DoNotIncludeBorderColor);
if (border.exists())
- return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left.
+ return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), !(styleForCellFlow().isFlippedBlocksWritingMode() ^ outer));
return 0;
}
-int RenderTableCell::borderHalfAfter(bool outer) const
+LayoutUnit RenderTableCell::borderHalfAfter(bool outer) const
{
CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor);
if (border.exists())
- return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2;
+ return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), styleForCellFlow().isFlippedBlocksWritingMode() ^ outer);
return 0;
}
@@ -1042,23 +1102,14 @@ void RenderTableCell::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset
RenderBlockFlow::paint(paintInfo, paintOffset);
}
-static EBorderStyle collapsedBorderStyle(EBorderStyle style)
-{
- if (style == OUTSET)
- return GROOVE;
- if (style == INSET)
- return RIDGE;
- return style;
-}
-
struct CollapsedBorder {
CollapsedBorderValue borderValue;
BoxSide side;
bool shouldPaint;
- int x1;
- int y1;
- int x2;
- int y2;
+ LayoutUnit x1;
+ LayoutUnit y1;
+ LayoutUnit x2;
+ LayoutUnit y2;
EBorderStyle style;
};
@@ -1070,7 +1121,7 @@ public:
}
void addBorder(const CollapsedBorderValue& borderValue, BoxSide borderSide, bool shouldPaint,
- int x1, int y1, int x2, int y2, EBorderStyle borderStyle)
+ LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2, EBorderStyle borderStyle)
{
if (borderValue.exists() && shouldPaint) {
m_borders[m_count].borderValue = borderValue;
@@ -1136,31 +1187,6 @@ void RenderTableCell::sortBorderValues(RenderTable::CollapsedBorderValues& borde
compareBorderValuesForQSort);
}
-bool RenderTableCell::alignLeftRightBorderPaintRect(int& leftXOffset, int& rightXOffset)
-{
- const RenderStyle& styleForTopCell = styleForCellFlow();
- int left = cachedCollapsedLeftBorder(&styleForTopCell).width();
- int right = cachedCollapsedRightBorder(&styleForTopCell).width();
- leftXOffset = std::max<int>(leftXOffset, left);
- rightXOffset = std::max<int>(rightXOffset, right);
- if (colSpan() > 1)
- return false;
- return true;
-}
-
-bool RenderTableCell::alignTopBottomBorderPaintRect(int& topYOffset, int& bottomYOffset)
-{
- const RenderStyle& styleForBottomCell = styleForCellFlow();
- int top = cachedCollapsedTopBorder(&styleForBottomCell).width();
- int bottom = cachedCollapsedBottomBorder(&styleForBottomCell).width();
- topYOffset = std::max<int>(topYOffset, top);
- bottomYOffset = std::max<int>(bottomYOffset, bottom);
- if (rowSpan() > 1)
- return false;
- return true;
-}
-
-
void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ASSERT(paintInfo.phase == PaintPhaseCollapsedTableBorders);
@@ -1169,106 +1195,63 @@ void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo
return;
LayoutRect localRepaintRect = paintInfo.rect;
- localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
-
- LayoutRect paintRect = LayoutRect(paintOffset + location(), pixelSnappedSize());
+ LayoutRect paintRect = LayoutRect(paintOffset + location(), frameRect().size());
if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY())
return;
if (paintRect.maxY() + table()->outerBorderBottom() <= localRepaintRect.y())
return;
- GraphicsContext* graphicsContext = paintInfo.context;
- if (!table()->currentBorderValue() || graphicsContext->paintingDisabled())
+ GraphicsContext& graphicsContext = paintInfo.context();
+ if (!table()->currentBorderValue() || graphicsContext.paintingDisabled())
return;
const RenderStyle& styleForCellFlow = this->styleForCellFlow();
- CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(&styleForCellFlow);
- CollapsedBorderValue rightVal = cachedCollapsedRightBorder(&styleForCellFlow);
- CollapsedBorderValue topVal = cachedCollapsedTopBorder(&styleForCellFlow);
- CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(&styleForCellFlow);
+ CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow);
+ CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow);
+ CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow);
+ CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlow);
// Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
- int topWidth = topVal.width();
- int bottomWidth = bottomVal.width();
- int leftWidth = leftVal.width();
- int rightWidth = rightVal.width();
-
- int leftXOffsetTop = leftWidth;
- int leftXOffsetBottom = leftWidth;
- int rightXOffsetTop = rightWidth;
- int rightXOffsetBottom = rightWidth;
- int topYOffsetLeft = topWidth;
- int topYOffsetRight = topWidth;
- int bottomYOffsetLeft = bottomWidth;
- int bottomYOffsetRight = bottomWidth;
-
- // We use the direction/writing-mode given by the section here because we want to know if we're
- // at the section's edge.
- bool shouldDrawTopBorder = !cellAtTop(&section()->style());
- bool shouldDrawLeftBorder = !cellAtLeft(&section()->style());
- bool shouldDrawRightBorder = true;
-
- if (RenderTableCell* top = cellAtTop(&styleForCellFlow)) {
- shouldDrawTopBorder = shouldDrawTopBorder && top->alignLeftRightBorderPaintRect(leftXOffsetTop, rightXOffsetTop);
- if (this->colSpan() > 1)
- shouldDrawTopBorder = false;
- }
-
- if (RenderTableCell* bottom = cellAtBottom(&styleForCellFlow))
- bottom->alignLeftRightBorderPaintRect(leftXOffsetBottom, rightXOffsetBottom);
-
- if (RenderTableCell* left = cellAtLeft(&styleForCellFlow))
- shouldDrawLeftBorder = shouldDrawLeftBorder && left->alignTopBottomBorderPaintRect(topYOffsetLeft, bottomYOffsetLeft);
-
- if (RenderTableCell* right = cellAtRight(&styleForCellFlow))
- shouldDrawRightBorder = right->alignTopBottomBorderPaintRect(topYOffsetRight, bottomYOffsetRight);
-
- IntRect cellRect = pixelSnappedIntRect(paintRect.x(), paintRect.y(), paintRect.width(), paintRect.height());
-
- IntRect borderRect = pixelSnappedIntRect(paintRect.x() - leftWidth / 2,
- paintRect.y() - topWidth / 2,
- paintRect.width() + leftWidth / 2 + (rightWidth + 1) / 2,
- paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
+ LayoutUnit topWidth = topVal.width();
+ LayoutUnit bottomWidth = bottomVal.width();
+ LayoutUnit leftWidth = leftVal.width();
+ LayoutUnit rightWidth = rightVal.width();
+
+ float deviceScaleFactor = document().deviceScaleFactor();
+ LayoutUnit leftHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(leftWidth , deviceScaleFactor, false);
+ LayoutUnit topHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(topWidth, deviceScaleFactor, false);
+ LayoutUnit righHalftCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(rightWidth, deviceScaleFactor, true);
+ LayoutUnit bottomHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(bottomWidth, deviceScaleFactor, true);
+
+ LayoutRect borderRect = LayoutRect(paintRect.x() - leftHalfCollapsedBorder,
+ paintRect.y() - topHalfCollapsedBorder,
+ paintRect.width() + leftHalfCollapsedBorder + righHalftCollapsedBorder,
+ paintRect.height() + topHalfCollapsedBorder + bottomHalfCollapsedBorder);
EBorderStyle topStyle = collapsedBorderStyle(topVal.style());
EBorderStyle bottomStyle = collapsedBorderStyle(bottomVal.style());
EBorderStyle leftStyle = collapsedBorderStyle(leftVal.style());
EBorderStyle rightStyle = collapsedBorderStyle(rightVal.style());
- bool renderTop = topStyle > BHIDDEN && !topVal.isTransparent() && shouldDrawTopBorder;
- bool renderBottom = bottomStyle > BHIDDEN && !bottomVal.isTransparent();
- bool renderLeft = leftStyle > BHIDDEN && !leftVal.isTransparent() && shouldDrawLeftBorder;
- bool renderRight = rightStyle > BHIDDEN && !rightVal.isTransparent() && shouldDrawRightBorder;
+ bool renderTop = topStyle > BHIDDEN && !topVal.isTransparent() && floorToDevicePixel(topWidth, deviceScaleFactor);
+ bool renderBottom = bottomStyle > BHIDDEN && !bottomVal.isTransparent() && floorToDevicePixel(bottomWidth, deviceScaleFactor);
+ bool renderLeft = leftStyle > BHIDDEN && !leftVal.isTransparent() && floorToDevicePixel(leftWidth, deviceScaleFactor);
+ bool renderRight = rightStyle > BHIDDEN && !rightVal.isTransparent() && floorToDevicePixel(rightWidth, deviceScaleFactor);
// We never paint diagonals at the joins. We simply let the border with the highest
// precedence paint on top of borders with lower precedence.
CollapsedBorders borders;
- if (topVal.style() == DOTTED)
- borders.addBorder(topVal, BSTop, renderTop, cellRect.x() - leftXOffsetTop / 2, cellRect.y() - topWidth / 2, cellRect.maxX() + rightXOffsetTop / 2, cellRect.y() + topWidth / 2 + topWidth % 2, topStyle);
- else
- borders.addBorder(topVal, BSTop, renderTop, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, topStyle);
-
- if (bottomVal.style() == DOTTED)
- borders.addBorder(bottomVal, BSBottom, renderBottom, cellRect.x() - leftXOffsetBottom / 2, cellRect.maxY() - bottomWidth / 2, cellRect.maxX() + rightXOffsetBottom / 2, cellRect.maxY() + bottomWidth / 2 + bottomWidth % 2, bottomStyle);
- else
- borders.addBorder(bottomVal, BSBottom, renderBottom, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), bottomStyle);
-
- if (leftVal.style() == DOTTED)
- borders.addBorder(leftVal, BSLeft, renderLeft, cellRect.x() - leftWidth / 2, cellRect.y() - topYOffsetLeft / 2, cellRect.x() + leftWidth / 2 + leftWidth % 2, cellRect.maxY() + bottomYOffsetLeft / 2 + bottomYOffsetLeft % 2, leftStyle);
- else
- borders.addBorder(leftVal, BSLeft, renderLeft, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), leftStyle);
-
- if (rightVal.style() == DOTTED)
- borders.addBorder(rightVal, BSRight, renderRight, cellRect.maxX() - rightWidth / 2, cellRect.y() - topYOffsetRight / 2, cellRect.maxX() + rightWidth / 2 + rightWidth % 2, cellRect.maxY() + bottomYOffsetRight / 2 + bottomYOffsetRight % 2, rightStyle);
- else
- borders.addBorder(rightVal, BSRight, renderRight, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), rightStyle);
+ borders.addBorder(topVal, BSTop, renderTop, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, topStyle);
+ borders.addBorder(bottomVal, BSBottom, renderBottom, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), bottomStyle);
+ borders.addBorder(leftVal, BSLeft, renderLeft, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), leftStyle);
+ borders.addBorder(rightVal, BSRight, renderRight, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), rightStyle);
bool antialias = shouldAntialiasLines(graphicsContext);
for (CollapsedBorder* border = borders.nextBorder(); border; border = borders.nextBorder()) {
if (border->borderValue.isSameIgnoringColor(*table()->currentBorderValue()))
- drawLineForBoxSide(graphicsContext, border->x1, border->y1, border->x2, border->y2, border->side,
+ drawLineForBoxSide(graphicsContext, LayoutRect(LayoutPoint(border->x1, border->y1), LayoutPoint(border->x2, border->y2)), border->side,
border->borderValue.color(), border->style, 0, 0, antialias);
}
}
@@ -1293,19 +1276,19 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const Lay
adjustedPaintOffset.moveBy(location());
Color c = backgroundObject->style().visitedDependentColor(CSSPropertyBackgroundColor);
- const FillLayer* bgLayer = backgroundObject->style().backgroundLayers();
+ auto& bgLayer = backgroundObject->style().backgroundLayers();
- if (bgLayer->hasImage() || c.isValid()) {
+ if (bgLayer.hasImage() || c.isValid()) {
// We have to clip here because the background would paint
// on top of the borders otherwise. This only matters for cells and rows.
bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == this || backgroundObject == parent()) && tableElt->collapseBorders();
- GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
+ GraphicsContextStateSaver stateSaver(paintInfo.context(), shouldClip);
if (shouldClip) {
LayoutRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjustedPaintOffset.y() + borderTop(),
width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
- paintInfo.context->clip(clipRect);
+ paintInfo.context().clip(clipRect);
}
- paintFillLayers(paintInfo, c, bgLayer, LayoutRect(adjustedPaintOffset, pixelSnappedSize()), BackgroundBleedNone, CompositeSourceOver, backgroundObject);
+ paintFillLayers(paintInfo, c, bgLayer, LayoutRect(adjustedPaintOffset, frameRect().size()), BackgroundBleedNone, CompositeSourceOver, backgroundObject);
}
}
@@ -1314,22 +1297,22 @@ void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoin
if (!paintInfo.shouldPaintWithinRoot(*this))
return;
- RenderTable* tableElt = table();
- if (!tableElt->collapseBorders() && style().emptyCells() == HIDE && !firstChild())
+ RenderTable* table = this->table();
+ if (!table->collapseBorders() && style().emptyCells() == HIDE && !firstChild())
return;
- LayoutRect paintRect = LayoutRect(paintOffset, pixelSnappedSize());
- paintBoxShadow(paintInfo, paintRect, &style(), Normal);
+ LayoutRect paintRect = LayoutRect(paintOffset, frameRect().size());
+ paintBoxShadow(paintInfo, paintRect, style(), Normal);
// Paint our cell background.
paintBackgroundsBehindCell(paintInfo, paintOffset, this);
- paintBoxShadow(paintInfo, paintRect, &style(), Inset);
+ paintBoxShadow(paintInfo, paintRect, style(), Inset);
- if (!style().hasBorder() || tableElt->collapseBorders())
+ if (!style().hasBorder() || table->collapseBorders())
return;
- paintBorder(paintInfo, paintRect, &style());
+ paintBorder(paintInfo, paintRect, style());
}
void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -1341,10 +1324,10 @@ void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOf
if (!tableElt->collapseBorders() && style().emptyCells() == HIDE && !firstChild())
return;
- paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnappedSize()));
+ paintMaskImages(paintInfo, LayoutRect(paintOffset, frameRect().size()));
}
-bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const
+bool RenderTableCell::boxShadowShouldBeAppliedToBackground(const LayoutPoint&, BackgroundBleedAvoidance, InlineFlowBox*) const
{
return false;
}
@@ -1373,11 +1356,16 @@ void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve
setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight);
}
-RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const RenderObject* parent)
+std::unique_ptr<RenderTableCell> RenderTableCell::createTableCellWithStyle(Document& document, const RenderStyle& style)
{
- auto cell = new RenderTableCell(parent->document(), RenderStyle::createAnonymousStyleWithDisplay(&parent->style(), TABLE_CELL));
+ auto cell = std::make_unique<RenderTableCell>(document, RenderStyle::createAnonymousStyleWithDisplay(style, TABLE_CELL));
cell->initializeStyle();
return cell;
}
+std::unique_ptr<RenderTableCell> RenderTableCell::createAnonymousWithParentRenderer(const RenderTableRow& parent)
+{
+ return RenderTableCell::createTableCellWithStyle(parent.document(), parent.style());
+}
+
} // namespace WebCore