Commit 209ce813 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Expand FindLeftNonPseudoNodeInlineBox() into the call site in VisibleUnit.cpp

This patch expands |FindLeftNonPseudoNodeInlineBox()| into the call site since
it is used once to reduce source code size for improving code health.

This patch is a follow-up of the patch[1].

The patch[2] does same thing for |FindRightNonPseudoNodeInlineBox()|

[1] http://crrev.com/c/882531 Convert LineEndpointComputationMode to template
parameter in EndPositionForLine()
[2] http://crrev.com/c/885683 Expand FindRightNonPseudoNodeInlineBox() into the
call site in VisibleUnit.cpp

Change-Id: I11df57f02eaa2f7681751f299948ab0ee8da8e8d
Reviewed-on: https://chromium-review.googlesource.com/885683
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531826}
parent 5e7c6952
......@@ -227,10 +227,6 @@ struct LogicalOrdering {
}
};
// TODO(editing-dev): Move implementation of |FindLeftNonPseudoNodeInlineBox()|
// to |VisualOrdering::EndNodeAndBox()|.
InlineBox* FindLeftNonPseudoNodeInlineBox(const RootInlineBox&);
// Provides start end end of line in visual order for implementing expanding
// selection in line granularity.
struct VisualOrdering {
......@@ -254,10 +250,12 @@ struct VisualOrdering {
// represented by a VisiblePosition. Use whatever precedes instead.
// TODO(editing-dev): We should consider text-direction of line to
// find non-pseudo node.
InlineBox* const end_box = FindLeftNonPseudoNodeInlineBox(root_box);
if (!end_box)
return {nullptr, nullptr};
return {end_box->GetLineLayoutItem().NonPseudoNode(), end_box};
for (InlineBox* inline_box = root_box.LastLeafChild(); inline_box;
inline_box = inline_box->PrevLeafChild()) {
if (inline_box->GetLineLayoutItem().NonPseudoNode())
return {inline_box->GetLineLayoutItem().NonPseudoNode(), inline_box};
}
return {nullptr, nullptr};
}
};
......@@ -428,19 +426,6 @@ VisiblePositionInFlatTree LogicalStartOfLine(
LogicalStartOfLine(current_position.ToPositionWithAffinity()));
}
namespace {
// TODO(editing-dev): Move implementation of |FindLeftNonPseudoNodeInlineBox()|
// to |VisualOrdering::EndNodeAndBox()|.
InlineBox* FindLeftNonPseudoNodeInlineBox(const RootInlineBox& root_box) {
for (InlineBox* runner = root_box.LastLeafChild(); runner;
runner = runner->PrevLeafChild()) {
if (runner->GetLineLayoutItem().NonPseudoNode())
return runner;
}
return nullptr;
}
} // anonymous namespace
template <typename Strategy, typename Ordering>
static PositionWithAffinityTemplate<Strategy> EndPositionForLine(
const PositionWithAffinityTemplate<Strategy>& c) {
......
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