Index: Source/core/editing/htmlediting.cpp |
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp |
index 721a3afc75e61b9ac4dc4b994cbc2d844ae3aaa5..a15a40e9988df27afc6c0263da367eb2270ce13f 100644 |
--- a/Source/core/editing/htmlediting.cpp |
+++ b/Source/core/editing/htmlediting.cpp |
@@ -250,12 +250,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->isDocumentFragment() && !node->layoutObject()) |
leviw_travelin_and_unemployed
2015/06/29 20:17:56
Can you help me understand why this is needed?
changseok
2015/06/30 05:50:58
I'm not sure if I correctly understand the root ca
yosin_UTC9
2015/07/01 01:50:12
Bottom line:
You don't need to check |!node->isDoc
|
+ p = lastPositionInOrAfterNode(node); |
+ } |
} |
return Position(); |
} |
@@ -286,12 +291,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->isDocumentFragment() && !node->layoutObject()) |
+ p = PositionType::firstPositionInOrBeforeNode(node); |
+ } |
} |
return PositionType(); |
} |