Commit cb40a20c authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Round the block offset of symbol markers

This patch rounds the block offset of symbol markers in the
same way as we do for text.

Symbol markers should have the same block offset, as they are
aligned to the baseline using the primary font.

Using the same logic helps FragmentItem support because it
has slightly different way to handle offsets of inline boxes.

Legacy rounds the marker box position in |ListMarkerPainter::
Paint()|, but LayoutNG skips this function and directly calls
|PaintSymbol()|.

Bug: 982194
Change-Id: I78bcf89f5637fa39c8e03edaa2057a8088d89f3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024589Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735870}
parent 63ab2cd9
......@@ -386,7 +386,6 @@ void NGTextFragmentPainter<Cursor>::Paint(const PaintInfo& paint_info,
GetTextFragmentPaintInfo(cursor_);
const LayoutObject* layout_object = text_item.GetLayoutObject();
const ComputedStyle& style = text_item.Style();
PhysicalRect box_rect = AsDisplayItemClient(cursor_).Rect();
const Document& document = layout_object->GetDocument();
const bool is_printing = paint_info.IsPrinting();
......@@ -424,6 +423,12 @@ void NGTextFragmentPainter<Cursor>::Paint(const PaintInfo& paint_info,
paint_info.phase);
}
// We round the y-axis to ensure consistent line heights.
PhysicalRect box_rect = AsDisplayItemClient(cursor_).Rect();
PhysicalOffset adjusted_paint_offset(paint_offset.left,
LayoutUnit(paint_offset.top.Round()));
box_rect.offset += adjusted_paint_offset;
if (UNLIKELY(text_item.IsSymbolMarker())) {
// The NGInlineItem of marker might be Split(). To avoid calling PaintSymbol
// multiple times, only call it the first time. For an outside marker, this
......@@ -436,15 +441,10 @@ void NGTextFragmentPainter<Cursor>::Paint(const PaintInfo& paint_info,
return;
}
PaintSymbol(layout_object, style, box_rect.size, paint_info,
paint_offset + box_rect.offset);
box_rect.offset);
return;
}
// We round the y-axis to ensure consistent line heights.
PhysicalOffset adjusted_paint_offset(paint_offset.left,
LayoutUnit(paint_offset.top.Round()));
box_rect.offset += adjusted_paint_offset;
GraphicsContext& context = paint_info.context;
// Determine text colors.
......
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