Commit 82ef3030 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[PTAR] Add RecordHitTestData for TablePainter

This CL records touch action rects for TablePainter. A layout
test is added to ensure its correctness.

Bug: 851674
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ic82e47898ed2b1bf97955dc7fffcf86d9eb7c7e3
Reviewed-on: https://chromium-review.googlesource.com/1213535Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589737}
parent ef282941
......@@ -1416,3 +1416,5 @@ Bug(none) fast/events/touch/compositor-touch-hit-rects-img-element.html [ Failur
Bug(none) virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-root.html [ Failure ]
Bug(none) virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-img-element.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects-svg-root.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects-table.html [ Failure ]
Bug(none) virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-table.html [ Failure ]
: #document scrolling (8, 8, 116, 20)
: #document scrolling (10, 30, 54, 14)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="resources/compositor-touch-hit-rects.css">
</head>
<body>
<div id="tests">
<table class="testcase">
<tr><td>Hello</td>
<td>World</td>
</tr>
</table>
<table>
<tr>
<td class="testcase">Hello</td>
<td>World</td>
</tr>
</table>
</div>
<div id="console"></div>
<script src="resources/compositor-touch-hit-rects.js"></script>
</body>
......@@ -52,9 +52,29 @@ void TablePainter::PaintObject(const PaintInfo& paint_info,
ObjectPainter(layout_table_).PaintOutline(paint_info, paint_offset);
}
void TablePainter::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_.EffectiveWhitelistedTouchAction();
if (touch_action == TouchAction::kTouchActionAuto)
return;
auto rect = layout_table_.BorderBoxRect();
rect.MoveBy(paint_offset);
HitTestData::RecordTouchActionRect(paint_info.context, layout_table_,
TouchActionRect(rect, touch_action));
}
void TablePainter::PaintBoxDecorationBackground(
const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
if (RuntimeEnabledFeatures::PaintTouchActionRectsEnabled())
RecordHitTestData(paint_info, paint_offset);
if (!layout_table_.HasBoxDecorationBackground() ||
layout_table_.StyleRef().Visibility() != EVisibility::kVisible)
return;
......
......@@ -26,6 +26,10 @@ class TablePainter {
private:
void PaintCollapsedBorders(const PaintInfo&);
// 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 LayoutTable& layout_table_;
};
......
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