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

Issue 2755013004: Improve how DocumentMarkerController updates markers in response to text edits (Closed)

Created:
3 years, 9 months ago by rlanday
Modified:
3 years, 8 months ago
CC:
aelias_OOO_until_Jul13, blink-reviews, chromium-reviews, editing-dev_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve how DocumentMarkerController updates markers in response to text edits This is basically https://codereview.chromium.org/2692093003 with the changes to make DocumentMarkerController use SynchronousMutationObserver split off into a separate CL (https://codereview.chromium.org/2755953004). I need DocumentMarkerController to update markers more gracefully in response to edits in order to implement SuggestionSpan support on Android. For example, if we have the string "word1 word2" marked with a DocumentMarker and CompositeEditCommand::replaceTextInNode() is used to replace word1 or word2 with different text, the new text should still be inside the marked range. There's currently a method CompositeEditCommand::replaceTextInNodePreservingMarkers(), which was added to fix some particular case to support a marker type which no longer exists (DeletedAutocorrection): https://bugs.webkit.org/show_bug.cgi?id=60555 This is no longer necessary after this CL since we can handle all the updates more correctly inside DocumentMarkerController. For example, if we have a string like "Initial text blah" and we add a marker around " text " and delete "Initial" and "blah", we end up with " text ". Then DeleteSelectionCommand::fixupWhitespace() runs, and replaces the spaces with non-breaking spaces. The current behavior is that the NBSPs are no longer in the marked range, since DocumentMarkerController doesn't currently support keeping the replaced text in the marked range, but replaceTextInNodePreservingMarkers() runs and adds new markers to the NBSPs. So we still end up with " text " being marked but now we have three separate markers, which is undesirable for some use cases (e.g. text suggestions, because we don't know what range of text we're actually supposed to replace now). With the changes in this CL, DocumentMarkerController is able to keep a single marker around " text ". The changes to the expected output for InputMethodControllerTest may be helpful in understanding the behavioral changes here. BUG=672259 Review-Url: https://codereview.chromium.org/2755013004 Cr-Commit-Position: refs/heads/master@{#464236} Committed: https://chromium.googlesource.com/chromium/src/+/d6ef615a1a2154d3435b9a09afcd8f6cd929f275

Patch Set 1 #

Patch Set 2 : Rebase on master (shouldn't be any actual changes) #

Patch Set 3 : Rebase on MarkerTypeIterator so trybots for CLs that need that can build properly #

Patch Set 4 : Rebase #

Total comments: 1

Patch Set 5 : Put shifting logic in relocateMarkerIfNeeded() method #

Total comments: 2

Patch Set 6 : Fix insertion behavior, add tests, remove TODO #

Patch Set 7 : Fix case where beginning of marker is being replaced #

Patch Set 8 : Remove logging code #

Patch Set 9 : Rebase (attempting to fix failing test bots) #

Patch Set 10 : Rebase (Vector::remove() => Vector::erase()) #

Total comments: 3

Patch Set 11 : Move offset calculation into DocumentMarker #

Total comments: 1

Patch Set 12 : Include DocumentMarker tests #

Total comments: 1

Patch Set 13 : Rename getShiftedMarkerPosition(), use Optional #

Patch Set 14 : Rebase, don't accidentally include two other CLs #

Patch Set 15 : Rebase #

Patch Set 16 : Rebase, remove dependencies #

Patch Set 17 : Actually remove dependencies #

Patch Set 18 : Split up InputMethodControllerTest test cases #

Patch Set 19 : Rebase on renaming; don't split markers on delete #

Patch Set 20 : Rename a few more things #

Patch Set 21 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+482 lines, -170 lines) Patch
M third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 chunks +197 lines, -44 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 7 chunks +7 lines, -57 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarker.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +46 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 chunks +41 lines, -54 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +171 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 111 (77 generated)
rlanday
3 years, 9 months ago (2017-03-17 22:31:32 UTC) #5
Xiaocheng
Still lgtm.
3 years, 9 months ago (2017-03-17 23:02:54 UTC) #6
yosin_UTC9
almost good shape! https://codereview.chromium.org/2755013004/diff/60001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2755013004/diff/60001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode853 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:853: if (marker.startOffset() > offset) { It ...
3 years, 9 months ago (2017-03-23 04:10:26 UTC) #21
rlanday
On 2017/03/23 at 04:10:26, yosin wrote: > almost good shape! > > https://codereview.chromium.org/2755013004/diff/60001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp > File ...
3 years, 9 months ago (2017-03-23 17:29:52 UTC) #24
rlanday
https://codereview.chromium.org/2755013004/diff/80001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2755013004/diff/80001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode658 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:658: if (marker->startOffset() > offset) { I think there's one ...
3 years, 9 months ago (2017-03-23 22:52:00 UTC) #27
rlanday
On 2017/03/23 at 22:52:00, rlanday wrote: > https://codereview.chromium.org/2755013004/diff/80001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp > File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): > > https://codereview.chromium.org/2755013004/diff/80001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode658 ...
3 years, 9 months ago (2017-03-24 00:54:42 UTC) #29
rlanday
On 2017/03/24 at 00:54:42, rlanday wrote: > On 2017/03/23 at 22:52:00, rlanday wrote: > > ...
3 years, 9 months ago (2017-03-24 01:09:49 UTC) #31
rlanday
Ok, all the tests are passing now, I think the behavior is correct :)
3 years, 9 months ago (2017-03-24 01:23:21 UTC) #35
yosin_UTC9
On 2017/03/24 at 01:23:21, rlanday wrote: > Ok, all the tests are passing now, I ...
3 years, 9 months ago (2017-03-24 01:54:57 UTC) #39
rlanday
On 2017/03/24 at 01:54:57, yosin wrote: > On 2017/03/24 at 01:23:21, rlanday wrote: > > ...
3 years, 9 months ago (2017-03-24 03:47:23 UTC) #44
rlanday
Oops, hit "Send Message" too quick... I had accidentally left some logging code in, the ...
3 years, 9 months ago (2017-03-24 03:48:02 UTC) #45
rlanday
On 2017/03/24 at 03:48:02, rlanday wrote: > Oops, hit "Send Message" too quick... > > ...
3 years, 9 months ago (2017-03-27 20:58:24 UTC) #50
rlanday
I got the trybots working (and slipped on the "Send Message" button again..."
3 years, 9 months ago (2017-03-27 20:59:06 UTC) #51
rlanday
I got the trybots working (and slipped on the "Send Message" button again..."
3 years, 9 months ago (2017-03-27 20:59:12 UTC) #52
Xiaocheng
There are two seemingly orthogonal change: Removal of CEC::replaceTextInNodePreservingMarkers, and modification to DMC in its ...
3 years, 8 months ago (2017-03-29 18:31:02 UTC) #57
Xiaocheng
https://codereview.chromium.org/2755013004/diff/180001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2755013004/diff/180001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode649 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:649: bool DocumentMarkerController::relocateMarkerIfNeeded( Can we implement this function directly in ...
3 years, 8 months ago (2017-03-29 18:35:19 UTC) #58
Xiaocheng
Talked offline. This patch moves the functionality of the removed function to DMC, so the ...
3 years, 8 months ago (2017-03-29 19:37:55 UTC) #59
rlanday
On 2017/03/29 at 19:37:55, xiaochengh wrote: > Talked offline. This patch moves the functionality of ...
3 years, 8 months ago (2017-03-29 20:31:18 UTC) #62
Xiaocheng
https://codereview.chromium.org/2755013004/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h File third_party/WebKit/Source/core/editing/markers/DocumentMarker.h (right): https://codereview.chromium.org/2755013004/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h#newcode170 third_party/WebKit/Source/core/editing/markers/DocumentMarker.h:170: ShiftMarkerResult getShiftedMarkerPosition(unsigned offset, Please also move its unit tests ...
3 years, 8 months ago (2017-03-29 23:25:08 UTC) #65
rlanday
On 2017/03/29 at 23:25:08, xiaochengh wrote: > https://codereview.chromium.org/2755013004/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h > File third_party/WebKit/Source/core/editing/markers/DocumentMarker.h (right): > > https://codereview.chromium.org/2755013004/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h#newcode170 ...
3 years, 8 months ago (2017-03-30 00:09:44 UTC) #67
Xiaocheng
lgtm
3 years, 8 months ago (2017-03-30 00:14:49 UTC) #69
yosin_UTC9
https://codereview.chromium.org/2755013004/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h File third_party/WebKit/Source/core/editing/markers/DocumentMarker.h (right): https://codereview.chromium.org/2755013004/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h#newcode170 third_party/WebKit/Source/core/editing/markers/DocumentMarker.h:170: ShiftMarkerResult getShiftedMarkerPosition(unsigned offset, Since this function is not getter, ...
3 years, 8 months ago (2017-03-30 01:46:08 UTC) #70
rlanday
On 2017/03/30 at 01:46:08, yosin wrote: > https://codereview.chromium.org/2755013004/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h > File third_party/WebKit/Source/core/editing/markers/DocumentMarker.h (right): > > https://codereview.chromium.org/2755013004/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h#newcode170 ...
3 years, 8 months ago (2017-03-30 02:28:05 UTC) #74
rlanday
This CL has no dependencies, are there any remaining issues? I just split up the ...
3 years, 8 months ago (2017-04-07 00:50:58 UTC) #87
yosin_UTC9
On 2017/04/07 at 00:50:58, rlanday wrote: > This CL has no dependencies, are there any ...
3 years, 8 months ago (2017-04-10 03:22:09 UTC) #90
rlanday
On 2017/04/10 at 03:22:09, yosin wrote: > Could you rebase and upload for grate blink ...
3 years, 8 months ago (2017-04-10 19:00:59 UTC) #91
Xiaocheng
still lgtm (seems to be the third one I gave to this CL)
3 years, 8 months ago (2017-04-10 21:14:21 UTC) #94
yosin_UTC9
lgtm
3 years, 8 months ago (2017-04-12 01:47:36 UTC) #95
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/2755013004/400001
3 years, 8 months ago (2017-04-12 18:22:27 UTC) #98
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/360880)
3 years, 8 months ago (2017-04-12 19:44:47 UTC) #100
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/2755013004/400001
3 years, 8 months ago (2017-04-12 21:49:27 UTC) #102
commit-bot: I haz the power
Prior attempt to commit was detected, but we were not able to check whether the ...
3 years, 8 months ago (2017-04-13 00:44:47 UTC) #105
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/2755013004/400001
3 years, 8 months ago (2017-04-13 01:06:31 UTC) #108
commit-bot: I haz the power
3 years, 8 months ago (2017-04-13 01:49:33 UTC) #111
Message was sent while issue was closed.
Committed patchset #21 (id:400001) as
https://chromium.googlesource.com/chromium/src/+/d6ef615a1a2154d3435b9a09afcd...

Powered by Google App Engine
This is Rietveld 408576698