Commit 1cc93c3a authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

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

This patch expands |FindRightNonPseudoNodeInlineBox()| 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 |FindLeftNonPseudoNodeInlineBox()|

[1] http://crrev.com/c/882791 LineEndpointComputationMode to template parameter
in StartPositionForLine()
[2] http://crrev.com/c/885683 Expand FindLeftNonPseudoNodeInlineBox() into the
call site in VisibleUnit.cpp

Change-Id: I57ae8c462a3b76ee07f41f3cabd6579765ee1a20
Reviewed-on: https://chromium-review.googlesource.com/885663
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531827}
parent 209ce813
...@@ -164,15 +164,6 @@ Node* NextLeafWithSameEditability(Node* node, EditableType editable_type) { ...@@ -164,15 +164,6 @@ Node* NextLeafWithSameEditability(Node* node, EditableType editable_type) {
return nullptr; return nullptr;
} }
InlineBox* FindRightNonPseudoNodeInlineBox(const RootInlineBox& root_box) {
for (InlineBox* runner = root_box.FirstLeafChild(); runner;
runner = runner->NextLeafChild()) {
if (runner->GetLineLayoutItem().NonPseudoNode())
return runner;
}
return nullptr;
}
template <typename Strategy, typename Ordering> template <typename Strategy, typename Ordering>
PositionWithAffinityTemplate<Strategy> StartPositionForLine( PositionWithAffinityTemplate<Strategy> StartPositionForLine(
const PositionWithAffinityTemplate<Strategy>& c) { const PositionWithAffinityTemplate<Strategy>& c) {
...@@ -237,10 +228,12 @@ struct VisualOrdering { ...@@ -237,10 +228,12 @@ struct VisualOrdering {
// represented by a VisiblePosition. Use whatever follows instead. // represented by a VisiblePosition. Use whatever follows instead.
// TODO(editing-dev): We should consider text-direction of line to // TODO(editing-dev): We should consider text-direction of line to
// find non-pseudo node. // find non-pseudo node.
InlineBox* const start_box = FindRightNonPseudoNodeInlineBox(root_box); for (InlineBox* inline_box = root_box.FirstLeafChild(); inline_box;
if (!start_box) inline_box = inline_box->NextLeafChild()) {
return {nullptr, nullptr}; if (inline_box->GetLineLayoutItem().NonPseudoNode())
return {start_box->GetLineLayoutItem().NonPseudoNode(), start_box}; return {inline_box->GetLineLayoutItem().NonPseudoNode(), inline_box};
}
return {nullptr, nullptr};
} }
static std::pair<Node*, InlineBox*> EndNodeAndBoxOf( static std::pair<Node*, InlineBox*> EndNodeAndBoxOf(
......
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