Index: third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
index 0b09b8b90b8991c3117626bdc69333e065f23c26..11b05939e18dd54cf0799187e6f3384d37daf7c1 100644 |
--- a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
+++ b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
@@ -69,8 +69,8 @@ SelectionInDOMTree CharacterGranularityStrategy::updateExtent( |
visiblePositionForContentsPoint(extentPoint, frame); |
const VisibleSelection& selection = |
frame->selection().computeVisibleSelectionInDOMTreeDeprecated(); |
- if (selection.visibleBase().deepEquivalent() == |
- extentPosition.deepEquivalent()) |
+ if (extentPosition.isNull() || selection.visibleBase().deepEquivalent() == |
+ extentPosition.deepEquivalent()) |
return selection.asSelection(); |
return SelectionInDOMTree::Builder() |
.collapse(selection.base()) |
@@ -127,6 +127,8 @@ SelectionInDOMTree DirectionGranularityStrategy::updateExtent( |
VisiblePosition newOffsetExtentPosition = |
visiblePositionForContentsPoint(newOffsetExtentPoint, frame); |
+ if (newOffsetExtentPosition.isNull()) |
+ return selection.asSelection(); |
IntPoint newOffsetLocation = positionLocation(newOffsetExtentPosition); |
// Reset the offset in case of a vertical change in the location (could be |