summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/editing/visible_units_line.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/editing/visible_units_line.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/editing/visible_units_line.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/core/editing/visible_units_line.cc b/chromium/third_party/blink/renderer/core/editing/visible_units_line.cc
index 90c566c30a0..84bb55bec37 100644
--- a/chromium/third_party/blink/renderer/core/editing/visible_units_line.cc
+++ b/chromium/third_party/blink/renderer/core/editing/visible_units_line.cc
@@ -153,11 +153,12 @@ Node* PreviousLeafWithSameEditability(const Node& node,
return nullptr;
}
-Node* NextLeafWithSameEditability(Node* node, EditableType editable_type) {
+Node* NextLeafWithGivenEditability(Node* node,
+ EditableType editable_type,
+ bool editable) {
if (!node)
return nullptr;
- const bool editable = HasEditableStyle(*node, editable_type);
for (Node* runner = NextAtomicLeafNode(*node); runner;
runner = NextAtomicLeafNode(*runner)) {
if (editable == HasEditableStyle(*runner, editable_type))
@@ -338,12 +339,20 @@ Position NextRootInlineBoxCandidatePosition(
DCHECK(visible_position.IsValid()) << visible_position;
ContainerNode* highest_root =
HighestEditableRoot(visible_position.DeepEquivalent(), editable_type);
- Node* next_node = NextLeafWithSameEditability(node, editable_type);
- while (next_node && InSameLine(*next_node, visible_position))
- next_node = NextLeafWithSameEditability(next_node, kContentIsEditable);
+ // TODO(xiaochengh): We probably also need to pass in the starting editability
+ // to |PreviousLeafWithSameEditability|.
+ const bool is_editable = HasEditableStyle(
+ *visible_position.DeepEquivalent().ComputeContainerNode(), editable_type);
+ Node* next_node =
+ NextLeafWithGivenEditability(node, editable_type, is_editable);
+ while (next_node && InSameLine(*next_node, visible_position)) {
+ next_node = NextLeafWithGivenEditability(next_node, kContentIsEditable,
+ is_editable);
+ }
for (Node* runner = next_node; runner && !runner->IsShadowRoot();
- runner = NextLeafWithSameEditability(runner, editable_type)) {
+ runner =
+ NextLeafWithGivenEditability(runner, editable_type, is_editable)) {
if (HighestEditableRootOfNode(*runner, editable_type) != highest_root)
break;