| Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| index 0fe37bfec988ce5ee355ab3af0f81238c6e28496..00d5a2ddf47d0ad3c69797b4ca4f7fec85df99fa 100644
|
| --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| @@ -1463,6 +1463,22 @@ static bool DoesContinueOnNextLine(const LayoutText& text_layout_object,
|
| return true;
|
| }
|
|
|
| +// Returns true if |text_layout_object| has visible first-letter.
|
| +bool HasVisibleFirstLetter(const LayoutText& text_layout_object) {
|
| + if (!text_layout_object.IsTextFragment())
|
| + return false;
|
| + const LayoutTextFragment& layout_text_fragment =
|
| + ToLayoutTextFragment(text_layout_object);
|
| + if (!layout_text_fragment.IsRemainingTextLayoutObject())
|
| + return false;
|
| + const LayoutObject* first_letter_layout_object =
|
| + layout_text_fragment.GetFirstLetterPseudoElement()->GetLayoutObject();
|
| + if (!first_letter_layout_object)
|
| + return false;
|
| + return first_letter_layout_object->Style()->Visibility() ==
|
| + EVisibility::kVisible;
|
| +}
|
| +
|
| // TODO(editing-dev): This function is just moved out from
|
| // |MostBackwardCaretPosition()|. We should study this function more and
|
| // name it appropriately. See https://trac.webkit.org/changeset/32438/
|
| @@ -1475,20 +1491,11 @@ static bool CanBeBackwardCaretPosition(const LayoutText* text_layout_object,
|
| InlineTextBox* const last_text_box = text_layout_object->LastTextBox();
|
| for (InlineTextBox* box : InlineTextBoxesOf(*text_layout_object)) {
|
| if (text_offset == box->Start()) {
|
| - if (text_layout_object->IsTextFragment() &&
|
| - ToLayoutTextFragment(text_layout_object)
|
| - ->IsRemainingTextLayoutObject()) {
|
| + if (HasVisibleFirstLetter(*text_layout_object)) {
|
| // |offset_in_node| is at start of remaining text of
|
| // |Text| node with :first-letter.
|
| DCHECK_GE(offset_in_node, 1);
|
| - LayoutObject* first_letter_layout_object =
|
| - ToLayoutTextFragment(text_layout_object)
|
| - ->GetFirstLetterPseudoElement()
|
| - ->GetLayoutObject();
|
| - if (first_letter_layout_object &&
|
| - first_letter_layout_object->Style()->Visibility() ==
|
| - EVisibility::kVisible)
|
| - return true;
|
| + return true;
|
| }
|
| continue;
|
| }
|
|
|