New issue
Advanced search Search tips

Issue 727537 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

We should pass proper range to TextIterator constructor

Project Member Reported by yosin@chromium.org, May 30 2017

Issue description

It is not good design that TextIterator constructor can start > end range.

Following layout tests calls TextIterator ctor with start > end:
- editing/spelling/spellcheck-queue.html
  SpellChecker::MarkAndReplaceFor() -> TextCheckingParagraph::OffsetTo()
- editing/spelling/spellcheck-async-mutation.html
  SpellChecker::MarkAndReplaceFor() -> TextCheckingParagraph::OffsetTo()
- editing/selection/shift-click.html
 SelectionController::HandleSingleClick() => TextDistance()
- editing/selection/user-select-all-with-shift.html
 SelectionController::HandleSingleClick() => TextDistance()
 

Comment 1 by yosin@chromium.org, May 30 2017

Description: Show this description
Project Member

Comment 2 by bugdroid1@chromium.org, May 31 2017

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

commit 0711a0a702c23b484eadb514070f20f58b97bb35
Author: yosin <yosin@chromium.org>
Date: Wed May 31 01:11:19 2017

Make SelectionController to call TextDistance() with proper range

This patch changes |SelectionController::HandleSingleClick()| to call
|TextDistance()|, which constructs |TextIterator| via |RangeLength()|
with proper range, start <= end, as preparation of making |TextIterator|
constructor to take only proper range[1].

[1] http://crrev.com/2912053002: Call TextIterator constructor with proper range

BUG=727537
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2912923002
Cr-Commit-Position: refs/heads/master@{#475717}

[modify] https://crrev.com/0711a0a702c23b484eadb514070f20f58b97bb35/third_party/WebKit/Source/core/editing/SelectionController.cpp

Project Member

Comment 3 by bugdroid1@chromium.org, May 31 2017

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

commit 9a241f0157e83c8defd3ee25b06232f6688bf86b
Author: yosin <yosin@chromium.org>
Date: Wed May 31 01:16:00 2017

Expand TextCheckingParagraph::OffsetTo() into SelectionController::MarkAndReplaceFor()

This patch expands |TextCheckingParagraph::OffsetTo()| into
|SelectionController::MarkAndReplaceFor()| with optimizations, see below,
because it is called once for improving code health.

Since |TextCheckingParagraph| object |paragraph| holds single range
|checking_range|, we can hold
|TextCheckingParagraph::OffsetAsRange().StartPosition()| to
|checking_range.StartPosition()|.

When |caret_position < paragraph_start|, we don't need to consider it, because of
caret is placed before checked range.

This patch is a preparation of patch[1].

[1] http://crrev.com/2912053002: Call TextIterator constructor with proper range

BUG=727537
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2909923005
Cr-Commit-Position: refs/heads/master@{#475718}

[modify] https://crrev.com/9a241f0157e83c8defd3ee25b06232f6688bf86b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
[modify] https://crrev.com/9a241f0157e83c8defd3ee25b06232f6688bf86b/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingParagraph.cpp
[modify] https://crrev.com/9a241f0157e83c8defd3ee25b06232f6688bf86b/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingParagraph.h

Project Member

Comment 4 by bugdroid1@chromium.org, May 31 2017

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

commit 984f4b2c4df57ae840917a1d79f95a54e68e2c7b
Author: yosin <yosin@chromium.org>
Date: Wed May 31 06:00:29 2017

Make TextIterator constructor to take only proper range

This patch makes |TextIterator| constructor to take only proper range to
simplify code for improve code health.

Note: This patch is passed all tests, but there are some cases to pass
improper range to |TextIterator|. To catch such case and avoid infinite loop,
we use |CHECK()| to make blink crash.

BUG=727537
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2912053002
Cr-Commit-Position: refs/heads/master@{#475819}

[modify] https://crrev.com/984f4b2c4df57ae840917a1d79f95a54e68e2c7b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Project Member

Comment 5 by sheriffbot@chromium.org, May 31 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by yosin@chromium.org, Jun 4 2018

Status: Available (was: Untriaged)

Sign in to add a comment