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

Issue 2466833002: selection.setBaseAndExtent with null should not crash. (Closed)

Created:
4 years, 1 month ago by yoichio
Modified:
4 years ago
Reviewers:
yosin_UTC9
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

selection.setBaseAndExtent with null should not crash. setBaseAndExtent is non-nullable in spec: http://w3c.github.io/selection-api/#widl-Selection-setBaseAndExtent-void-Node- anchorNode-unsigned-long-anchorOffset-Node-focusNode-unsigned-long-focusOffset However, there is the issue for that: https://github.com/w3c/selection-api/issues/72 Edge clears selection with null node and Blink virtually does same. 'Virtually' means we go though false DCHECK statements in the release build. This CL refines code path both on debug and release. Besides exact behavior, selection.setBaseAndExtent(null,x,null,y) should not crash and this CL checks it in DOMSelection. This CL makes selection.setBaseAndExtent(null,x,null,y) clear Selection and keeps selection.setBaseAndExtent(base,x,null,y) as selection.collpase(base,x) except x can over base's length. BUG=660848 Committed: https://crrev.com/ebec09cdbe2965a07c54715cf4ba3b50603efe39 Cr-Commit-Position: refs/heads/master@{#435915}

Patch Set 1 #

Patch Set 2 : update #

Total comments: 3

Patch Set 3 : update #

Total comments: 1

Patch Set 4 : update #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -1 line) Patch
A third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html View 1 2 1 chunk +38 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/DOMSelection.cpp View 1 2 3 1 chunk +10 lines, -1 line 0 comments Download

Messages

Total messages: 49 (38 generated)
yoichio
4 years ago (2016-11-29 09:07:12 UTC) #16
yosin_UTC9
Since this patch changes API behavior, Before this patch: setBaseAndExtent(a,1, null, 0) == collapse(a,1) After ...
4 years ago (2016-11-29 09:58:32 UTC) #17
yoichio
On 2016/11/29 09:58:32, Yosi_UTC9 wrote: > Since this patch changes API behavior, > I changed ...
4 years ago (2016-12-02 01:58:50 UTC) #34
yosin_UTC9
https://codereview.chromium.org/2466833002/diff/60001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2466833002/diff/60001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode279 third_party/WebKit/Source/core/editing/DOMSelection.cpp:279: if (!baseNode) { It seems that dealing nullptr explicitly ...
4 years ago (2016-12-02 04:38:02 UTC) #35
yoichio
On 2016/12/02 04:38:02, Yosi_UTC9 wrote: > > if (!extendNode) { > UseCounter::count(frame(), UseCounter::SelectionSetBaseAndExtentNull); > collapse(baseNode, ...
4 years ago (2016-12-02 04:53:33 UTC) #36
yosin_UTC9
On 2016/12/02 at 04:53:33, yoichio wrote: > On 2016/12/02 04:38:02, Yosi_UTC9 wrote: > > > ...
4 years ago (2016-12-02 04:59:40 UTC) #37
yoichio
On 2016/12/02 04:59:40, Yosi_UTC9 wrote: > On 2016/12/02 at 04:53:33, yoichio wrote: > > On ...
4 years ago (2016-12-02 07:03:27 UTC) #39
yosin_UTC9
lgtm
4 years ago (2016-12-02 07:34:59 UTC) #43
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/2466833002/80001
4 years ago (2016-12-02 07:35:13 UTC) #44
commit-bot: I haz the power
Committed patchset #4 (id:80001)
4 years ago (2016-12-02 11:24:19 UTC) #47
commit-bot: I haz the power
4 years ago (2016-12-02 11:26:07 UTC) #49
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/ebec09cdbe2965a07c54715cf4ba3b50603efe39
Cr-Commit-Position: refs/heads/master@{#435915}

Powered by Google App Engine
This is Rietveld 408576698