[Skia Mac] Make misspelling underline dots unclipped
authorcaryclark@google.com <caryclark@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 17:15:42 +0000 (17:15 +0000)
committercaryclark@google.com <caryclark@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 17:15:42 +0000 (17:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78117
http://code.google.com/p/chromium/issues/detail?id=113154

Reviewed by Stephen White.

No new tests. Existing layout tests cover this.

As is done on the CoreGraphics Mac platform, adjust the
underline width to remove partial dots, not including the
trailing transparent pixel column.

* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::drawLineForTextChecking):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

index c762983..26f0a18 100644 (file)
@@ -1,3 +1,20 @@
+2012-02-08  Cary Clark  <caryclark@google.com>
+
+        [Skia Mac] Make misspelling underline dots unclipped
+        https://bugs.webkit.org/show_bug.cgi?id=78117
+        http://code.google.com/p/chromium/issues/detail?id=113154
+
+        Reviewed by Stephen White.
+
+        No new tests. Existing layout tests cover this.
+
+        As is done on the CoreGraphics Mac platform, adjust the
+        underline width to remove partial dots, not including the
+        trailing transparent pixel column.
+
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::drawLineForTextChecking):
+
 2012-02-08  Pavel Feldman  <pfeldman@google.com>
 
         Web Inspector: bind entire subtree upon childNodeInserted so that text node were accounted.
index 355a6b5..4f79cfb 100644 (file)
@@ -721,6 +721,11 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width,
     SkScalar originX = WebCoreFloatToSkScalar(pt.x());
 #if PLATFORM(CHROMIUM) && OS(DARWIN)
     SkScalar originY = WebCoreFloatToSkScalar(pt.y());
+    // Make sure to draw only complete dots.
+    int rowPixels = misspellBitmap->width();
+    float widthMod = fmodf(width, rowPixels);
+    if (rowPixels - widthMod > 1)
+        width -= widthMod;
 #else
     // Offset it vertically by 1 so that there's some space under the text.
     SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1;