Index: Source/core/editing/htmlediting.cpp |
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp |
index 183a2580a9a40156124e80505bfb7b706f964086..76c226e863634a61b544a50229c96013742d32fc 100644 |
--- a/Source/core/editing/htmlediting.cpp |
+++ b/Source/core/editing/htmlediting.cpp |
@@ -355,12 +355,17 @@ PositionInComposedTree nextCandidate(const PositionInComposedTree& position) |
Position nextVisuallyDistinctCandidate(const Position& position) |
{ |
+ // TODO(changseok): Use PositionIterator instead. |
Position p = position; |
Position downstreamStart = p.downstream(); |
while (!p.atEndOfTree()) { |
p = p.next(Character); |
if (p.isCandidate() && p.downstream() != downstreamStart) |
return p; |
+ if (auto* node = p.containerNode()) { |
+ if (!node->layoutObject()) |
+ p = lastPositionInOrAfterNode(node); |
+ } |
} |
return Position(); |
} |
@@ -391,12 +396,17 @@ PositionInComposedTree previousCandidate(const PositionInComposedTree& position) |
template <typename PositionType> |
PositionType previousVisuallyDistinctCandidateAlgorithm(const PositionType& position) |
{ |
+ // TODO(changseok): Use PositionIterator instead. |
PositionType p = position; |
PositionType downstreamStart = p.downstream(); |
while (!p.atStartOfTree()) { |
p = p.previous(Character); |
if (p.isCandidate() && p.downstream() != downstreamStart) |
return p; |
+ if (auto* node = p.containerNode()) { |
+ if (!node->layoutObject()) |
+ p = PositionType::firstPositionInOrBeforeNode(node); |
+ } |
} |
return PositionType(); |
} |