Bug 52760

Summary: ComplexTextController incorrectly conflates string length and range of indexes
Product: WebKit Reporter: Ned Holbrook <ned>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.6   
Attachments:
Description Flags
Proposed changes. none

Description Ned Holbrook 2011-01-19 15:57:02 PST
Consider a run of 2 characters where each is in its own CTRun. As the ComplexTextRuns are iterated by ComplexTextController::advance(), glyphStartOffset gets 0, but glyphEndOffset gets 2 via complexTextRun.stringLength(), which results in a width of half the first adjusted advance: half because it is divided equally among 2 characters, and no more since"glyphEndOffset + complexTextRun.stringLocation() > m_currentCharacter" is true, which causes the loop to exit.

In order to fix this, ComplexTextRun needs to keep track of the original run range in order to return the end index (end in the sense of an STL range, or one past the last included value). Note that the string indices alone are not sufficient to determine the end index, as the last glyph may be a ligature and subsume more than one index.
Comment 1 Ned Holbrook 2011-01-19 16:01:17 PST
Created attachment 79510 [details]
Proposed changes.
Comment 2 Eric Seidel (no email) 2011-01-20 02:45:39 PST
This looks right to me, but mitz should really be the one to r+ this.
Comment 3 mitz 2011-01-25 21:30:23 PST
Comment on attachment 79510 [details]
Proposed changes.

I’m not sure indexEnd is the best name for this but I don’t have a better suggestion.
Comment 4 WebKit Commit Bot 2011-01-25 22:08:03 PST
The commit-queue encountered the following flaky tests while processing attachment 79510 [details]:

http/tests/xmlhttprequest/failed-auth.html bug 51835 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 5 WebKit Commit Bot 2011-01-25 22:08:48 PST
Comment on attachment 79510 [details]
Proposed changes.

Clearing flags on attachment: 79510

Committed r76674: <http://trac.webkit.org/changeset/76674>
Comment 6 WebKit Commit Bot 2011-01-25 22:08:53 PST
All reviewed patches have been landed.  Closing bug.