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

Issue 2805553003: DocumentMarkerList refactor as an interface (Closed)

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

Description

DocumentMarkerList refactor as an interface This is a sketch of what the DocumentMarkerList hierarchy looks like if we pull all the shared logic out of DocumentMarkerList into a helper class (DocumentMarkerListUtils). I haven't actually implemented most of the helper functions but this should give us some idea of what the code will look like if we implement it this way. BUG=707867

Patch Set 1 #

Total comments: 14

Patch Set 2 : Respond to comments, fill in unimplemented methods #

Total comments: 29

Patch Set 3 : Rebase on renaming patch, respond to comments #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+997 lines, -31 lines) Patch
M third_party/WebKit/Source/core/editing/BUILD.gn View 1 2 2 chunks +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/SplitTextNodeCommand.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/commands/SplitTextNodeCommand.cpp View 1 2 3 chunks +5 lines, -4 lines 0 comments Download
A third_party/WebKit/Source/core/editing/commands/SplitTextNodeCommandTest.cpp View 1 2 1 chunk +97 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.h View 1 2 1 chunk +51 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp View 1 2 1 chunk +65 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h View 1 2 1 chunk +1 line, -5 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp View 1 2 3 chunks +12 lines, -21 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h View 1 2 1 chunk +49 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.cpp View 1 1 chunk +13 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h View 1 2 1 chunk +60 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp View 1 2 1 chunk +183 lines, -0 lines 1 comment Download
A third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerList.h View 1 2 1 chunk +57 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerList.cpp View 1 2 1 chunk +115 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/TextMatchMarker.h View 1 2 1 chunk +64 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/TextMatchMarker.cpp View 1 2 1 chunk +42 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/TextMatchMarkerList.h View 1 2 1 chunk +60 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/markers/TextMatchMarkerList.cpp View 1 2 1 chunk +109 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 28 (9 generated)
rlanday
3 years, 8 months ago (2017-04-06 22:58:07 UTC) #2
Xiaocheng
Didn't go through all details. The sketch looks good. https://codereview.chromium.org/2805553003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h (right): https://codereview.chromium.org/2805553003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h#newcode14 third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h:14: ...
3 years, 8 months ago (2017-04-07 00:06:33 UTC) #5
yosin_UTC9
Let's start with simple interface having minimum members. The purpose of DMList interface is provide ...
3 years, 8 months ago (2017-04-07 03:16:22 UTC) #8
rlanday
For the containment pattern, I don't see how we can implement the operations both for ...
3 years, 8 months ago (2017-04-07 18:02:18 UTC) #9
rlanday
https://codereview.chromium.org/2805553003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h (right): https://codereview.chromium.org/2805553003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h#newcode14 third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h:14: : public GarbageCollectedFinalized<DocumentMarkerList> { On 2017/04/07 at 00:06:33, Xiaocheng ...
3 years, 8 months ago (2017-04-07 18:22:56 UTC) #10
rlanday
I responded to the comments and filled in the unimplemented methods, how does this look ...
3 years, 8 months ago (2017-04-07 21:44:35 UTC) #11
rlanday
https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h (right): https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h#newcode15 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h:15: getPosOfFirstMarkerNotEndingBeforeInSortedList( This method is only used once in this ...
3 years, 8 months ago (2017-04-07 21:46:30 UTC) #12
Xiaocheng
I prefer the editor pattern. I think we don't need to spend too much time ...
3 years, 8 months ago (2017-04-07 23:42:24 UTC) #13
rlanday
https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h (right): https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h#newcode15 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h:15: getPosOfFirstMarkerNotEndingBeforeInSortedList( On 2017/04/07 at 23:42:24, Xiaocheng wrote: > On ...
3 years, 8 months ago (2017-04-11 01:08:59 UTC) #14
rlanday
https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h (right): https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h#newcode17 third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h:17: using iterator = Member<DocumentMarker>*; On 2017/04/07 at 23:42:24, Xiaocheng ...
3 years, 8 months ago (2017-04-11 01:12:36 UTC) #15
Xiaocheng
https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h (right): https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h#newcode17 third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h:17: using iterator = Member<DocumentMarker>*; On 2017/04/11 at 01:12:36, rlanday ...
3 years, 8 months ago (2017-04-11 01:26:02 UTC) #16
yosin_UTC9
It is too early to think about implementation details, and to make patch small, please ...
3 years, 8 months ago (2017-04-11 01:39:37 UTC) #19
rlanday
https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h File third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h (right): https://codereview.chromium.org/2805553003/diff/20001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h#newcode22 third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h:22: virtual DocumentMarker::MarkerType allowedMarkerType() const = 0; On 2017/04/11 at ...
3 years, 8 months ago (2017-04-11 02:02:49 UTC) #20
rlanday
https://codereview.chromium.org/2805553003/diff/40001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp (right): https://codereview.chromium.org/2805553003/diff/40001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp#newcode170 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp:170: if (marker.StartOffset() <= end_offset) { This is redundant, I ...
3 years, 8 months ago (2017-04-11 02:59:10 UTC) #21
yosin_UTC9
I propose as following way to have small patches and keep no behavior changes. 1. ...
3 years, 8 months ago (2017-04-11 09:42:20 UTC) #24
rlanday
On 2017/04/11 at 09:42:20, yosin wrote: > I propose as following way to have small ...
3 years, 8 months ago (2017-04-11 18:21:01 UTC) #25
rlanday
On 2017/04/11 at 18:21:01, rlanday wrote: > On 2017/04/11 at 09:42:20, yosin wrote: > > ...
3 years, 8 months ago (2017-04-11 18:35:32 UTC) #26
rlanday
I just talked to xiaochengh, we don't really see the need for GenericDocumentMarkerListImpl. It would ...
3 years, 8 months ago (2017-04-11 20:47:26 UTC) #27
yosin_UTC9
3 years, 8 months ago (2017-04-12 01:43:30 UTC) #28
On 2017/04/11 at 20:47:26, rlanday wrote:
> I just talked to xiaochengh, we don't really see the need for
GenericDocumentMarkerListImpl. It would introduce some asymmetry in that it
would either implement a sorted list or an unsorted list, and then the
implementations that need the opposite choice would still be overriding those
methods. Plus, I think we decided we were trying to avoid inheritance where it's
not needed. So right now my plan looks like:
> 
> 1. Introduce DocumentMarkerList interface
> 2. Introduce DocumentMarkerListEditor with a bunch of test cases showing that
it works properly
> 3. Implement specialized DMLImpl classes with test cases
> 4. Add more test cases for DocumentMarkerController verifying the existing
behavior
> 5. Migrate DocumentMarkerController to use the new DMLImpl classes

I'm not fan of this approach. Background of DMList interface is unclear for
readers.
This approach is create new thing then replace current. Until step 5, this
approach makes us work on non-real world.

>It would introduce some asymmetry in that it would either implement a sorted
list or an unsorted list, and then the implementations that need the opposite
choice would still be overriding those methods
I don't understand this.

One of the objective of introducing DMList interface is isolation of changes on
each DM type.
Since we don't want to migrate all DM type lists in specialized one,
GenericDMListImpl provides
default impl.

Marker list can be implemented in three phases:

# Phase 0:
All DM type lists are GenericDMListImpl. 

# Phase 1:
When we want to have optimized version of Spelling Marker. Perpetration is:
SpellingMarkerList::AddMarker(DM* marker) { DMLEditor::AddMarker(marker); }

# Phase 2:
Then, specialize for SpellingMarkerList
SpellingMarkerList::AddMarker(DM* marker) { spelling specific implementation }

This is incrementally change current implementation and we can implement each DM
type in parallel and independent.

>moveMarkers() takes a pointer to a DocumentMarkerList to move the markers to
DMC::MoveMarkers() can implement as following pseudo code:

DMC::MoveMarkers(Node* src_node, int length, Node* dst_node) {
  MarkerListtSet& src_sets = GetMarkerListSetFor(src_node);
  MarkesrListSet& dst_sets = GetOrCreateMarkerListSetFor(dst_node);
  for (each list in src_set) {
    DM& before_maker = DMListEditor::SplitMarker(src_list, length);
    DMLEditor::AddMarker(dst_list, before_marker);
}

Powered by Google App Engine
This is Rietveld 408576698