| 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 8abdcb4c98eaff5baac6ead9d0b929fd4ad0cf91..ae37d3d18e9ba048f1e0c508897f2a077d313a3a 100644
|
| --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| @@ -2241,7 +2241,9 @@ static bool isNonTextLeafChild(LayoutObject* object) {
|
| return true;
|
| }
|
|
|
| -static InlineTextBox* searchAheadForBetterMatch(LayoutObject* layoutObject) {
|
| +static InlineTextBox* searchAheadForBetterMatch(
|
| + LayoutObject* layoutObject,
|
| + EditingBoundaryCrossingRule rule) {
|
| LayoutBlock* container = layoutObject->containingBlock();
|
| for (LayoutObject* next = layoutObject->nextInPreOrder(container); next;
|
| next = next->nextInPreOrder(container)) {
|
| @@ -2252,6 +2254,9 @@ static InlineTextBox* searchAheadForBetterMatch(LayoutObject* layoutObject) {
|
| if (isNonTextLeafChild(next))
|
| return 0;
|
| if (next->isText()) {
|
| + if (rule == CannotCrossEditingBoundary &&
|
| + next->style()->userModify() == READ_ONLY)
|
| + return 0;
|
| InlineTextBox* match = 0;
|
| int minOffset = INT_MAX;
|
| for (InlineTextBox* box = toLayoutText(next)->firstTextBox(); box;
|
| @@ -2324,6 +2329,10 @@ static InlineBoxPosition computeInlineBoxPositionTemplate(
|
| if (canHaveChildrenForEditing(anchorNode) &&
|
| layoutObject->isLayoutBlockFlow() &&
|
| hasRenderedNonAnonymousDescendantsWithHeight(layoutObject)) {
|
| + if (layoutObject->isLayoutBlock() &&
|
| + toLayoutBlock(layoutObject)->childrenInline()) {
|
| + return InlineBoxPosition(inlineBox, caretOffset);
|
| + }
|
| // Try a visually equivalent position with possibly opposite
|
| // editability. This helps in case |this| is in an editable block
|
| // but surrounded by non-editable positions. It acts to negate the
|
| @@ -2377,7 +2386,10 @@ static InlineBoxPosition computeInlineBoxPositionTemplate(
|
| }
|
| if (candidate && candidate == textLayoutObject->lastTextBox() &&
|
| affinity == TextAffinity::Downstream) {
|
| - box = searchAheadForBetterMatch(textLayoutObject);
|
| + box = searchAheadForBetterMatch(textLayoutObject,
|
| + hasEditableStyle(*anchorNode)
|
| + ? CannotCrossEditingBoundary
|
| + : CanCrossEditingBoundary);
|
| if (box)
|
| caretOffset = box->caretMinOffset();
|
| }
|
|
|