Reviewed by Darin, landed by ap.
- fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=5461 Text width measured incorrectly when text-align: justify WebCore: * khtml/rendering/font.h: * khtml/rendering/font.cpp: (khtml::Font::selectionRectForText): Added. * khtml/rendering/render_text.cpp: (kthml::InlineTextBox::selectionRect): Use selectionRectForText. This works for justified text as well, and avoids intermediate rounding which resulted in selection rects narrower than AppKit's. (khtml::InlineTextBox::positionForOffset): Use selectionRectForText, which works for justified text as well. * kwq/KWQFontMetrics.h: * kwq/KWQFontMetrics.mm: (QFontMetrics::selectionRectForText): Added. * kwq/WebCoreTextRenderer.h: WebKit: * WebCoreSupport.subproj/WebTextRenderer.m: (-[WebTextRenderer selectionRectForRun:style:geometry:]): Added. (CG_drawHighlight): Use new function CG_selectionRect. (CG_selectionRect): New function to compute the selection rect. Eliminated rounding hackery that was required for keeping the highlight rect within the selection rect computed by InlineTextBox::selectionRect, since the latter uses this function now. The new selection rect is wider and matches AppKit more closely, although the right hand side is roundf()ed instead of cielf()ed for optimal caret positioning. (ATSU_drawHighlight): Use new function ATSU_selectionRect. (ATSU_selectionRect): New function to compute the selection rect. Much like CG_selectionRect. LayoutTests: * fast/text/justified-text-rect-expected.checksum: Added. * fast/text/justified-text-rect-expected.png: Added. * fast/text/justified-text-rect-expected.txt: Added. * fast/text/justified-text-rect.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Showing with 222 additions and 81 deletions