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

Issue 2841093002: Algorithm for deciding if a frame's selection should be hidden (Closed)

Created:
3 years, 8 months ago by hugoh_UTC2
Modified:
3 years, 7 months ago
CC:
amaralp, blink-reviews, chromium-reviews, dtapuska+blinkwatch_chromium.org, Navid Zolghadr
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Algorithm for deciding if a frame's selection should be hidden Background: Crrev.com/464698 introduced "hiding" of unfocused selections in text controls. Hiding avoids clearing the selection upon change of focus. Problem: Now we only hide selections inside text controls. Selections within content-editable elements must also be hidden. Solution: Generalize previous work into an algorithm that, given current DOM and its activeElement, determines whether a frame's selection should be hidden. See the algorithm in InHidden() for documentation and read its unit tests in FrameSelectionTest.cpp. BUG=715059, 715889 Review-Url: https://codereview.chromium.org/2841093002 Cr-Commit-Position: refs/heads/master@{#470822} Committed: https://chromium.googlesource.com/chromium/src/+/8549ed4eaf9d95db494bd7028bf17110b26b6918

Patch Set 1 #

Patch Set 2 : Try implement FrameSelection::HasFocus() #

Patch Set 3 : Fix mixed-editability-2.html #

Patch Set 4 : More robust logic (no need to modify LayoutTests?) and new C++ unit tests #

Total comments: 4

Patch Set 5 : New unit tests and logic to cover them #

Patch Set 6 : Rebase + cosmetic changes #

Total comments: 12

Patch Set 7 : Handle disabled text controls and make loop body tighter #

Patch Set 8 : Add tests for disabled/readonly text controls #

Patch Set 9 : Fix FocusingButtonHidesRangeInReadOnlyTextControl #

Patch Set 10 : Factor out HasFocus() #

Total comments: 13

Patch Set 11 : 2 more tests for selections in shadow trees #

Total comments: 13

Patch Set 12 : Added a test "RangeInEditableDivInShadowTree" and removed use of ComputeVisibleSelectionInDOMTreeDe… #

Total comments: 1

Patch Set 13 : Nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+651 lines, -48 lines) Patch
M third_party/WebKit/Source/core/editing/FrameSelection.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +7 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +61 lines, -27 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +581 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/LayoutSelection.h View 1 2 3 4 5 2 chunks +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/core/editing/LayoutSelection.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +1 line, -11 lines 0 comments Download

Messages

Total messages: 105 (55 generated)
hugoh_UTC2
yosin@, this is a quick fix for the given bug. I regret that Blink needs ...
3 years, 8 months ago (2017-04-26 14:44:03 UTC) #2
yosin_UTC9
On 2017/04/26 at 14:44:03, hugoh wrote: > yosin@, this is a quick fix for the ...
3 years, 7 months ago (2017-04-27 06:33:52 UTC) #3
yosin_UTC9
On 2017/04/27 at 06:33:52, yosin_UTC9 wrote: > On 2017/04/26 at 14:44:03, hugoh wrote: > > ...
3 years, 7 months ago (2017-04-27 09:44:14 UTC) #11
hugoh_UTC2
On 2017/04/27 09:44:14, yosin_UTC9 wrote: > On 2017/04/27 at 06:33:52, yosin_UTC9 wrote: > > On ...
3 years, 7 months ago (2017-04-27 10:42:52 UTC) #12
yosin_UTC9
On 2017/04/27 at 10:42:52, hugoh wrote: > On 2017/04/27 09:44:14, yosin_UTC9 wrote: > > On ...
3 years, 7 months ago (2017-04-27 12:36:39 UTC) #13
hugoh_UTC2
On 2017/04/27 12:36:39, yosin_UTC9 wrote: > On 2017/04/27 at 10:42:52, hugoh wrote: > > On ...
3 years, 7 months ago (2017-04-27 19:15:41 UTC) #14
yosin_UTC9
On 2017/04/27 at 19:15:41, hugoh wrote: > On 2017/04/27 12:36:39, yosin_UTC9 wrote: > > On ...
3 years, 7 months ago (2017-04-28 01:11:34 UTC) #15
yosin_UTC9
https://codereview.chromium.org/2841093002/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode467 third_party/WebKit/Source/core/editing/FrameSelection.cpp:467: return false; We also need to handle Range selection ...
3 years, 7 months ago (2017-04-28 01:14:33 UTC) #16
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode467 third_party/WebKit/Source/core/editing/FrameSelection.cpp:467: return false; On 2017/04/28 01:14:33, yosin_OOO_til_May_7 wrote: > We ...
3 years, 7 months ago (2017-04-28 06:55:12 UTC) #17
yosin_UTC9
+tkent@, since I'm unavailable until May 8. I think it is better to split this ...
3 years, 7 months ago (2017-04-28 07:57:09 UTC) #19
yosin_UTC9
3 years, 7 months ago (2017-04-28 09:02:48 UTC) #21
hugoh_UTC2
xiaocheng@, if you have time, could you PTAL at this CL? I understand you are ...
3 years, 7 months ago (2017-05-02 10:50:22 UTC) #25
Xiaocheng
Sorry for the delay. https://codereview.chromium.org/2841093002/diff/120001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/120001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode436 third_party/WebKit/Source/core/editing/FrameSelection.cpp:436: const Element* const focus_element = ...
3 years, 7 months ago (2017-05-02 20:05:17 UTC) #28
Xiaocheng
I also observe a different behavior between this patch and Stable (M58): 1. Create a ...
3 years, 7 months ago (2017-05-02 23:15:29 UTC) #29
hugoh_UTC2
Thanks! https://codereview.chromium.org/2841093002/diff/120001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/120001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode436 third_party/WebKit/Source/core/editing/FrameSelection.cpp:436: const Element* const focus_element = GetDocument().FocusedElement() On 2017/05/02 ...
3 years, 7 months ago (2017-05-03 07:18:55 UTC) #30
Xiaocheng
Sorry I'm still confused by the purpose of this patch. The meaning of "active" isn't ...
3 years, 7 months ago (2017-05-03 15:03:01 UTC) #31
Xiaocheng
Instead of an ambiguous "IsActive", I think we should have two new functions to control ...
3 years, 7 months ago (2017-05-03 16:25:28 UTC) #32
hugoh_UTC2
On 2017/05/03, Xiaocheng wrote: > I also observe a different behavior between this patch and ...
3 years, 7 months ago (2017-05-03 20:31:00 UTC) #33
Xiaocheng
Thanks for the update. I'm still skeptical about the semantics of IsActive(), though... The reason ...
3 years, 7 months ago (2017-05-03 23:45:36 UTC) #34
hugoh_UTC2
On 2017/05/03 23:45:36, Xiaocheng wrote: > For this patch, since IsActive() is only used by ...
3 years, 7 months ago (2017-05-04 12:44:21 UTC) #36
Xiaocheng
On 2017/05/04 at 12:44:21, hugoh wrote: > On 2017/05/03 23:45:36, Xiaocheng wrote: > > For ...
3 years, 7 months ago (2017-05-04 18:24:12 UTC) #49
hugoh_UTC2
On 2017/05/04 18:24:12, Xiaocheng wrote: > On 2017/05/04 at 12:44:21, hugoh wrote: > > On ...
3 years, 7 months ago (2017-05-05 15:31:35 UTC) #51
Xiaocheng
On 2017/05/05 at 15:31:35, hugoh wrote: > On 2017/05/04 18:24:12, Xiaocheng wrote: > > On ...
3 years, 7 months ago (2017-05-05 18:13:35 UTC) #52
Xiaocheng
Whoops, forgot to publish drafts. https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp File third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp#newcode352 third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp:352: TEST_F(FrameSelectionTest, CaretInShadowTree) { Let's ...
3 years, 7 months ago (2017-05-05 18:32:02 UTC) #53
yosin_UTC9
Good shape. (^_^)b https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: const Node* current = ComputeVisibleSelectionInDOMTreeDeprecated() nit: ...
3 years, 7 months ago (2017-05-08 05:36:53 UTC) #58
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp File third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp#newcode352 third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp:352: TEST_F(FrameSelectionTest, CaretInShadowTree) { On 2017/05/05 18:32:02, Xiaocheng wrote: > ...
3 years, 7 months ago (2017-05-08 08:28:14 UTC) #59
yosin_UTC9
https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp File third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp#newcode352 third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp:352: TEST_F(FrameSelectionTest, CaretInShadowTree) { On 2017/05/08 at 08:28:14, hugoh_UTC2 wrote: ...
3 years, 7 months ago (2017-05-08 09:00:10 UTC) #60
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: const Node* current = ComputeVisibleSelectionInDOMTreeDeprecated() On 2017/05/08 05:36:52, yosin_UTC9 ...
3 years, 7 months ago (2017-05-08 09:08:13 UTC) #61
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp File third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/2841093002/diff/220001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp#newcode352 third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp:352: TEST_F(FrameSelectionTest, CaretInShadowTree) { On 2017/05/08 09:00:10, yosin_UTC9 wrote: > ...
3 years, 7 months ago (2017-05-08 11:40:03 UTC) #65
Xiaocheng
I'm OK with keeping the ComputeVisibleSelectionInDOMTreeDeprecated() calls in this patch, since we have a standard ...
3 years, 7 months ago (2017-05-08 22:08:30 UTC) #71
yosin_UTC9
https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: const Node* current = ComputeVisibleSelectionInDOMTreeDeprecated() I prefer to use ...
3 years, 7 months ago (2017-05-09 01:29:37 UTC) #72
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: const Node* current = ComputeVisibleSelectionInDOMTreeDeprecated() On 2017/05/09 01:29:37, yosin_UTC9 ...
3 years, 7 months ago (2017-05-09 08:11:23 UTC) #73
yosin_UTC9
On 2017/05/09 at 08:11:23, hugoh wrote: > https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp > File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): > > https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 ...
3 years, 7 months ago (2017-05-09 08:33:28 UTC) #74
hugoh_UTC2
@yosin, PTAL https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: const Node* current = ComputeVisibleSelectionInDOMTreeDeprecated() On 2017/05/09 ...
3 years, 7 months ago (2017-05-09 09:22:45 UTC) #75
hugoh_UTC2
https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp File third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp (right): https://codereview.chromium.org/2841093002/diff/300001/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp#newcode526 third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp:526: const IntRect elem_bounds = textarea->BoundsInViewport(); On 2017/05/09 09:22:45, hugoh_UTC2 ...
3 years, 7 months ago (2017-05-09 09:42:30 UTC) #76
Xiaocheng
lgtm https://codereview.chromium.org/2841093002/diff/320001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2841093002/diff/320001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode429 third_party/WebKit/Source/core/editing/FrameSelection.cpp:429: // TODO(editing-dev): Hoist updateStyleAndLayoutIgnorePendingStylesheets nit: s/update/Update/
3 years, 7 months ago (2017-05-09 18:18:15 UTC) #77
hugoh_UTC2
On 2017/05/09 18:18:15, Xiaocheng wrote: > lgtm > do you approve > https://codereview.chromium.org/2841093002/diff/320001/third_party/WebKit/Source/core/editing/FrameSelection.cpp > File ...
3 years, 7 months ago (2017-05-09 19:19:40 UTC) #78
yosin_UTC9
lgtm Thanks for working this! Once this patch committed, we can fix related bugs.
3 years, 7 months ago (2017-05-10 01:03:19 UTC) #79
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/2841093002/330001
3 years, 7 months ago (2017-05-10 06:30:32 UTC) #82
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/440395)
3 years, 7 months ago (2017-05-10 08:12:17 UTC) #84
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/2841093002/330001
3 years, 7 months ago (2017-05-10 08:42:09 UTC) #86
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/449799)
3 years, 7 months ago (2017-05-10 11:32:45 UTC) #88
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/2841093002/330001
3 years, 7 months ago (2017-05-10 14:56:33 UTC) #90
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/450202)
3 years, 7 months ago (2017-05-10 16:40:04 UTC) #92
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/2841093002/330001
3 years, 7 months ago (2017-05-10 19:34:09 UTC) #94
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/450603)
3 years, 7 months ago (2017-05-10 21:38:45 UTC) #96
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/2841093002/330001
3 years, 7 months ago (2017-05-11 00:58:30 UTC) #98
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/451220)
3 years, 7 months ago (2017-05-11 04:01:12 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/2841093002/330001
3 years, 7 months ago (2017-05-11 04:19:04 UTC) #102
commit-bot: I haz the power
3 years, 7 months ago (2017-05-11 05:28:46 UTC) #105
Message was sent while issue was closed.
Committed patchset #13 (id:330001) as
https://chromium.googlesource.com/chromium/src/+/8549ed4eaf9d95db494bd7028bf1...

Powered by Google App Engine
This is Rietveld 408576698