New issue
Advanced search Search tips

Issue 897983 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 30
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Task

Blocking:
issue 657237
issue 894651



Sign in to add a comment

Don't create VisiblePosition on already canonicalized positions

Project Member Reported by xiaoche...@chromium.org, Oct 22

Issue description

Positions returned by hit tests are already canonical. We shouldn't canonicalize them again.

Removing this extra canonicalization also makes the implementation of bidi caret affinity easier, as VisiblePosition creation adjusts TextAffinity.
 
Summary: Don't create VisiblePosition on already canonicalized positions (was: Don't create VisiblePosition from positions returned by hit tests)
Dashboard of all callers of CreateVisiblePosition:

https://docs.google.com/spreadsheets/d/1_W_sm2W_SrvJ-zGMhM4LrzEAPZlyssZoGLsU3hqrzcs/edit?usp=sharing

See second sheet "CreateVisiblePosition"
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 23

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7ff31fb76bb12166f1aebaff387705b0fc155b17

commit 7ff31fb76bb12166f1aebaff387705b0fc155b17
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Tue Oct 23 16:09:33 2018

Stop creating VisiblePosition in FrameSelection::Contains()

This patch clears a call site of CreateVisiblePosition() in
FrameSelection::Contains(), since canonicalization on hit test result
is unnecessary.

This patch also makes the implementation of bidi caret affinity easier.

Bug:  897983 
Change-Id: I4c3af5ba43015ad7ec98efdc05d23afd09ea21fe
Reviewed-on: https://chromium-review.googlesource.com/c/1295318
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601973}
[modify] https://crrev.com/7ff31fb76bb12166f1aebaff387705b0fc155b17/third_party/blink/renderer/core/editing/frame_selection.cc
[modify] https://crrev.com/7ff31fb76bb12166f1aebaff387705b0fc155b17/third_party/blink/renderer/core/editing/frame_selection_test.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Oct 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ee53ac42f91dce797eebb5aaba3db7485e2959f5

commit ee53ac42f91dce797eebb5aaba3db7485e2959f5
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Wed Oct 24 16:37:58 2018

Stop using CreateVisiblePosition in FrameCaret::AbsoluteCaretBounds

FrameCaret::CaretPosition() is already canonicalized. There's no need
to canonicalize it again.

Bug:  897983 
Change-Id: I3d58572099fa17b7aada06fe799989f6f8fe67f5
Reviewed-on: https://chromium-review.googlesource.com/c/1297633
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602366}
[modify] https://crrev.com/ee53ac42f91dce797eebb5aaba3db7485e2959f5/third_party/blink/renderer/core/editing/frame_caret.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Oct 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9dea97053f53b2bd6ff778dc2f80f9de8d789d62

commit 9dea97053f53b2bd6ff778dc2f80f9de8d789d62
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Wed Oct 24 17:59:18 2018

Stop using CreateVisiblePosition in DragCaret::SetCaretPosition

The passed-in position in DragCaret::SetCaretPosition is a hit test
result (see DragController::TryDocumentDrag), which is already a
canonical position. Hence, there's no need to canonicalize it again.

Bug:  897983 
Change-Id: I58f9bff731842a4d9f7c201f95ec2af769e158d7
Reviewed-on: https://chromium-review.googlesource.com/c/1297641
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602393}
[modify] https://crrev.com/9dea97053f53b2bd6ff778dc2f80f9de8d789d62/third_party/blink/renderer/core/editing/drag_caret.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 25

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8fc66f653e87595e3d501ee9d8a98072162bb761

commit 8fc66f653e87595e3d501ee9d8a98072162bb761
Author: Zhuoyu Qian <zhuoyu.qian@samsung.com>
Date: Thu Oct 25 01:58:42 2018

Stop creating VisiblePosition in HitTestResultIsMisspelled()

This patch clears a call site of CreateVisiblePosition() in
HitTestResultIsMisspelled(), since canonicalization on hit test result
is unnecessary.

Bug:  897983 
Change-Id: Ic94f1a5c7e748dd312906ce3e76c6e653871b21b
Reviewed-on: https://chromium-review.googlesource.com/c/1297224
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Zhuoyu Qian <zhuoyu.qian@samsung.com>
Cr-Commit-Position: refs/heads/master@{#602575}
[modify] https://crrev.com/8fc66f653e87595e3d501ee9d8a98072162bb761/third_party/blink/renderer/core/editing/selection_controller.cc

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 26

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e6156c7b24055cb9227be33fb144aadee0a5733f

commit e6156c7b24055cb9227be33fb144aadee0a5733f
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Fri Oct 26 19:29:07 2018

Don't create VisiblePosition and VisibleSelection in FrameSelection::SelectFrameElementInParentIfFullySelected()

This patch refactors the function's selection setting and validation
part, so that:

- It stops the problematic pattern of creating VisibleSelection before
  focusing parent frame, which may invalidate the VS

- It no longer creates VisiblePosition and VisibleSelection for creating
  the selection. This is because for a frame owner element, the range
  [before_node, after_node] is already a canonicalized range, on which
  creating VP or VS is unnecessary.

Bug: 657237,  897983 
Change-Id: I5b046047071a4af7454cc1bfef52a457fe49d9c2
Reviewed-on: https://chromium-review.googlesource.com/c/1298179
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603169}
[modify] https://crrev.com/e6156c7b24055cb9227be33fb144aadee0a5733f/third_party/blink/renderer/core/editing/frame_selection.cc

Let's close this one, as the roadmap is not very clear.

We should go back to issue 657237, where I listed all current usage of VisiblePosition, and have a rough idea of clearing/sanitizing the usage.
Status: WontFix (was: Available)

Sign in to add a comment