Bug 52403

Summary: [chromium] drop backwards iteration in Linux complex text code
Product: WebKit Reporter: Evan Martin <evan>
Component: New BugsAssignee: Evan Martin <evan>
Status: RESOLVED FIXED    
Severity: Normal CC: agl, tony, xji
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch tony: review+

Evan Martin
Reported 2011-01-13 15:29:59 PST
[chromium] drop backwards iteration in Linux complex text code
Attachments
Patch (12.51 KB, patch)
2011-01-13 15:32 PST, Evan Martin
no flags
Patch (12.65 KB, patch)
2011-01-13 16:24 PST, Evan Martin
tony: review+
Evan Martin
Comment 1 2011-01-13 15:32:42 PST
Tony Chang
Comment 2 2011-01-13 16:07:50 PST
Comment on attachment 78866 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=78866&action=review > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:247 > + for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < controller.length(); ++glyphIndex) { > + int advance = truncateFixedPointToInteger(controller.advances()[glyphIndex]); > + int nextX = static_cast<int>(controller.xPositions()[glyphIndex]); > + nextX += advance / 2; > + if (std::min(nextX, lastX) <= targetX && targetX <= std::max(nextX, lastX)) > + return glyphIndex; > + lastX = nextX; A comment explaining this loop sounds like it would be worthwhile.
Adam Langley
Comment 3 2011-01-13 16:13:32 PST
Comment on attachment 78866 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=78866&action=review > Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp:163 > + const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos + endOfRun], false).fontData; If this is a UTF16 string, will this not consider surrogate-pairs as two code points?
Evan Martin
Comment 4 2011-01-13 16:20:01 PST
Comment on attachment 78866 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=78866&action=review >> Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp:163 >> + const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos + endOfRun], false).fontData; > > If this is a UTF16 string, will this not consider surrogate-pairs as two code points? Probably. This is just a reindent of L184 in the previous code, so at least I don't think I'm regressing anything.
Evan Martin
Comment 5 2011-01-13 16:24:37 PST
Evan Martin
Comment 6 2011-01-13 16:25:19 PST
BTW, this is a good page for thinking about the logic with respect to glyphIndexForXPositionInScriptRun: http://www.aestheticallyloyal.com/public/optimize-legibility/ With this patch, selection in the non-complex case matches the complex case.
Evan Martin
Comment 7 2011-01-13 16:49:05 PST
Note You need to log in before you can comment on or make changes to this bug.