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

Issue 2772163002: Make {Character,Directional}GranularityStrategy::updateExtent() to handle null position (Closed)

Created:
3 years, 9 months ago by yosin_UTC9
Modified:
3 years, 9 months ago
Reviewers:
tkent, yoichio, Xiaocheng
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make {Character,Directional}GranularityStrategy::updateExtent() to handle null position From patch[1], |GranularityStrategy::updateExtent()| returns invalid |SelectionInDOMTree|, which base is non-null and extent is null, when |updateExtent()| is called with |IntPoint| points an element which can not contain caret, e.g. VIDEO, SELECT, etc. This invalid selection can cause |nullptr| reference in |SelectionInDOMtree::computeStartPositon()| in |Position::operator<()|. Before patch[1], |GranularityStrategy::updateExtent()| returns empty |VisibleSelection| for invalid |SelectionInDOMTree|, base is non-null and extent is null, by |VisibleSelection::validate()|. This patch changes |{Character,Directional}GranularityStrategy::updateExtent()| to handle above case by checking result of |visiblePositionForContentsPoint()|. [1] http://crrev.com/2735143002: Make GranularityStrategy::updateExtent() to return SelectionInDOM instead of VisibleSelection BUG=704529 TEST=run_webkit_unit_tests --gtest_filter=UpdateExtentWithNullPositionForCharacter TEST=run_webkit_unit_tests --gtest_filter=UpdateExtentWithNullPositionForDirectional Review-Url: https://codereview.chromium.org/2772163002 Cr-Commit-Position: refs/heads/master@{#459725} Committed: https://chromium.googlesource.com/chromium/src/+/a4e860c32d99883c2178a332708e69049307209a

Patch Set 1 : 2017-03-25T23:16:42 #

Total comments: 2

Patch Set 2 : 2017-03-27T13:42:09 ASSERT_EQ(visiblePositionForContentsPoint(IntPoint(0, 0))) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -2 lines) Patch
M third_party/WebKit/Source/core/editing/GranularityStrategy.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp View 1 2 chunks +66 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (16 generated)
yosin_UTC9
PTAL
3 years, 9 months ago (2017-03-25 16:15:32 UTC) #10
yoichio
https://codereview.chromium.org/2772163002/diff/20001/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp File third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp (right): https://codereview.chromium.org/2772163002/diff/20001/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp#newcode732 third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp:732: selection().moveRangeSelectionExtent(IntPoint(0, 0)); Could you confirm |visiblePositionForContentsPoint(IntPoint(0, 0))| returns null ...
3 years, 9 months ago (2017-03-27 02:05:35 UTC) #11
yosin_UTC9
PTAL Add ASSERT_EQ for visiblePositionForContentsPoint(IntPoint(0, 0)) https://codereview.chromium.org/2772163002/diff/20001/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp File third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp (right): https://codereview.chromium.org/2772163002/diff/20001/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp#newcode732 third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp:732: selection().moveRangeSelectionExtent(IntPoint(0, 0)); On ...
3 years, 9 months ago (2017-03-27 05:40:03 UTC) #14
yoichio
lgtm
3 years, 9 months ago (2017-03-27 08:09:02 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2772163002/40001
3 years, 9 months ago (2017-03-27 08:45:04 UTC) #19
commit-bot: I haz the power
3 years, 9 months ago (2017-03-27 08:50:37 UTC) #22
Message was sent while issue was closed.
Committed patchset #2 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/a4e860c32d99883c2178a332708e...

Powered by Google App Engine
This is Rietveld 408576698