Commit 99c85930 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Fix justification when hyphenation points are at end of nodes

r819319 crrev.com/c/2476354 added |NGInlineItem.is_hyphenated|
as the flag to indicate whether it is hyphenated or not, but
failed to update |ApplyJustify|. This patch changes it to use
the flag instead of |hyphen_shape_result|.

Bug: 1141755
Change-Id: I49303b54c22c419a2dcf804cf40e4ec3b1a1f4ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511151Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823039}
parent 07ce63cc
...@@ -536,6 +536,7 @@ void NGInlineLayoutAlgorithm::PlaceHyphen(const NGInlineItemResult& item_result, ...@@ -536,6 +536,7 @@ void NGInlineLayoutAlgorithm::PlaceHyphen(const NGInlineItemResult& item_result,
NGLogicalLineItems* line_box, NGLogicalLineItems* line_box,
NGInlineBoxState* box) { NGInlineBoxState* box) {
DCHECK(item_result.item); DCHECK(item_result.item);
DCHECK(item_result.is_hyphenated);
DCHECK(item_result.hyphen_string); DCHECK(item_result.hyphen_string);
DCHECK(item_result.hyphen_shape_result); DCHECK(item_result.hyphen_shape_result);
DCHECK_EQ(hyphen_inline_size, item_result.HyphenInlineSize()); DCHECK_EQ(hyphen_inline_size, item_result.HyphenInlineSize());
...@@ -870,7 +871,7 @@ base::Optional<LayoutUnit> NGInlineLayoutAlgorithm::ApplyJustify( ...@@ -870,7 +871,7 @@ base::Optional<LayoutUnit> NGInlineLayoutAlgorithm::ApplyJustify(
line_info->StartOffset() - line_info->StartOffset() -
shape_result->StartIndex()); shape_result->StartIndex());
item_result.inline_size = shape_result->SnappedWidth(); item_result.inline_size = shape_result->SnappedWidth();
if (UNLIKELY(item_result.hyphen_shape_result)) if (UNLIKELY(item_result.is_hyphenated))
item_result.inline_size += item_result.HyphenInlineSize(); item_result.inline_size += item_result.HyphenInlineSize();
item_result.shape_result = ShapeResultView::Create(shape_result.get()); item_result.shape_result = ShapeResultView::Create(shape_result.get());
} else if (item_result.item->Type() == NGInlineItem::kAtomicInline) { } else if (item_result.item->Type() == NGInlineItem::kAtomicInline) {
......
<!DOCTYPE html>
<style>
div {
text-align: justify;
width: 10ch;
}
</style>
<div>abc def ghijkl</div>
<div>abc def ghijkl</div>
<div>abc def ghijkl</div>
<!DOCTYPE html>
<title>text-align: justify with soft-hyphens</title>
<link rel='author' title='Koji Ishii' href='mailto:kojii@chromium.org'>
<link rel='help' href='https://drafts.csswg.org/css-text-3/#text-align-property'>
<link rel='match' href='reference/text-align-justify-shy-ref-001.html'>
<style>
div {
text-align: justify;
width: 10ch;
}
</style>
<div>abc def ghijkl</div>
<div>ab&shy;c def ghijkl</div>
<div>ab<span>&shy;</span>c def ghijkl</div>
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