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

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)

Created:
3 years, 10 months ago by rlanday
Modified:
3 years, 9 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Rewrite DocumentMarkerController to use SynchronousMutationObserver This CL does a couple of things: - Modifies CompositeEditCommand::replaceTextInNode() to use a new editing command SetCharacterDataCommand I introduced in: https://codereview.chromium.org/2706033007 This command allows text replacements to be reported to SynchronousMutationNotifier as an atomic operation, instead of as a delete and then an insert, allowing observers to respond correctly. - Refactors DocumentMarkerController to be a SynchronousMutationObserver instead of having custom notification logic - Removes CompositeEditCommand::replaceTextInNodePreservingMarkers(), which is kind of wonky and was added to support a marker type which has since been removed BUG=672259

Patch Set 1 #

Total comments: 1

Patch Set 2 : Remove calls to showMarkers() #

Patch Set 3 : Remove unused function declaration DocumentMarkerController::markersInRangeInternal() #

Patch Set 4 : Don't try to use -1 as default value for unsigned int #

Total comments: 3

Patch Set 5 : Introduce SetCharacterDataCommand #

Total comments: 19

Patch Set 6 : Rebase on separate CL to add SetCharacterDataCommand #

Total comments: 15

Patch Set 7 : Improve removal of zero-length markers, add PaintInvalidationReason #

Total comments: 5

Patch Set 8 : Make requested changes, remove now-redundant block of code #

Total comments: 1

Patch Set 9 : Remove PaintInvalidationReason (to split off into separate CL) #

Total comments: 7

Patch Set 10 : Remove unnecessary curly braces #

Total comments: 2

Patch Set 11 : Fix didShiftMarker assignment and remove removeZeroLengthMarkers() from header #

Total comments: 4

Patch Set 12 : Fix nits, make test cases more clear #

Total comments: 7

Patch Set 13 : Respond to comments, add TODO for offset bug #

Total comments: 2

Patch Set 14 : Fx tests to match current behavior of master #

Messages

Total messages: 107 (62 generated)
rlanday
https://codereview.chromium.org/2692093003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode764 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:764: removeMarkers(node, startOffset, prevLength); There is a slight behavioral change ...
3 years, 10 months ago (2017-02-14 02:05:29 UTC) #3
rlanday
This is a refactor of DocumentMarkerController to improve how it tracks updates to DocumentMarkers to ...
3 years, 10 months ago (2017-02-14 19:23:01 UTC) #16
yosin_UTC9
https://codereview.chromium.org/2692093003/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2692093003/diff/60001/third_party/WebKit/Source/core/dom/Document.cpp#newcode4257 third_party/WebKit/Source/core/dom/Document.cpp:4257: for (Range* range : m_ranges) Note: We'll change Range ...
3 years, 10 months ago (2017-02-15 02:23:25 UTC) #19
rlanday
@yosin, I've replaced the ScopedNotificationSuppressor with a new SetCharacterDataCommand as you suggested
3 years, 10 months ago (2017-02-15 21:11:37 UTC) #24
yosin_UTC9
https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp File third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp (right): https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp#newcode23 third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp:23: DCHECK_LE(m_offset + m_count, m_node->length()); Please add DCHECK_LT(m_offset, m_node->length()); https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp#newcode27 ...
3 years, 10 months ago (2017-02-20 07:26:27 UTC) #28
yosin_UTC9
3 years, 10 months ago (2017-02-20 07:26:32 UTC) #29
rlanday
https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp File third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp (right): https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp#newcode58 third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp:58: if (!hasEditableStyle(*m_node)) On 2017/02/20 at 07:26:26, yosin_UTC9 wrote: > ...
3 years, 10 months ago (2017-02-21 20:04:06 UTC) #30
rlanday
https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h File third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h (right): https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h#newcode32 third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h:32: Member<Text> m_node; On 2017/02/20 at 07:26:27, yosin_UTC9 wrote: > ...
3 years, 10 months ago (2017-02-21 21:16:55 UTC) #31
rlanday
On 2017/02/21 at 21:16:55, rlanday wrote: > https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h > File third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h (right): > > https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.h#newcode32 ...
3 years, 10 months ago (2017-02-21 21:54:34 UTC) #32
Xiaocheng
https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp File third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp (right): https://codereview.chromium.org/2692093003/diff/80001/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp#newcode58 third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommand.cpp:58: if (!hasEditableStyle(*m_node)) On 2017/02/21 at 20:04:06, rlanday wrote: > ...
3 years, 10 months ago (2017-02-22 01:49:24 UTC) #33
rlanday
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp File third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp#newcode28 third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp:28: #include <algorithm> On 2017/02/22 at 01:49:23, Xiaocheng wrote: > ...
3 years, 10 months ago (2017-02-22 02:01:11 UTC) #34
rlanday
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode866 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:866: for (size_t markerListIndex = 0; On 2017/02/22 at 01:49:23, ...
3 years, 10 months ago (2017-02-22 02:14:57 UTC) #35
yosin_UTC9
On 2017/02/22 at 02:14:57, rlanday wrote: > https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp > File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): > > https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode866 ...
3 years, 10 months ago (2017-02-22 02:20:42 UTC) #36
yosin_UTC9
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode925 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:925: node->layoutObject()->setShouldDoFullPaintInvalidation(); On 2017/02/22 at 02:01:11, rlanday wrote: > On ...
3 years, 10 months ago (2017-02-22 02:25:05 UTC) #37
Xiaocheng
On 2017/02/22 at 02:20:42, yosin wrote: > On 2017/02/22 at 02:14:57, rlanday wrote: > > ...
3 years, 10 months ago (2017-02-22 02:56:50 UTC) #38
Xianzhu
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode925 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:925: node->layoutObject()->setShouldDoFullPaintInvalidation(); On 2017/02/22 02:25:05, yosin_UTC9 wrote: > On 2017/02/22 ...
3 years, 10 months ago (2017-02-22 21:32:56 UTC) #40
rlanday
On 2017/02/22 at 02:20:42, yosin wrote: > On 2017/02/22 at 02:14:57, rlanday wrote: > > ...
3 years, 10 months ago (2017-02-22 22:22:00 UTC) #41
rlanday
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode698 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:698: void DocumentMarkerController::removeZeroLengthMarkers() { On 2017/02/22 at 02:01:10, rlanday wrote: ...
3 years, 10 months ago (2017-02-22 22:53:01 UTC) #42
rlanday
Adding @senorblanco as a reviewer for the PaintInvalidationReason addition
3 years, 10 months ago (2017-02-22 22:58:46 UTC) #47
Xiaocheng
https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode698 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:698: void DocumentMarkerController::removeZeroLengthMarkers() { On 2017/02/22 at 22:53:01, rlanday wrote: ...
3 years, 10 months ago (2017-02-22 23:39:28 UTC) #48
rlanday
On 2017/02/22 at 23:39:28, xiaochengh wrote: > https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp > File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): > > https://codereview.chromium.org/2692093003/diff/100001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode698 ...
3 years, 10 months ago (2017-02-23 01:27:13 UTC) #51
rlanday
https://codereview.chromium.org/2692093003/diff/120001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/120001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode848 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:848: for (size_t markerListIndex = 0; On 2017/02/22 at 23:39:28, ...
3 years, 10 months ago (2017-02-23 01:27:28 UTC) #52
rlanday
> Looks like I broke a text highlighting test case, hmm... The test case just ...
3 years, 10 months ago (2017-02-23 01:55:44 UTC) #55
rlanday
https://codereview.chromium.org/2692093003/diff/120001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/120001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode899 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:899: if ((*marker)->startOffset() == (*marker)->endOffset()) { On 2017/02/23 at 01:27:28, ...
3 years, 10 months ago (2017-02-23 01:55:52 UTC) #56
yosin_UTC9
Just FYI, marker relocation isn't simple as we thought: - https://github.com/eval1749/evita/blob/master/evita/text/models/marker_set.cc - https://github.com/eval1749/evita/blob/master/evita/text/models/marker_set_test.cc On insertion, ...
3 years, 10 months ago (2017-02-23 02:15:46 UTC) #57
rlanday
On 2017/02/23 at 02:15:46, yosin wrote: > Just FYI, marker relocation isn't simple as we ...
3 years, 10 months ago (2017-02-23 05:19:55 UTC) #60
yosin_UTC9
On 2017/02/23 at 05:19:55, rlanday wrote: > On 2017/02/23 at 02:15:46, yosin wrote: > > ...
3 years, 10 months ago (2017-02-23 07:19:55 UTC) #61
yosin_UTC9
+yoichio@ for another eye
3 years, 10 months ago (2017-02-23 07:20:24 UTC) #63
Stephen White
platform/graphics LGTM +chrishtr as an FYI
3 years, 10 months ago (2017-02-23 14:08:45 UTC) #66
rlanday
Removed the PaintInvalidationReason stuff to split off into a separate CL
3 years, 10 months ago (2017-02-23 18:22:15 UTC) #70
Xiaocheng
https://codereview.chromium.org/2692093003/diff/160001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/160001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode265 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:265: if (node->layoutObject()) { nit: no need to add braces ...
3 years, 10 months ago (2017-02-23 18:58:35 UTC) #73
rlanday
Ok, I've made those changes
3 years, 10 months ago (2017-02-24 02:26:32 UTC) #77
yosin_UTC9
Getting closer. https://codereview.chromium.org/2692093003/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/200001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode841 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:841: for (MarkerList::iterator marker = list->begin(); marker != ...
3 years, 10 months ago (2017-02-24 04:36:19 UTC) #83
yoichio
https://codereview.chromium.org/2692093003/diff/180001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/180001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1316 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1316: EXPECT_EQ(5u, document().markers().markers()[0]->endOffset()); It is not unclear what you check. ...
3 years, 10 months ago (2017-02-24 04:52:09 UTC) #84
rlanday
https://codereview.chromium.org/2692093003/diff/180001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/180001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1316 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1316: EXPECT_EQ(5u, document().markers().markers()[0]->endOffset()); On 2017/02/24 at 04:52:09, yoichio wrote: > ...
3 years, 10 months ago (2017-02-24 19:30:26 UTC) #85
rlanday
https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1317 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1317: controller().setCompositionFromExistingText(emptyUnderlines, 5, 9); I actually did end up changing ...
3 years, 10 months ago (2017-02-24 20:23:45 UTC) #88
yosin_UTC9
+changwang@, WDYT? https://codereview.chromium.org/2692093003#msg88 https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#newcode876 third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp:876: if (marker.startOffset() >= marker.endOffset()) { nit: ...
3 years, 9 months ago (2017-02-27 12:56:18 UTC) #92
Changwan Ryu
https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1317 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1317: controller().setCompositionFromExistingText(emptyUnderlines, 5, 9); On 2017/02/24 20:23:45, rlanday wrote: > ...
3 years, 9 months ago (2017-02-27 13:55:58 UTC) #93
rlanday
https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1317 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1317: controller().setCompositionFromExistingText(emptyUnderlines, 5, 9); On 2017/02/27 at 13:55:57, Changwan Ryu ...
3 years, 9 months ago (2017-02-27 18:29:09 UTC) #94
Xiaocheng
https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1317 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1317: controller().setCompositionFromExistingText(emptyUnderlines, 5, 9); On 2017/02/27 at 18:29:09, rlanday wrote: ...
3 years, 9 months ago (2017-02-27 19:31:23 UTC) #95
rlanday
https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2692093003/diff/220001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1317 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1317: controller().setCompositionFromExistingText(emptyUnderlines, 5, 9); On 2017/02/27 at 19:31:23, Xiaocheng wrote: ...
3 years, 9 months ago (2017-02-28 00:49:24 UTC) #96
yosin_UTC9
Could you change description to describe current CL changes exclude history? We can visit history ...
3 years, 9 months ago (2017-02-28 01:29:37 UTC) #99
rlanday
> https://codereview.chromium.org/2692093003/diff/240001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1293 > third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1293: static String getMarkedText(DocumentMarkerController& documentMarkerController, > Could you move IMCTest changes into ...
3 years, 9 months ago (2017-02-28 06:32:49 UTC) #100
rlanday
On 2017/02/28 at 06:32:49, rlanday wrote: > > https://codereview.chromium.org/2692093003/diff/240001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode1293 > > third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:1293: static String getMarkedText(DocumentMarkerController& ...
3 years, 9 months ago (2017-02-28 20:11:03 UTC) #104
rlanday
3 years, 9 months ago (2017-03-17 03:24:03 UTC) #107
Message was sent while issue was closed.
closing because @yosin wants me to split this up

Powered by Google App Engine
This is Rietveld 408576698