Commit dae005d6 authored by Emil A Eklund's avatar Emil A Eklund Committed by Commit Bot

[LayoutNG] Handle ellipsis for empty vertical-rl

Fix bug in NGLineTruncator::TruncateChild where it incorrectly assumes a
fragment always has content. This isn't always the case, especially when
obscure -webkit features are used. This change adds an extra null check.

Not using a WPT test as the test case replies on impl specific behavior.

Bug: 962297, 962471
Change-Id: I87ac7841a93303802aa2028e0ee04aaa9ab0961d
Test: web_tests/fast/text/empty-ellipsis-vertical-rl-crash.html
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612224
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659740}
parent 68d2ad49
...@@ -190,6 +190,11 @@ bool NGLineTruncator::TruncateChild(LayoutUnit space_for_child, ...@@ -190,6 +190,11 @@ bool NGLineTruncator::TruncateChild(LayoutUnit space_for_child,
if (!child->fragment) if (!child->fragment)
return is_first_child; return is_first_child;
auto& fragment = To<NGPhysicalTextFragment>(*child->fragment); auto& fragment = To<NGPhysicalTextFragment>(*child->fragment);
// No need to truncate empty results.
if (!fragment.TextShapeResult())
return is_first_child;
// TODO(layout-dev): Add support for OffsetToFit to ShapeResultView to avoid // TODO(layout-dev): Add support for OffsetToFit to ShapeResultView to avoid
// this copy. // this copy.
scoped_refptr<blink::ShapeResult> shape_result = scoped_refptr<blink::ShapeResult> shape_result =
......
<!DOCTYPE html>
<style>
menu {
text-overflow: ellipsis;
-webkit-writing-mode: vertical-rl;
-webkit-logical-width: 1px;
}
menu, menuitem {
-webkit-box-decoration-break: clone;
overflow-x: auto;
white-space: pre-wrap;
border-bottom: solid;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<p>
Test passes if it does not crash.
</p>
<menu><menuitem>
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