Commit 582cdb5b authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[PTAR] Add RecordHitTestData for TableRowPainter

This CL records touch action rects for TableRowPainter. A layout test
case is added to ensure the correctness.

Bug: 851674
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I3280aaf9c72dda6a75eed5d5ad85b60045c377f7
Reviewed-on: https://chromium-review.googlesource.com/1216706
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590164}
parent 377334f1
: #document scrolling (8, 8, 116, 20)
: #document scrolling (10, 30, 54, 14)
: #document scrolling (8, 30, 114, 14)
: #document scrolling (10, 48, 54, 14)
......@@ -10,6 +10,12 @@
<td>World</td>
</tr>
</table>
<table>
<tr class="testcase">
<td>Hello</td>
<td>World</td>
</tr>
</table>
<table>
<tr>
<td class="testcase">Hello</td>
......
......@@ -67,9 +67,32 @@ void TableRowPainter::HandleChangedPartialPaint(
paint_result, paint_info.GetCullRect());
}
void TableRowPainter::RecordHitTestData(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
// Hit test display items are only needed for compositing. This flag is used
// for for printing and drag images which do not need hit testing.
if (paint_info.GetGlobalPaintFlags() & kGlobalPaintFlattenCompositingLayers)
return;
auto touch_action = layout_table_row_.EffectiveWhitelistedTouchAction();
if (touch_action == TouchAction::kTouchActionAuto)
return;
auto rect = layout_table_row_.BorderBoxRect();
rect.MoveBy(paint_offset);
HitTestData::RecordTouchActionRect(paint_info.context, layout_table_row_,
TouchActionRect(rect, touch_action));
}
void TableRowPainter::PaintBoxDecorationBackground(
const PaintInfo& paint_info,
const CellSpan& dirtied_columns) {
ScopedPaintState paint_state(layout_table_row_, paint_info);
const auto& local_paint_info = paint_state.GetPaintInfo();
auto paint_offset = paint_state.PaintOffset();
if (RuntimeEnabledFeatures::PaintTouchActionRectsEnabled())
RecordHitTestData(local_paint_info, paint_offset);
bool has_background = layout_table_row_.StyleRef().HasBackground();
bool has_box_shadow = layout_table_row_.StyleRef().BoxShadow();
if (!has_background && !has_box_shadow)
......@@ -77,14 +100,11 @@ void TableRowPainter::PaintBoxDecorationBackground(
HandleChangedPartialPaint(paint_info, dirtied_columns);
ScopedPaintState paint_state(layout_table_row_, paint_info);
if (DrawingRecorder::UseCachedDrawingIfPossible(
paint_info.context, layout_table_row_,
DisplayItem::kBoxDecorationBackground))
return;
const auto& local_paint_info = paint_state.GetPaintInfo();
auto paint_offset = paint_state.PaintOffset();
DrawingRecorder recorder(local_paint_info.context, layout_table_row_,
DisplayItem::kBoxDecorationBackground);
LayoutRect paint_rect(paint_offset, layout_table_row_.Size());
......
......@@ -31,6 +31,10 @@ class TableRowPainter {
private:
void HandleChangedPartialPaint(const PaintInfo&,
const CellSpan& dirtied_columns);
// Paint a hit test display item and record hit test data. This should be
// called in the background paint phase even if there is no other painted
// content.
void RecordHitTestData(const PaintInfo&, const LayoutPoint& paint_offset);
const LayoutTableRow& layout_table_row_;
};
......
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