Let collapsed border drawings be cacheable

Previously because one table cell may paint its collapsed borders
multiple times, we enclose all collapsed border drawings in a
ScopeRecorder.

However, actually a table cell paints each border only once. When it
paint collapsed borders multiple times, it just paint different borders
in different time.

Use display item type to distinguish the different borders to avoid
the ScopeRecorder.

Also revert https://codereview.chromium.org/1234463005 to invalidate
table cells with changed collapsed borders.

BUG=510492

Review URL: https://codereview.chromium.org/1306433002

git-svn-id: svn://svn.chromium.org/blink/trunk@201002 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8b7a53cc
...@@ -451,6 +451,10 @@ crbug.com/318978 [ Linux ] http/tests/security/frameNavigation/xss-DENIED-plugin ...@@ -451,6 +451,10 @@ crbug.com/318978 [ Linux ] http/tests/security/frameNavigation/xss-DENIED-plugin
crbug.com/318978 [ Linux ] permissionclient/plugin-permission.html [ Skip ] crbug.com/318978 [ Linux ] permissionclient/plugin-permission.html [ Skip ]
crbug.com/318978 [ Linux ] plugins/ [ Skip ] crbug.com/318978 [ Linux ] plugins/ [ Skip ]
crbug.com/510492 fast/repaint/table-cell-collapsed-border.html [ NeedsRebaseline ]
crbug.com/510492 fast/repaint/table-collapsed-border.html [ NeedsRebaseline ]
crbug.com/510492 fast/table/border-collapsing/cached-change-cell-sl-border-color.html [ NeedsRebaseline ]
crbug.com/380217 [ Linux Win ] fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html [ Skip ] crbug.com/380217 [ Linux Win ] fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html [ Skip ]
crbug.com/380217 [ Win ] fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html [ Skip ] crbug.com/380217 [ Win ] fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html [ Skip ]
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
"LayoutTableRow TR", "LayoutTableRow TR",
"LayoutTableSection TBODY", "LayoutTableSection TBODY",
"LayoutTable TABLE id='table'", "LayoutTable TABLE id='table'",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE id='table' class='green'", "LayoutTable TABLE id='table' class='green'",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
[8, 8, 107, 108] [8, 8, 107, 108]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE id='table'", "LayoutTable TABLE id='table'",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
[63, 8, 60, 54] [63, 8, 60, 54]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD" "LayoutTableCell TD"
] ]
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD id='bar'", "LayoutTableCell TD id='bar'",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
[8, 8, 60, 54] [8, 8, 60, 54]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD id='foo'",
"LayoutTableCell TD",
"LayoutTableCell TD id='foo'" "LayoutTableCell TD id='foo'"
] ]
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
[8, 8, 55, 52] [8, 8, 55, 52]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD id='foo'",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableSection TBODY", "LayoutTableSection TBODY",
"LayoutTableRow TR", "LayoutTableRow TR",
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
[8, 8, 113, 104] [8, 8, 113, 104]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCol COL id='col'" "LayoutTableCol COL id='col'"
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
[8, 8, 56, 52] [8, 8, 56, 52]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
[8, 8, 166, 102] [8, 8, 166, 102]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
[7, 7, 56, 53] [7, 7, 56, 53]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
[10, 10, 56, 50] [10, 10, 56, 50]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableRow TR id='row'" "LayoutTableRow TR id='row'"
] ]
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
[8, 8, 56, 52] [8, 8, 56, 52]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableSection TBODY", "LayoutTableSection TBODY",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
[8, 8, 60, 54] [8, 8, 60, 54]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTable TABLE id='tbl'" "LayoutTable TABLE id='tbl'"
] ]
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
[8, 8, 56, 52] [8, 8, 56, 52]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTable TABLE id='tbl'", "LayoutTable TABLE id='tbl'",
"LayoutTableSection TBODY", "LayoutTableSection TBODY",
"LayoutTableRow TR", "LayoutTableRow TR",
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
[10, 10, 110, 100] [10, 10, 110, 100]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
[8, 8, 56, 52] [8, 8, 56, 52]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -11,6 +11,17 @@ ...@@ -11,6 +11,17 @@
[3, 264, 118, 110] [3, 264, 118, 110]
], ],
"paintInvalidationClients": [ "paintInvalidationClients": [
"LayoutTableCell TD",
"LayoutTableCell TD id='t1'",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD id='t2'",
"LayoutTableCell TD",
"LayoutTableCell TD id='t3'",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD id='t1'", "LayoutTableCell TD id='t1'",
"LayoutTableCell TD id='t2'", "LayoutTableCell TD id='t2'",
"LayoutTableCell TD id='t3'" "LayoutTableCell TD id='t3'"
......
...@@ -50,7 +50,14 @@ ...@@ -50,7 +50,14 @@
"InlineTextBox 'sit amet'", "InlineTextBox 'sit amet'",
"RootInlineBox", "RootInlineBox",
"InlineTextBox 'ipsum dolor'", "InlineTextBox 'ipsum dolor'",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE id='t'", "LayoutTable TABLE id='t'",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
...@@ -60,6 +67,7 @@ ...@@ -60,6 +67,7 @@
"LayoutTableSection TBODY", "LayoutTableSection TBODY",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD",
"LayoutTable TABLE", "LayoutTable TABLE",
"LayoutTableCell TD", "LayoutTableCell TD",
"LayoutTableCell TD", "LayoutTableCell TD",
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
"InlineTextBox 'A'", "InlineTextBox 'A'",
"LayoutText #text", "LayoutText #text",
"RootInlineBox", "RootInlineBox",
"LayoutTableCell TD id='foo'",
"LayoutTableCell TD",
"LayoutTableCell TD id='foo'" "LayoutTableCell TD id='foo'"
] ]
} }
......
...@@ -951,10 +951,15 @@ void LayoutTableCell::collectBorderValues(LayoutTable::CollapsedBorderValues& bo ...@@ -951,10 +951,15 @@ void LayoutTableCell::collectBorderValues(LayoutTable::CollapsedBorderValues& bo
CollapsedBorderValue beforeBorder = computeCollapsedBeforeBorder(); CollapsedBorderValue beforeBorder = computeCollapsedBeforeBorder();
CollapsedBorderValue afterBorder = computeCollapsedAfterBorder(); CollapsedBorderValue afterBorder = computeCollapsedAfterBorder();
LayoutTableSection* section = this->section(); LayoutTableSection* section = this->section();
section->setCachedCollapsedBorder(this, CBSStart, startBorder); bool changed = section->setCachedCollapsedBorder(this, CBSStart, startBorder);
section->setCachedCollapsedBorder(this, CBSEnd, endBorder); changed |= section->setCachedCollapsedBorder(this, CBSEnd, endBorder);
section->setCachedCollapsedBorder(this, CBSBefore, beforeBorder); changed |= section->setCachedCollapsedBorder(this, CBSBefore, beforeBorder);
section->setCachedCollapsedBorder(this, CBSAfter, afterBorder); changed |= section->setCachedCollapsedBorder(this, CBSAfter, afterBorder);
// In slimming paint mode, we need to invalidate all cells with collapsed border changed.
// FIXME: Need a way to invalidate/repaint the borders only. crbug.com/451090#c5.
if (changed && RuntimeEnabledFeatures::slimmingPaintEnabled())
invalidateDisplayItemClient(*this);
addBorderStyle(borderValues, startBorder); addBorderStyle(borderValues, startBorder);
addBorderStyle(borderValues, endBorder); addBorderStyle(borderValues, endBorder);
......
...@@ -1602,14 +1602,19 @@ void LayoutTableSection::removeCachedCollapsedBorders(const LayoutTableCell* cel ...@@ -1602,14 +1602,19 @@ void LayoutTableSection::removeCachedCollapsedBorders(const LayoutTableCell* cel
m_cellsCollapsedBorders.remove(std::make_pair(cell, side)); m_cellsCollapsedBorders.remove(std::make_pair(cell, side));
} }
void LayoutTableSection::setCachedCollapsedBorder(const LayoutTableCell* cell, CollapsedBorderSide side, const CollapsedBorderValue& border) bool LayoutTableSection::setCachedCollapsedBorder(const LayoutTableCell* cell, CollapsedBorderSide side, const CollapsedBorderValue& border)
{ {
ASSERT(table()->collapseBorders()); ASSERT(table()->collapseBorders());
CellsCollapsedBordersMap::iterator it = m_cellsCollapsedBorders.find(std::make_pair(cell, side)); CellsCollapsedBordersMap::iterator it = m_cellsCollapsedBorders.find(std::make_pair(cell, side));
if (it == m_cellsCollapsedBorders.end()) if (it == m_cellsCollapsedBorders.end()) {
m_cellsCollapsedBorders.add(std::make_pair(cell, side), border); m_cellsCollapsedBorders.add(std::make_pair(cell, side), border);
else return true;
}
if (!it->value.equals(border)) {
it->value = border; it->value = border;
return true;
}
return false;
} }
const CollapsedBorderValue& LayoutTableSection::cachedCollapsedBorder(const LayoutTableCell* cell, CollapsedBorderSide side) const const CollapsedBorderValue& LayoutTableSection::cachedCollapsedBorder(const LayoutTableCell* cell, CollapsedBorderSide side) const
......
...@@ -210,7 +210,8 @@ public: ...@@ -210,7 +210,8 @@ public:
void rowLogicalHeightChanged(LayoutTableRow*); void rowLogicalHeightChanged(LayoutTableRow*);
void removeCachedCollapsedBorders(const LayoutTableCell*); void removeCachedCollapsedBorders(const LayoutTableCell*);
void setCachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide, const CollapsedBorderValue&); // Returns true if any collapsed borders of the cell changed.
bool setCachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide, const CollapsedBorderValue&);
const CollapsedBorderValue& cachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide) const; const CollapsedBorderValue& cachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide) const;
// distributeExtraLogicalHeightToRows methods return the *consumed* extra logical height. // distributeExtraLogicalHeightToRows methods return the *consumed* extra logical height.
......
...@@ -83,12 +83,17 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ...@@ -83,12 +83,17 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleForCellFlow); const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleForCellFlow);
const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder(styleForCellFlow); const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder(styleForCellFlow);
bool shouldPaintTop = topBorderValue.shouldPaint(*tableCurrentBorderValue); int displayItemType = DisplayItem::TableCollapsedBorderBase;
bool shouldPaintBottom = bottomBorderValue.shouldPaint(*tableCurrentBorderValue); if (topBorderValue.shouldPaint(*tableCurrentBorderValue))
bool shouldPaintLeft = leftBorderValue.shouldPaint(*tableCurrentBorderValue); displayItemType |= DisplayItem::TableCollapsedBorderTop;
bool shouldPaintRight = rightBorderValue.shouldPaint(*tableCurrentBorderValue); if (bottomBorderValue.shouldPaint(*tableCurrentBorderValue))
displayItemType |= DisplayItem::TableCollapsedBorderBottom;
if (leftBorderValue.shouldPaint(*tableCurrentBorderValue))
displayItemType |= DisplayItem::TableCollapsedBorderLeft;
if (rightBorderValue.shouldPaint(*tableCurrentBorderValue))
displayItemType |= DisplayItem::TableCollapsedBorderRight;
if (!shouldPaintTop && !shouldPaintBottom && !shouldPaintLeft && !shouldPaintRight) if (displayItemType == DisplayItem::TableCollapsedBorderBase)
return; return;
// Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
...@@ -107,28 +112,28 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ...@@ -107,28 +112,28 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
return; return;
GraphicsContext* graphicsContext = paintInfo.context; GraphicsContext* graphicsContext = paintInfo.context;
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext, m_layoutTableCell, paintInfo.phase)) if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext, m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType)))
return; return;
LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, paintInfo.phase, borderRect); LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType), borderRect);
Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor); Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor);
bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext);
// We never paint diagonals at the joins. We simply let the border with the highest // We never paint diagonals at the joins. We simply let the border with the highest
// precedence paint on top of borders with lower precedence. // precedence paint on top of borders with lower precedence.
if (shouldPaintTop) { if (displayItemType & DisplayItem::TableCollapsedBorderTop) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, BSTop, ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, BSTop,
topBorderValue.color().resolve(cellColor), collapsedBorderStyle(topBorderValue.style()), 0, 0, antialias); topBorderValue.color().resolve(cellColor), collapsedBorderStyle(topBorderValue.style()), 0, 0, antialias);
} }
if (shouldPaintBottom) { if (displayItemType & DisplayItem::TableCollapsedBorderBottom) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), BSBottom, ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), BSBottom,
bottomBorderValue.color().resolve(cellColor), collapsedBorderStyle(bottomBorderValue.style()), 0, 0, antialias); bottomBorderValue.color().resolve(cellColor), collapsedBorderStyle(bottomBorderValue.style()), 0, 0, antialias);
} }
if (shouldPaintLeft) { if (displayItemType & DisplayItem::TableCollapsedBorderLeft) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), BSLeft, ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), BSLeft,
leftBorderValue.color().resolve(cellColor), collapsedBorderStyle(leftBorderValue.style()), 0, 0, antialias); leftBorderValue.color().resolve(cellColor), collapsedBorderStyle(leftBorderValue.style()), 0, 0, antialias);
} }
if (shouldPaintRight) { if (displayItemType & DisplayItem::TableCollapsedBorderRight) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight, ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight,
rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(rightBorderValue.style()), 0, 0, antialias); rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(rightBorderValue.style()), 0, 0, antialias);
} }
......
...@@ -54,7 +54,6 @@ void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa ...@@ -54,7 +54,6 @@ void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders(); LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders();
size_t count = collapsedBorders.size(); size_t count = collapsedBorders.size();
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
ScopeRecorder scopeRecorder(*info.context);
// FIXME: pass this value into children rather than storing temporarily on the LayoutTable object. // FIXME: pass this value into children rather than storing temporarily on the LayoutTable object.
m_layoutTable.setCurrentBorderValue(&collapsedBorders[i]); m_layoutTable.setCurrentBorderValue(&collapsedBorders[i]);
for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) { for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) {
......
...@@ -53,6 +53,23 @@ static WTF::String paintPhaseAsDebugString(int paintPhase) ...@@ -53,6 +53,23 @@ static WTF::String paintPhaseAsDebugString(int paintPhase)
static WTF::String specialDrawingTypeAsDebugString(DisplayItem::Type type) static WTF::String specialDrawingTypeAsDebugString(DisplayItem::Type type)
{ {
if (type >= DisplayItem::TableCollapsedBorderUnalignedBase) {
if (type <= DisplayItem::TableCollapsedBorderBase)
return "TableCollapsedBorderAlignment";
if (type <= DisplayItem::TableCollapsedBorderLast) {
StringBuilder sb;
sb.append("TableCollapsedBorder");
if (type & DisplayItem::TableCollapsedBorderTop)
sb.append("Top");
if (type & DisplayItem::TableCollapsedBorderRight)
sb.append("Right");
if (type & DisplayItem::TableCollapsedBorderBottom)
sb.append("Bottom");
if (type & DisplayItem::TableCollapsedBorderLeft)
sb.append("Left");
return sb.toString();
}
}
switch (type) { switch (type) {
DEBUG_STRING_CASE(BoxDecorationBackground); DEBUG_STRING_CASE(BoxDecorationBackground);
DEBUG_STRING_CASE(Caret); DEBUG_STRING_CASE(Caret);
......
...@@ -91,6 +91,12 @@ public: ...@@ -91,6 +91,12 @@ public:
SelectionGap, SelectionGap,
SelectionTint, SelectionTint,
TableCellBackgroundFromSelfPaintingRow, // FIXME: To be deprecated. TableCellBackgroundFromSelfPaintingRow, // FIXME: To be deprecated.
// Table collapsed borders can be painted together (e.g., left & top) but there are at most 4 phases of collapsed
// border painting for a single cell. To disambiguate these phases of collapsed border painting, a mask is used.
// TableCollapsedBorderBase can be larger than TableCollapsedBorderUnalignedBase to ensure the base lower bits are 0's.
TableCollapsedBorderUnalignedBase,
TableCollapsedBorderBase = (((TableCollapsedBorderUnalignedBase - 1) >> 4) + 1) << 4,
TableCollapsedBorderLast = TableCollapsedBorderBase + 0x0f,
VideoBitmap, VideoBitmap,
WebPlugin, WebPlugin,
WebFont, WebFont,
...@@ -178,6 +184,16 @@ public: ...@@ -178,6 +184,16 @@ public:
TypeLast = UninitializedType TypeLast = UninitializedType
}; };
static_assert(TableCollapsedBorderBase >= TableCollapsedBorderUnalignedBase, "TableCollapsedBorder types overlap with other types");
static_assert((TableCollapsedBorderBase & 0xf) == 0, "The lowest 4 bits of TableCollapsedBorderBase should be zero");
// Bits or'ed onto TableCollapsedBorderBase to generate a real table collapsed border type.
enum TableCollspaedBorderSides {
TableCollapsedBorderTop = 1 << 0,
TableCollapsedBorderRight = 1 << 1,
TableCollapsedBorderBottom = 1 << 2,
TableCollapsedBorderLeft = 1 << 3,
};
DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize) DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize)
: m_client(client.displayItemClient()) : m_client(client.displayItemClient())
, m_scope(0) , m_scope(0)
...@@ -219,19 +235,19 @@ public: ...@@ -219,19 +235,19 @@ public:
}; };
// Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Type::SVGImage). // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Type::SVGImage).
Type nonCachedType() const static Type nonCachedType(Type type)
{ {
if (isCachedDrawingType(m_type)) if (isCachedDrawingType(type))
return cachedDrawingTypeToDrawingType(m_type); return cachedDrawingTypeToDrawingType(type);
if (isCachedSubtreeType(m_type)) if (isCachedSubtreeType(type))
return cachedSubtreeTypeToBeginSubtreeType(m_type); return cachedSubtreeTypeToBeginSubtreeType(type);
return m_type; return type;
} }
// Return the Id with cached type converted to non-cached type. // Return the Id with cached type converted to non-cached type.
Id nonCachedId() const Id nonCachedId() const
{ {
return Id(m_client, nonCachedType(), m_scope); return Id(m_client, nonCachedType(m_type), m_scope);
} }
virtual void replay(GraphicsContext&) { } virtual void replay(GraphicsContext&) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment