Bug 52760 - ComplexTextController incorrectly conflates string length and range of indexes
Summary: ComplexTextController incorrectly conflates string length and range of indexes
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2011-01-19 15:57 PST by Ned Holbrook
Modified: 2011-01-25 22:08 PST (History)
3 users (show)

See Also:

Proposed changes. (12.33 KB, patch)
2011-01-19 16:01 PST, Ned Holbrook
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.