| Index: third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
|
| index 624a66267d6c0b6620ffdfc98e00facc41445f91..803bce1662c5f2f007ebd098521196b7a2ea06a6 100644
|
| --- a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
|
| @@ -321,6 +321,15 @@ VisiblePositionInFlatTree LogicalStartOfLine(
|
| current_position.ToPositionWithAffinity()));
|
| }
|
|
|
| +InlineBox* FindLeftNonPseudoNodeInlineBox(const RootInlineBox& root_box) {
|
| + for (InlineBox* runner = root_box.LastLeafChild(); runner;
|
| + runner = runner->PrevLeafChild()) {
|
| + if (runner->GetLineLayoutItem().NonPseudoNode())
|
| + return runner;
|
| + }
|
| + return nullptr;
|
| +}
|
| +
|
| template <typename Strategy>
|
| static VisiblePositionTemplate<Strategy> EndPositionForLine(
|
| const VisiblePositionTemplate<Strategy>& c,
|
| @@ -351,17 +360,12 @@ static VisiblePositionTemplate<Strategy> EndPositionForLine(
|
| // Generated content (e.g. list markers and CSS :before and :after
|
| // pseudo elements) have no corresponding DOM element, and so cannot be
|
| // represented by a VisiblePosition. Use whatever precedes instead.
|
| - end_box = root_box->LastLeafChild();
|
| - while (true) {
|
| - if (!end_box)
|
| - return VisiblePositionTemplate<Strategy>();
|
| -
|
| - end_node = end_box->GetLineLayoutItem().NonPseudoNode();
|
| - if (end_node)
|
| - break;
|
| -
|
| - end_box = end_box->PrevLeafChild();
|
| - }
|
| + // TODO(editing-dev): We should consider text-direction of line to
|
| + // find non-pseudo node.
|
| + end_box = FindLeftNonPseudoNodeInlineBox(*root_box);
|
| + if (!end_box)
|
| + return VisiblePositionTemplate<Strategy>();
|
| + end_node = end_box->GetLineLayoutItem().NonPseudoNode();
|
| }
|
|
|
| PositionTemplate<Strategy> pos;
|
|
|