Commit 65d0489c authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Rename ShapingLineBreaker::kStartShouldBeSafe to kDontReshapeStart

The naming turned out to be confusing.

Bug: 636993
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I16fb06f080caac6ef9356edb187fe8032ef8f9ef
Reviewed-on: https://chromium-review.googlesource.com/1133098Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574389}
parent bcd11ade
......@@ -423,9 +423,9 @@ void NGLineBreaker::BreakText(NGInlineItemResult* item_result,
available_width = std::max(LayoutUnit(0), available_width);
// Use kStartShouldBeSafe if at the beginning of a line.
unsigned options = 0;
if (offset_ == line_info->StartOffset())
options |= ShapingLineBreaker::kStartShouldBeSafe;
unsigned options = ShapingLineBreaker::kDefaultOptions;
if (offset_ != line_info->StartOffset())
options |= ShapingLineBreaker::kDontReshapeStart;
// Use kNoResultIfOverflow if 'break-word' and we're trying to break normally
// because if this item overflows, we will rewind and break line again. The
......
......@@ -243,9 +243,9 @@ scoped_refptr<ShapeResult> ShapingLineBreaker::ShapeLine(
unsigned candidate_break =
result_->CachedOffsetForPosition(end_position) + range_start;
unsigned first_safe = (options & kStartShouldBeSafe)
? result_->CachedNextSafeToBreakOffset(start)
: start;
unsigned first_safe = (options & kDontReshapeStart)
? start
: result_->CachedNextSafeToBreakOffset(start);
DCHECK_GE(first_safe, start);
if (candidate_break >= range_end) {
// The |result_| does not have glyphs to fill the available space,
......
......@@ -66,9 +66,10 @@ class PLATFORM_EXPORT ShapingLineBreaker final {
// Shapes a line of text by finding a valid and appropriate break opportunity
// based on the shaping results for the entire paragraph.
enum Options {
// Enforce the start to be safe-to-break. Set for the beginning of each
// wrapped line, but not for subsequent ShapeResults.
kStartShouldBeSafe = 1,
kDefaultOptions = 0,
// Disable reshpaing the start edge even if the start offset is not safe-
// to-break. Set if this is not at the start edge of a wrapped line.
kDontReshapeStart = 1,
// Returns nullptr if this line overflows. When the word is very long, such
// as URL or data, creating ShapeResult is expensive. Set this option to
// suppress if ShapeResult is not needed when this line overflows.
......@@ -81,7 +82,7 @@ class PLATFORM_EXPORT ShapingLineBreaker final {
scoped_refptr<ShapeResult> ShapeLine(unsigned start_offset,
LayoutUnit available_space,
Result* result_out) {
return ShapeLine(start_offset, available_space, kStartShouldBeSafe,
return ShapeLine(start_offset, available_space, kDefaultOptions,
result_out);
}
......
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