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

Issue 114043002: Fix issue with selection being lost when InsertListCommand changes the list type. (Closed)

Created:
7 years ago by arpitab_
Modified:
6 years, 5 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Fix issue with selection being lost when InsertListCommand changes the list type. When changing the list type (from ordered to unordered or vice-versa) of a list item, a new list containing that list item is created. Now, if that same list item (contained within the new list) is selected in its entirety and then its list type reversed again, it merges itself back into the original list. However, post this merge, the selection over that list item is lost. The selection is lost because we lose the 'start' of the selection. We thus ought to maintain the start index of the selection in the same way we maintain the end index of the selection before merging the two lists.(Done in InsertListCommand::doApply()) The reason why this behavior is observed only when a list item is selected in its entirety is because we do preserve the start of the selection in case the original selection spans across multiple paragraphs, but skip this (the if check in doApply()) if the start and the end of the selection lie on the same line. So now, we simply need to maintain the indices for the start and the end of the selection before we insert or merge new lists. Afterwards, we can reset the ending selection using these start and end indices. The selection range for the existing test, insert-list-nested-with-orphaned.html changes with this fix. It now sets the selection over the entire list, as expected. The test initially sets the selection over the entire list which was later lost after performing the insertOrderedList command. BUG=328030 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177084

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fixing nits #

Total comments: 2

Patch Set 3 : Moving updateLayout to doApply() #

Total comments: 1

Patch Set 4 : Fixing nits #

Patch Set 5 : Updated patch #

Total comments: 2

Patch Set 6 : Fixing nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -32 lines) Patch
M LayoutTests/editing/execCommand/insert-list-nested-with-orphaned-expected.txt View 2 chunks +2 lines, -2 lines 0 comments Download
A + LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html View 1 2 3 4 1 chunk +6 lines, -5 lines 0 comments Download
A LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem-expected.txt View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download
M Source/core/editing/InsertListCommand.cpp View 1 2 3 4 5 3 chunks +28 lines, -25 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
arpitab_
7 years ago (2013-12-12 14:35:46 UTC) #1
yosin_UTC9
https://codereview.chromium.org/114043002/diff/1/LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html File LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html (right): https://codereview.chromium.org/114043002/diff/1/LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html#newcode15 LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html:15: document.execCommand('InsertUnOrderedList', false, null); nit: we don't need to specify ...
7 years ago (2013-12-13 01:10:40 UTC) #2
arpitab_
Hi Yoshi, Thanks for the review. Have uploaded another patch after fixing the nits. On ...
7 years ago (2013-12-13 12:00:43 UTC) #3
ojan
7 years ago (2013-12-18 01:34:31 UTC) #4
leviw_travelin_and_unemployed
> Fixing selection over list items when changing the list order type of the existing ...
7 years ago (2013-12-18 21:39:42 UTC) #5
arpitab_
Thanks for the review Levi. On 2013/12/18 21:39:42, Levi wrote: > > Fixing selection over ...
7 years ago (2013-12-20 10:12:10 UTC) #6
arpitab_
review pls?
6 years, 11 months ago (2014-01-16 07:24:42 UTC) #7
yosin_UTC9
ACK https://codereview.chromium.org/114043002/diff/80001/LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html File LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html (right): https://codereview.chromium.org/114043002/diff/80001/LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html#newcode16 LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html:16: Markup.description("This tests verifies that the selection is properly ...
6 years, 11 months ago (2014-01-16 08:19:49 UTC) #8
arpitab_
On 2014/01/16 08:19:49, Yoshi wrote: > ACK > > https://codereview.chromium.org/114043002/diff/80001/LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html > File > LayoutTests/editing/execCommand/selection-after-switch-type-of-listitem.html > ...
6 years, 11 months ago (2014-01-16 10:40:09 UTC) #9
arpitabahuguna
@leviw, @yosin, @yutak Have uploaded an updated patch for this issue. PTAL.
6 years, 6 months ago (2014-06-24 14:26:04 UTC) #10
arpitabahuguna
6 years, 6 months ago (2014-06-24 14:27:18 UTC) #11
yosin_UTC9
LGTM Please wait for OWNERS review for committing. Sorry for late response. +tkent@ for OWNERS ...
6 years, 5 months ago (2014-06-27 02:15:46 UTC) #12
tkent
rslgtm. I recommend to wrap long paragraphs in the CL description. https://codereview.chromium.org/114043002/diff/180001/Source/core/editing/InsertListCommand.cpp File Source/core/editing/InsertListCommand.cpp (right): ...
6 years, 5 months ago (2014-06-27 05:04:57 UTC) #13
arpitabahuguna
Thank-you for the lgtm @yosi and @tkent! I'll upload another patch fixing the nit. Shall ...
6 years, 5 months ago (2014-06-27 06:15:31 UTC) #14
arpitabahuguna
The CQ bit was checked by a.bah@chromium.org
6 years, 5 months ago (2014-06-27 06:44:37 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/a.bah@samsung.com/114043002/200001
6 years, 5 months ago (2014-06-27 06:45:46 UTC) #16
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 5 months ago (2014-06-27 07:35:42 UTC) #17
commit-bot: I haz the power
6 years, 5 months ago (2014-06-27 08:46:04 UTC) #18
Message was sent while issue was closed.
Change committed as 177084

Powered by Google App Engine
This is Rietveld 408576698