Commit b8a66121 authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

[LayoutNG] Round marker offset when painting documentmarker.

This is a quick fix for the issue that DocumentMarkerContoller often returns over offset
for a text node. That causes DCHECK hit in creating NGOffsetMapping.
This patch rounds such offset before offsetmapping creation.
Generally, we should sanitize DMC offset management.

Bug: 865267
TEST: By hand with the example in the crbug. We might find a root issue by DCHECKing inside DMC.
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I0c90f14d08df4eee4de0e23d37b4a2be86308f1e
Reviewed-on: https://chromium-review.googlesource.com/1148160Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577778}
parent 93be3275
...@@ -86,7 +86,8 @@ DocumentMarkerVector ComputeMarkersToPaint( ...@@ -86,7 +86,8 @@ DocumentMarkerVector ComputeMarkersToPaint(
} }
unsigned GetTextContentOffset(const Text& text, unsigned offset) { unsigned GetTextContentOffset(const Text& text, unsigned offset) {
const Position position(text, offset); // TODO(yoichio): Sanitize DocumentMarker around text length.
const Position position(text, std::min(offset, text.length()));
const NGOffsetMapping* const offset_mapping = const NGOffsetMapping* const offset_mapping =
NGOffsetMapping::GetFor(position); NGOffsetMapping::GetFor(position);
DCHECK(offset_mapping); DCHECK(offset_mapping);
......
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