Place ellipsis correctly when inline has relative offset

Desktop / Chromium - Robert Hogan [gmail.com] - 13 July 2017 18:50 EDT

When an inline has relative position we need to apply that to the ellipsis as well.

We also need to be able to detect cases where relative position moves the inline so that it requires ellipsis in the first place. This means that we need to look at the layout overflow rather than the linebox edge when deciding if ellipsis is required - this is because the dimensions of the root inline box won't tell us if relative positioning makes it exceed the horizontal bounds.

When flexbox applies line clamp it depends on the ellipsis logic to apply an ellipsis even when there's adequate space for the line box. We now make it force that rather than apply it in all cases, because where we're looking at a normal ellipsis we want to ensure we account for relative positioning on the line boxes before deciding to apply an ellipsis on a line box that would otherwise already fit on the line.

The final complication to deal with here is cases where relative positioning changes a line box from having an overflow (e.g. text overflowing the left hand side of the box in an rtl flow) to not having an overflow. InlineFlowBox::ComputeOverflow needs to notice when this is happening, so we change it so that the dimensions of the root inline box are not used to initialize its layout overflow because shifting the box subsequently for relative positioning doesn't subtract the overflow they initially create.

Bug: 737837 Change-Id: I66c848299a93b2b796f2f831d9237f41aa50e962 Reviewed-on: https://chromium-review.googlesource.com/563625

74bd1c0 Place ellipsis correctly when inline has relative offset
.../text/ellipsis-in-relative-inline-right.html | 31 +++++++++++++++++++++
.../fast/text/ellipsis-in-relative-inline.html | 30 ++++++++++++++++++++
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 18934 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 17595 bytes
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 25207 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 24407 bytes
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 25168 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 24291 bytes
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 25120 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 24341 bytes
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 14160 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 13008 bytes
.../text/ellipsis-in-relative-inline-expected.png | Bin 0 -> 14107 bytes
.../ellipsis-in-relative-inline-right-expected.png | Bin 0 -> 14177 bytes
.../Source/core/layout/LayoutBlockFlowLine.cpp | 5 ++--
.../core/layout/LayoutDeprecatedFlexibleBox.cpp | 2 +-
.../Source/core/layout/line/InlineFlowBox.cpp | 9 ++++--
.../WebKit/Source/core/layout/line/InlineFlowBox.h | 14 ++++++++++
.../Source/core/layout/line/RootInlineBox.cpp | 11 ++++----
.../WebKit/Source/core/layout/line/RootInlineBox.h | 5 +++-
20 files changed, 94 insertions(+), 13 deletions(-)

Upstream: git.chromium.org


  • Share