Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in
(50)

Issue 1123563003: Improving direction-based selection strategy. (Closed)

Created:
5 years ago by mfomitchev
Modified:
4 years, 10 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Improving direction-based selection strategy. This implements two improvements to the direction-based selection strategy: 1. The "offset": If the selection expands beyond extent (in word granularity) and then the user shrinks the selection - previously the granularity would change to character and the end of the selection would jump to the extent, so the visible selection could change quite significantly even if the user moved the extent by a little bit. Now the selection only changes by the amount the user moved the extent from previous position. Effectively we are saving the delta between extent and the visible start/end in word granularity and preserving it as we switch to character granularity. 2. When the selection is expanding, previously we would expand the selection to the end of the word as soon as the extent moved beyond the first word character. This is the default behavior of Word granularity. With the new behavior, we only expand the selection to the end of the word when the extent moves beyond the middle of the word. More details in comments to DirectionGranularityStrategy in GranularityStrategy.h BUG=451255, 498389 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196772

Patch Set 1 #

Total comments: 1

Patch Set 2 : Some cleanup #

Patch Set 3 : Fixing a couple of edge cases and adding tests. Still needs cleanup. #

Patch Set 4 : Selection changes when word middle is passed + tests + comments + cleanup.w #

Patch Set 5 : Removing unused method. #

Total comments: 4

Patch Set 6 : Adding StrategyState enum to replace m_cleared, m_lastMoveShrunkSelection. #

Total comments: 20

Patch Set 7 : Addressing rotated text + comment cleanup #

Total comments: 2

Patch Set 8 : Not storing absolute coordinates + optimizations. #

Patch Set 9 : Rebase plus adding CORE_EXPORT. #

Patch Set 10 : Fixing the slow extend and expanding tests a bit. #

Total comments: 31

Patch Set 11 : Expanding unit tests #

Patch Set 12 : Removing duplicate tests. #

Patch Set 13 : Addressing remaining review feedback. #

Total comments: 15

Patch Set 14 : Addressing review feedback. #

Patch Set 15 : Trace for moveRangeSelectionExtent. #

Total comments: 4

Patch Set 16 : Removing anonymous namespace and marking functions static instead. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+938 lines, -235 lines) Patch
M Source/core/core.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/editing/FrameSelection.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -4 lines 0 comments Download
M Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -3 lines 0 comments Download
M Source/core/editing/FrameSelectionTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +0 lines, -136 lines 0 comments Download
M Source/core/editing/GranularityStrategy.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +63 lines, -16 lines 0 comments Download
M Source/core/editing/GranularityStrategy.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +179 lines, -68 lines 0 comments Download
A Source/core/editing/GranularityStrategyTest.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +663 lines, -0 lines 0 comments Download
M Source/core/editing/VisibleUnits.h View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -0 lines 0 comments Download
M Source/core/editing/VisibleUnits.cpp View 1 2 3 4 5 6 3 chunks +16 lines, -0 lines 0 comments Download
M Source/web/WebLocalFrameImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -8 lines 0 comments Download

Messages

Total messages: 38 (5 generated)
mfomitchev
https://codereview.chromium.org/1123563003/diff/1/Source/core/editing/GranularityStrategy.cpp File Source/core/editing/GranularityStrategy.cpp (right): https://codereview.chromium.org/1123563003/diff/1/Source/core/editing/GranularityStrategy.cpp#newcode195 Source/core/editing/GranularityStrategy.cpp:195: newSelection.setWithoutValidation(newSelection.base(), extentPosition.deepEquivalent(), newSelection.start(), newSelection.end()); Note we actually only need ...
5 years ago (2015-05-01 23:31:52 UTC) #1
mfomitchev
5 years ago (2015-05-01 23:32:20 UTC) #3
mfomitchev
@yosin, yoichio: ping
4 years, 11 months ago (2015-05-10 05:16:09 UTC) #4
mfomitchev
+yosin@chromium.org instead of yosin@google.com
4 years, 11 months ago (2015-05-11 17:43:10 UTC) #6
mfomitchev
Cleaned up version, ready for review. Selection now advances when the middle of the word ...
4 years, 11 months ago (2015-05-18 02:13:02 UTC) #7
jdduke (slow)
Just a high level q, is any of this code traced? Should we add a ...
4 years, 11 months ago (2015-05-18 03:01:28 UTC) #8
yosin_UTC9
I think passing |WebPoint|, point in contents-space, to Blink from Chromium in API isn't good ...
4 years, 11 months ago (2015-05-18 07:47:03 UTC) #9
mfomitchev
> Just a high level q, is any of this code traced? Should we add ...
4 years, 11 months ago (2015-05-19 00:50:57 UTC) #10
mfomitchev
+Levi who is also expert in this code and had some thoughts on the CL
4 years, 11 months ago (2015-05-20 18:29:06 UTC) #12
leviw_travelin_and_unemployed
First pass of comments. https://codereview.chromium.org/1123563003/diff/100001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/100001/Source/core/editing/FrameSelectionTest.cpp#newcode76 Source/core/editing/FrameSelectionTest.cpp:76: return pos.absoluteCaretBounds().minXMinYCorner(); The minXMinYCorner is ...
4 years, 11 months ago (2015-05-20 20:24:37 UTC) #13
mfomitchev
https://codereview.chromium.org/1123563003/diff/100001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/100001/Source/core/editing/FrameSelectionTest.cpp#newcode76 Source/core/editing/FrameSelectionTest.cpp:76: return pos.absoluteCaretBounds().minXMinYCorner(); On 2015/05/20 20:24:37, leviw wrote: > The ...
4 years, 11 months ago (2015-05-20 21:37:29 UTC) #14
leviw_travelin_and_unemployed
I'm not sure I agree with the assertion that rotated text is an edge-case. Can ...
4 years, 11 months ago (2015-05-20 22:01:01 UTC) #15
mfomitchev
> Also: if you're using the top-left caret position, you'll bail when text on the ...
4 years, 11 months ago (2015-05-20 22:16:49 UTC) #16
leviw_travelin_and_unemployed
On 2015/05/20 at 22:16:49, mfomitchev wrote: > > Also: if you're using the top-left caret ...
4 years, 11 months ago (2015-05-20 22:24:51 UTC) #17
mfomitchev
@leviw: PTAL - please let me know if the algorithm looks okay now, and then ...
4 years, 11 months ago (2015-05-25 23:05:51 UTC) #18
leviw_travelin_and_unemployed
https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp#newcode268 Source/core/editing/FrameSelectionTest.cpp:268: int y = letterPos[29].y(); This is a really synthetic ...
4 years, 11 months ago (2015-05-26 20:25:50 UTC) #19
mfomitchev
https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp#newcode268 Source/core/editing/FrameSelectionTest.cpp:268: int y = letterPos[29].y(); On 2015/05/26 20:25:50, leviw wrote: ...
4 years, 11 months ago (2015-05-26 22:32:47 UTC) #20
leviw_travelin_and_unemployed
https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp#newcode268 Source/core/editing/FrameSelectionTest.cpp:268: int y = letterPos[29].y(); On 2015/05/26 22:32:46, mfomitchev wrote: ...
4 years, 11 months ago (2015-05-26 22:47:49 UTC) #21
mfomitchev
https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp File Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/FrameSelectionTest.cpp#newcode268 Source/core/editing/FrameSelectionTest.cpp:268: int y = letterPos[29].y(); On 2015/05/26 22:47:48, leviw wrote: ...
4 years, 11 months ago (2015-05-27 17:24:29 UTC) #22
mfomitchev
@leviw: I added a bunch of new tests, can you please take a quick look ...
4 years, 11 months ago (2015-06-02 21:30:47 UTC) #23
leviw_travelin_and_unemployed
On 2015/06/02 at 21:30:47, mfomitchev wrote: > @leviw: I added a bunch of new tests, ...
4 years, 11 months ago (2015-06-02 22:28:59 UTC) #24
mfomitchev
https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/GranularityStrategy.cpp File Source/core/editing/GranularityStrategy.cpp (right): https://codereview.chromium.org/1123563003/diff/180001/Source/core/editing/GranularityStrategy.cpp#newcode55 Source/core/editing/GranularityStrategy.cpp:55: m_subPositionCorrection.setHeight(0); On 2015/05/26 20:25:50, leviw wrote: > m_subPositionCorrection = ...
4 years, 11 months ago (2015-06-03 18:57:55 UTC) #25
leviw_travelin_and_unemployed
https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/FrameSelection.h File Source/core/editing/FrameSelection.h (right): https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/FrameSelection.h#newcode131 Source/core/editing/FrameSelection.h:131: // is set to the same position as the ...
4 years, 11 months ago (2015-06-03 22:29:48 UTC) #26
mfomitchev
https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/GranularityStrategy.h File Source/core/editing/GranularityStrategy.h (right): https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/GranularityStrategy.h#newcode125 Source/core/editing/GranularityStrategy.h:125: // The start of the vector is the bottom-left ...
4 years, 11 months ago (2015-06-03 22:36:55 UTC) #27
leviw_travelin_and_unemployed
On 2015/06/03 at 22:36:55, mfomitchev wrote: > https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/GranularityStrategy.h > File Source/core/editing/GranularityStrategy.h (right): > > https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/GranularityStrategy.h#newcode125 ...
4 years, 11 months ago (2015-06-04 01:10:05 UTC) #28
mfomitchev
https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/FrameSelection.h File Source/core/editing/FrameSelection.h (right): https://codereview.chromium.org/1123563003/diff/240001/Source/core/editing/FrameSelection.h#newcode131 Source/core/editing/FrameSelection.h:131: // is set to the same position as the ...
4 years, 11 months ago (2015-06-05 17:38:40 UTC) #29
leviw_travelin_and_unemployed
Switch your local methods over to just being marked static instead of anonymous namespace and ...
4 years, 10 months ago (2015-06-08 18:09:57 UTC) #30
mfomitchev
> Switch your local methods over to just being marked static instead of anonymous > ...
4 years, 10 months ago (2015-06-08 18:35:58 UTC) #31
leviw_travelin_and_unemployed
LGTM. Thanks for putting up with all the rounds :)
4 years, 10 months ago (2015-06-08 19:24:02 UTC) #32
mfomitchev
@leviw: Thanks for the review! aelias@chromium.org: Can you please review changes in WebLocalFrameImpl.cpp
4 years, 10 months ago (2015-06-08 19:26:24 UTC) #34
aelias_OOO_until_Jul13
Source/web lgtm
4 years, 10 months ago (2015-06-09 03:53:58 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1123563003/300001
4 years, 10 months ago (2015-06-09 14:15:16 UTC) #37
commit-bot: I haz the power
4 years, 10 months ago (2015-06-09 15:24:10 UTC) #38
Message was sent while issue was closed.
Committed patchset #16 (id:300001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=196772

Powered by Google App Engine
This is Rietveld 408576698