From f54449140e1a40a8b48aa7507f5524d58e60a3c5 Mon Sep 17 00:00:00 2001 From: harrison Date: Sun, 20 Mar 2005 04:58:41 +0000 Subject: [PATCH] Reviewed by Maciej. Misspelling underline does underline the whole word, could go farther to the right * WebCoreSupport.subproj/WebTextRenderer.m: (-[WebTextRenderer misspellingLinePatternGapWidth]): (-[WebTextRenderer drawLineForMisspelling:withWidth:]): Consider that the last pixel in the underline dot pattern is transparent. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8938 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebKit/ChangeLog | 11 ++++++++++ .../WebCoreSupport.subproj/WebTextRenderer.m | 21 ++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 476e96ae1491..70c2501f9fa0 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,14 @@ +2005-03-19 David Harrison + + Reviewed by Maciej. + + Misspelling underline does underline the whole word, could go farther to the right + + * WebCoreSupport.subproj/WebTextRenderer.m: + (-[WebTextRenderer misspellingLinePatternGapWidth]): + (-[WebTextRenderer drawLineForMisspelling:withWidth:]): + Consider that the last pixel in the underline dot pattern is transparent. + 2005-03-19 Darin Adler Reviewed by Maciej (a while back). diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m index 2563791746c8..eb1c9f0bccb9 100644 --- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m +++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m @@ -639,6 +639,12 @@ static BOOL alwaysUseATSU = NO; return 4; } +// the number of transparent pixels after the dot +- (int)misspellingLinePatternGapWidth +{ + return 1; +} + - (void)drawLineForMisspelling:(NSPoint)point withWidth:(int)width { // Constants for pattern color @@ -659,13 +665,18 @@ static BOOL alwaysUseATSU = NO; spellingPatternColor = [color retain]; } - // Make sure to draw only complete dots + // Make sure to draw only complete dots. // NOTE: Code here used to shift the underline to the left and increase the width // to make sure everything gets underlined, but that results in drawing out of - // bounds, e.g. when at the edge of a view. - if (usingDot) - width -= (width % patternWidth); - + // bounds (e.g. when at the edge of a view) and could make it appear that the + // space between adjacent misspelled words was underlined. + if (usingDot) { + // allow slightly more considering that the pattern ends with a transparent pixel + int widthMod = width % patternWidth; + if (patternWidth - widthMod > [self misspellingLinePatternGapWidth]) + width -= widthMod; + } + // Compute the appropriate phase relative to the top level view in the window. NSPoint originInWindow = [[NSView focusView] convertPoint:point toView:nil]; // WebCore may translate the focus, and thus need an extra phase correction -- 2.36.0