[Webkit-unassigned] [Bug 61324] --webkit-visual-word does not work well in words separated by multiple spaces

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 6 18:41:20 PDT 2011


--- Comment #10 from Xiaomei Ji <xji at chromium.org>  2011-06-06 18:41:20 PST ---
(From update of attachment 95834)
View in context: https://bugs.webkit.org/attachment.cgi?id=95834&action=review

> Source/WebCore/ChangeLog:13
> +

The old code was trying to find the right word boundary (before the space or after the space) by using previousWordPosition and nextWordPosition. It was introduced as short-cut to improve performance. But they are not correct functionality wise.

Using positionBeforeNextWord() as example, 

first, it checks whether the current position is one kind (either before the space or after the space, but not the right kind we are looking for) of word break position by checking the current position's previousWordPosition's nextWordPosition is the same position as current position, which is wrong for words separated by multiple spaces. For example, given words A and B separated by 3 continuous spaces "A   B", position "A|", "A |", and "A  |" should all be considered as word break positions, but not the right ones we are looking for. But the old code only takes care of case "A|", for which, positonBeforeNextWord() returns correct result "A   |B". It returns "A   B |C" for cases "A |" and "A  |", which are wrong.

second, The code was assuming calling nextWordPosition by going forward and calling previousWordPosition by going backward returns different positions, which is not true for words not separated by spaces. Given 3 Chinese words "ABC", when cursor is at "A|BC", current position is after current word, and positionBeforeNextWord() still returns current position after calling current position's nextWordPosition's previousWordPosition. It should returns position "AB|C" (ignore the naming accuracy now).

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list