Commit 7d07861c authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Rename NGPhysicalTextFragment::Length() to TextLength()

This patch renames |NGPhysicalTextFragment::Length()| to |TextLength()| to
simplify source code for improving code health.

This patch is follow-up the CL[1] which introduced |TextLength()|.

[1] http://crrev.com/c/1794542 Make NGTextFragmentPainter faster as before

Change-Id: I617c5c9871a315b1df72e09c8e78f1780048f4a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798062
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695544}
parent 55d9c72f
......@@ -147,8 +147,8 @@ unsigned NGAbstractInlineTextBox::Len() const {
if (!fragment_)
return 0;
if (NeedsTrailingSpace())
return PhysicalTextFragment().Length() + 1;
return PhysicalTextFragment().Length();
return PhysicalTextFragment().TextLength() + 1;
return PhysicalTextFragment().TextLength();
}
AbstractInlineTextBox::Direction NGAbstractInlineTextBox::GetDirection() const {
......
......@@ -249,8 +249,8 @@ bool NGLineTruncator::TruncateChild(
IsLtr(line_direction_) ? space_for_child
: shape_result->Width() - space_for_child,
line_direction_);
DCHECK_LE(new_length, fragment.Length());
if (!new_length || new_length == fragment.Length()) {
DCHECK_LE(new_length, fragment.TextLength());
if (!new_length || new_length == fragment.TextLength()) {
if (!is_first_child)
return false;
new_length = !new_length ? 1 : new_length - 1;
......
......@@ -244,7 +244,7 @@ unsigned NGPhysicalTextFragment::TextOffsetForPoint(
LayoutUnit inline_offset = IsLtr(ResolvedDirection())
? point_in_line_direction
: size.inline_size - point_in_line_direction;
DCHECK_EQ(1u, Length());
DCHECK_EQ(1u, TextLength());
return inline_offset <= size.inline_size / 2 ? StartOffset() : EndOffset();
}
......
......@@ -63,10 +63,10 @@ class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragment {
bool IsSymbolMarker() const { return TextType() == kSymbolMarker; }
// TODO(yosin): We should replace |Length()| to |TextLength()|.
unsigned Length() const { return end_offset_ - start_offset_; }
unsigned TextLength() const { return Length(); }
StringView Text() const { return StringView(text_, start_offset_, Length()); }
unsigned TextLength() const { return end_offset_ - start_offset_; }
StringView Text() const {
return StringView(text_, start_offset_, TextLength());
}
const String& TextContent() const { return text_; }
// ShapeResult may be nullptr if |IsFlowControl()|.
......
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