Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: third_party/WebKit/Source/core/editing/GranularityStrategy.cpp

Issue 2772163002: Make {Character,Directional}GranularityStrategy::updateExtent() to handle null position (Closed)
Patch Set: 2017-03-27T13:42:09 ASSERT_EQ(visiblePositionForContentsPoint(IntPoint(0, 0))) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698