Commit 89a28385 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Fix off-by-one hit test failure at vertical-rl line edges

The hit test "point" is not really a point, but a pixel with 1px width
and height. Ignoring this leads to off-by-one errors when converting
a physical point into logical in vertical-rl writing mode.

This patch fixes the issue by using 1px width and height in the
conversion, instead of 0.

Note: This patch contains an all-pass NG baseline because the legacy
baseline contains a failure line.

Bug: 811502
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: Ie3f01469b4902c3c9647d40be92ccb9c26467f0d
Reviewed-on: https://chromium-review.googlesource.com/1150814
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578178}
parent 5c7d4b00
...@@ -583,7 +583,6 @@ crbug.com/591099 fast/writing-mode/border-image-vertical-lr.html [ Failure ] ...@@ -583,7 +583,6 @@ crbug.com/591099 fast/writing-mode/border-image-vertical-lr.html [ Failure ]
crbug.com/591099 fast/writing-mode/border-radius-clipping-vertical-lr.html [ Failure ] crbug.com/591099 fast/writing-mode/border-radius-clipping-vertical-lr.html [ Failure ]
crbug.com/714962 fast/writing-mode/border-styles-vertical-lr.html [ Failure ] crbug.com/714962 fast/writing-mode/border-styles-vertical-lr.html [ Failure ]
crbug.com/591099 fast/writing-mode/fieldsets.html [ Failure ] crbug.com/591099 fast/writing-mode/fieldsets.html [ Failure ]
crbug.com/714962 fast/writing-mode/flipped-blocks-hit-test-line-edges.html [ Failure ]
crbug.com/591099 fast/writing-mode/percentage-height-orthogonal-writing-modes.html [ Failure ] crbug.com/591099 fast/writing-mode/percentage-height-orthogonal-writing-modes.html [ Failure ]
crbug.com/591099 fast/writing-mode/table-percent-width-quirk.html [ Pass ] crbug.com/591099 fast/writing-mode/table-percent-width-quirk.html [ Pass ]
crbug.com/591099 fullscreen/full-screen-with-flex-item.html [ Failure ] crbug.com/591099 fullscreen/full-screen-with-flex-item.html [ Failure ]
......
Lorem ipsum dolor sit amet
PASS: offset at (100,105) was 4.
PASS: offset at (160,105) was 5.
PASS: offset at (100,104) was 10.
PASS: offset at (160,104) was 11.
PASS: offset at (60,26) was 24.
PASS: offset at (160,26) was 26.
PASS: offset at (60,25) was 24.
PASS: offset at (160,25) was 26.
PASS: offset at (60,24) was 24.
PASS: offset at (160,24) was 26.
...@@ -478,7 +478,9 @@ PositionWithAffinity NGPaintFragment::PositionForPointInInlineLevelBox( ...@@ -478,7 +478,9 @@ PositionWithAffinity NGPaintFragment::PositionForPointInInlineLevelBox(
DCHECK(!PhysicalFragment().IsBlockFlow()); DCHECK(!PhysicalFragment().IsBlockFlow());
const NGLogicalOffset logical_point = point.ConvertToLogical( const NGLogicalOffset logical_point = point.ConvertToLogical(
Style().GetWritingMode(), Style().Direction(), Size(), NGPhysicalSize()); Style().GetWritingMode(), Style().Direction(), Size(),
// |point| is actually a pixel with size 1x1.
NGPhysicalSize(LayoutUnit(1), LayoutUnit(1)));
const LayoutUnit inline_point = logical_point.inline_offset; const LayoutUnit inline_point = logical_point.inline_offset;
// Stores the closest child before |point| in the inline direction. Used if we // Stores the closest child before |point| in the inline direction. Used if we
...@@ -541,7 +543,9 @@ PositionWithAffinity NGPaintFragment::PositionForPointInInlineFormattingContext( ...@@ -541,7 +543,9 @@ PositionWithAffinity NGPaintFragment::PositionForPointInInlineFormattingContext(
DCHECK(ToNGPhysicalBoxFragment(PhysicalFragment()).ChildrenInline()); DCHECK(ToNGPhysicalBoxFragment(PhysicalFragment()).ChildrenInline());
const NGLogicalOffset logical_point = point.ConvertToLogical( const NGLogicalOffset logical_point = point.ConvertToLogical(
Style().GetWritingMode(), Style().Direction(), Size(), NGPhysicalSize()); Style().GetWritingMode(), Style().Direction(), Size(),
// |point| is actually a pixel with size 1x1.
NGPhysicalSize(LayoutUnit(1), LayoutUnit(1)));
const LayoutUnit block_point = logical_point.block_offset; const LayoutUnit block_point = logical_point.block_offset;
// Stores the closest line box child above |point| in the block direction. // Stores the closest line box child above |point| in the block direction.
......
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