[Webkit-unassigned] [Bug 57806] continue experiment with moving caret by word in visual order

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 5 15:19:40 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=57806





--- Comment #6 from Xiaomei Ji <xji at chromium.org>  2011-04-05 15:19:40 PST ---
(From update of attachment 88162)
View in context: https://bugs.webkit.org/attachment.cgi?id=88162&action=review

>> Source/WebCore/editing/visible_units.cpp:1282
>> +    
> 
> it is more about granularity. I feel split them is more clear.

I renamed collectOneWordBreakInBox as wordBreakInBox

>> Source/WebCore/editing/visible_units.cpp:1375
>> +}
> 
> I'd break this function into two pieces as we did last time.  In fact, I'd embed the following code in rightWordPosition:
> if (boxDirection == blockDirection) {
>     if (boxDirection == LTR)
>         wordBreakCandidate = positionAfterNextWord(visiblePosition)
>     else
>         wordBreakCandidate = previousWordPosition(visiblePosition);
> } else {
>     if (boxDirection == RTL)
>         wordBreakCandidate = positionBeforePreviousWord(visiblePosition)
>     else
>         wordBreakCandidate = nextWordPosition(visiblePosition);
> }
> 
> where
> 
> static VisiblePosition positionAfterNextWord(VisiblePosition position) {
>     VisiblePosition beforeNextWord = nextWordPosition(position);
>     VisiblePosition beforeWordAfterNextWord = nextWordPosition(beforeNextWord);
>     if (beforeNextWord == beforeWordAfterNextWord)
>         return VisiblePosition();
>     return previousWordPosition(beforeWordAfterNextWord);
> }
> 
> static VisiblePosition positionBeforePreviousWord(VisiblePosition position) {
>     VisiblePosition afterNextWord = previousWordPosition(position);
>     VisiblePosition afterWordAfterNextWord = previousWordPosition(afterNextWord);
>     if (afterNextWord == afterWordAfterNextWord)
>         return VisiblePosition();
>     return nextWordPosition(previousPrevious);
> }
> 
> for leftWordBoundary, I'd add do:
> 
> if (boxDirection == blockDirection) {
>     if (boxDirection == RTL)
>         wordBreakCandidate = positionAfterNextWord(visiblePosition);
>     else
>         wordBreakCandidate = previousWordPosition(visiblePosition);
> } else {
>     if (boxDirection == LTR)
>         wordBreakCandidate = positionBeforePreviousWord(visiblePosition);
>     else
>         wordBreakCandidate = nextWordPosition(visiblePosition);
> }

I kept the name "next"/"nextNext" and "previous"/previousPrevious since it is hard for me to understand what beforeNextWord, beforeWordAfterNextWord, afterNextWord, afterWordAfterNextWord mean.

-- 
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