summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp
index 9737da43de8..5cf8270ad12 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp
@@ -25,10 +25,9 @@
#include "config.h"
#include "core/rendering/RenderTableCell.h"
-#include "HTMLNames.h"
+#include "core/HTMLNames.h"
#include "core/css/StylePropertySet.h"
#include "core/html/HTMLTableCellElement.h"
-#include "core/rendering/LayoutRectRecorder.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderTableCol.h"
#include "core/rendering/RenderView.h"
@@ -66,7 +65,7 @@ RenderTableCell::RenderTableCell(Element* element)
void RenderTableCell::willBeRemovedFromTree()
{
- RenderBlock::willBeRemovedFromTree();
+ RenderBlockFlow::willBeRemovedFromTree();
section()->setNeedsCellRecalc();
section()->removeCachedCollapsedBorders(this);
@@ -75,16 +74,16 @@ void RenderTableCell::willBeRemovedFromTree()
unsigned RenderTableCell::parseColSpanFromDOM() const
{
ASSERT(node());
- if (node()->hasTagName(tdTag) || node()->hasTagName(thTag))
- return min<unsigned>(toHTMLTableCellElement(node())->colSpan(), maxColumnIndex);
+ if (isHTMLTableCellElement(*node()))
+ return min<unsigned>(toHTMLTableCellElement(*node()).colSpan(), maxColumnIndex);
return 1;
}
unsigned RenderTableCell::parseRowSpanFromDOM() const
{
ASSERT(node());
- if (node()->hasTagName(tdTag) || node()->hasTagName(thTag))
- return min<unsigned>(toHTMLTableCellElement(node())->rowSpan(), maxRowIndex);
+ if (isHTMLTableCellElement(*node()))
+ return min<unsigned>(toHTMLTableCellElement(*node()).rowSpan(), maxRowIndex);
return 1;
}
@@ -99,13 +98,13 @@ void RenderTableCell::updateColAndRowSpanFlags()
void RenderTableCell::colSpanOrRowSpanChanged()
{
ASSERT(node());
- ASSERT(node()->hasTagName(tdTag) || node()->hasTagName(thTag));
+ ASSERT(isHTMLTableCellElement(*node()));
updateColAndRowSpanFlags();
// FIXME: I suspect that we could return early here if !m_hasColSpan && !m_hasRowSpan.
- setNeedsLayoutAndPrefWidthsRecalc();
+ setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
if (parent() && section())
section()->setNeedsCellRecalc();
}
@@ -149,7 +148,7 @@ void RenderTableCell::computePreferredLogicalWidths()
// grids. We must refresh those grids before the child cells try to use them.
table()->recalcSectionsIfNeeded();
- RenderBlock::computePreferredLogicalWidths();
+ RenderBlockFlow::computePreferredLogicalWidths();
if (node() && style()->autoWrap()) {
// See if nowrap was set.
Length w = styleOrColLogicalWidth();
@@ -226,8 +225,8 @@ void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLa
layouter.setNeedsLayout(this);
- if (!table()->selfNeedsLayout() && checkForRepaintDuringLayout())
- repaint();
+ if (!table()->selfNeedsLayout() && checkForPaintInvalidationDuringLayout())
+ paintInvalidationForWholeRenderer();
setLogicalWidth(tableLayoutLogicalWidth);
setCellWidthChanged(true);
@@ -237,8 +236,6 @@ void RenderTableCell::layout()
{
ASSERT(needsLayout());
- LayoutRectRecorder recorder(*this);
-
updateFirstLetter();
int oldCellBaseline = cellBaselinePosition();
@@ -251,11 +248,15 @@ void RenderTableCell::layout()
if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselinePosition() > section()->rowBaseline(rowIndex())) {
int newIntrinsicPaddingBefore = max<LayoutUnit>(0, intrinsicPaddingBefore() - max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline));
setIntrinsicPaddingBefore(newIntrinsicPaddingBefore);
- SubtreeLayoutScope layouter(this);
+ SubtreeLayoutScope layouter(*this);
layouter.setNeedsLayout(this);
layoutBlock(cellWidthChanged());
}
+ // FIXME: This value isn't the intrinsic content logical height, but we need
+ // to update the value as its used by flexbox layout. crbug.com/367324
+ updateIntrinsicContentLogicalHeight(contentLogicalHeight());
+
setCellWidthChanged(false);
}
@@ -307,25 +308,25 @@ void RenderTableCell::setOverrideLogicalContentHeightFromRowHeight(LayoutUnit ro
setOverrideLogicalContentHeight(max<LayoutUnit>(0, rowHeight - borderAndPaddingLogicalHeight()));
}
-LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const
+LayoutSize RenderTableCell::offsetFromContainer(const RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const
{
ASSERT(o == container());
- LayoutSize offset = RenderBlock::offsetFromContainer(o, point, offsetDependsOnPoint);
+ LayoutSize offset = RenderBlockFlow::offsetFromContainer(o, point, offsetDependsOnPoint);
if (parent())
offset -= parentBox()->locationOffset();
return offset;
}
-LayoutRect RenderTableCell::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
+LayoutRect RenderTableCell::clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer) const
{
// If the table grid is dirty, we cannot get reliable information about adjoining cells,
// so we ignore outside borders. This should not be a problem because it means that
// the table is going to recalculate the grid, relayout and repaint its current rect, which
// includes any outside borders of this cell.
if (!table()->collapseBorders() || table()->needsSectionRecalc())
- return RenderBlock::clippedOverflowRectForRepaint(repaintContainer);
+ return RenderBlockFlow::clippedOverflowRectForPaintInvalidation(paintInvalidationContainer);
bool rtl = !styleForCellFlow()->isLeftToRightDirection();
int outlineSize = style()->outlineSize();
@@ -360,24 +361,26 @@ LayoutRect RenderTableCell::clippedOverflowRectForRepaint(const RenderLayerModel
LayoutPoint location(max<LayoutUnit>(left, -visualOverflowRect().x()), max<LayoutUnit>(top, -visualOverflowRect().y()));
LayoutRect r(-location.x(), -location.y(), location.x() + max(width() + right, visualOverflowRect().maxX()), location.y() + max(height() + bottom, visualOverflowRect().maxY()));
- if (RenderView* v = view()) {
- // 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(v->layoutDelta());
+ if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
+ if (RenderView* v = view()) {
+ // 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(v->layoutDelta());
+ }
}
- computeRectForRepaint(repaintContainer, r);
+ mapRectToPaintInvalidationBacking(paintInvalidationContainer, r);
return r;
}
-void RenderTableCell::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& r, bool fixed) const
+void RenderTableCell::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& r, bool fixed) const
{
- if (repaintContainer == this)
+ if (paintInvalidationContainer == this)
return;
r.setY(r.y());
RenderView* v = view();
- if ((!v || !v->layoutStateEnabled() || repaintContainer) && parent())
+ if ((!v || !v->canMapUsingLayoutStateForContainer(paintInvalidationContainer)) && parent())
r.moveBy(-parentBox()->location()); // Rows are in the same coordinate space, so don't add their offset in.
- RenderBlock::computeRectForRepaint(repaintContainer, r, fixed);
+ RenderBlockFlow::mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, fixed);
}
LayoutUnit RenderTableCell::cellBaselinePosition() const
@@ -396,7 +399,7 @@ void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* ol
ASSERT(style()->display() == TABLE_CELL);
ASSERT(!row() || row()->rowIndexWasSet());
- RenderBlock::styleDidChange(diff, oldStyle);
+ RenderBlockFlow::styleDidChange(diff, oldStyle);
setHasBoxDecorations(true);
if (parent() && section() && oldStyle && style()->height() != oldStyle->height())
@@ -738,7 +741,7 @@ CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorder
if (prevCell->section() == section())
prevRow = parent()->previousSibling();
else
- prevRow = prevCell->section()->lastChild();
+ prevRow = prevCell->section()->lastRow();
if (prevRow) {
result = chooseBorder(CollapsedBorderValue(prevRow->style()->borderAfter(), includeColor ? prevRow->resolveColor(afterColorProperty) : Color(), BROW), result);
@@ -894,44 +897,44 @@ inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const R
int RenderTableCell::borderLeft() const
{
- return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderLeft();
+ return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlockFlow::borderLeft();
}
int RenderTableCell::borderRight() const
{
- return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderRight();
+ return table()->collapseBorders() ? borderHalfRight(false) : RenderBlockFlow::borderRight();
}
int RenderTableCell::borderTop() const
{
- return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderTop();
+ return table()->collapseBorders() ? borderHalfTop(false) : RenderBlockFlow::borderTop();
}
int RenderTableCell::borderBottom() const
{
- return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::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
{
- return table()->collapseBorders() ? borderHalfStart(false) : RenderBlock::borderStart();
+ return table()->collapseBorders() ? borderHalfStart(false) : RenderBlockFlow::borderStart();
}
int RenderTableCell::borderEnd() const
{
- return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlock::borderEnd();
+ return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlockFlow::borderEnd();
}
int RenderTableCell::borderBefore() const
{
- return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlock::borderBefore();
+ return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlockFlow::borderBefore();
}
int RenderTableCell::borderAfter() const
{
- return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlock::borderAfter();
+ return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlockFlow::borderAfter();
}
int RenderTableCell::borderHalfLeft(bool outer) const
@@ -1001,7 +1004,7 @@ int RenderTableCell::borderHalfAfter(bool outer) const
void RenderTableCell::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ASSERT(paintInfo.phase != PaintPhaseCollapsedTableBorders);
- RenderBlock::paint(paintInfo, paintOffset);
+ RenderBlockFlow::paint(paintInfo, paintOffset);
}
static EBorderStyle collapsedBorderStyle(EBorderStyle style)
@@ -1105,14 +1108,11 @@ void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo
if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE)
return;
- LayoutRect localRepaintRect = paintInfo.rect;
- localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
-
LayoutRect paintRect = LayoutRect(paintOffset + location(), pixelSnappedSize());
- if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY())
+ if (paintRect.y() - table()->outerBorderTop() >= paintInfo.rect.maxY())
return;
- if (paintRect.maxY() + table()->outerBorderBottom() <= localRepaintRect.y())
+ if (paintRect.maxY() + table()->outerBorderBottom() <= paintInfo.rect.y())
return;
GraphicsContext* graphicsContext = paintInfo.context;
@@ -1159,7 +1159,7 @@ void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo
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,
- resolveColor(border->borderValue.color()), border->style, 0, 0, antialias);
+ border->borderValue.color().resolve(style()->visitedDependentColor(CSSPropertyColor)), border->style, 0, 0, antialias);
}
}
}
@@ -1186,7 +1186,7 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const Lay
Color c = backgroundObject->resolveColor(CSSPropertyBackgroundColor);
const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers();
- if (bgLayer->hasImage() || c.isValid()) {
+ if (bgLayer->hasImage() || c.alpha()) {
// 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();