Center misspelling dots across width of word
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2013 16:59:59 +0000 (16:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2013 16:59:59 +0000 (16:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122046

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-10-01
Reviewed by Darin Adler.

Source/WebCore:

Test: editing/spelling/spelling.html

* platform/graphics/GraphicsContext.h:
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawLineForDocumentMarker):

LayoutTests:

This patch only rebaselines a single test. I would have rebaselined
the rest of the tests, but they seem to be affected by
webkit.org/b/122146. I don't want to commit incorrect expected results.

* platform/mac/editing/spelling/spelling-expected.png:

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

LayoutTests/ChangeLog
LayoutTests/platform/mac/editing/spelling/spelling-expected.png
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm

index a6cb623..e4967d0 100644 (file)
@@ -1,3 +1,16 @@
+2013-10-01  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Center misspelling dots across width of word
+        https://bugs.webkit.org/show_bug.cgi?id=122046
+
+        Reviewed by Darin Adler.
+
+        This patch only rebaselines a single test. I would have rebaselined
+        the rest of the tests, but they seem to be affected by
+        webkit.org/b/122146. I don't want to commit incorrect expected results.
+
+        * platform/mac/editing/spelling/spelling-expected.png:
+
 2013-10-01  Brendan Long  <b.long@cablelabs.com>
 
         [GStreamer] Support "chapter" text tracks
index a4764f8..9aa20a1 100644 (file)
Binary files a/LayoutTests/platform/mac/editing/spelling/spelling-expected.png and b/LayoutTests/platform/mac/editing/spelling/spelling-expected.png differ
index 5254fb2..96236fb 100644 (file)
@@ -1,3 +1,16 @@
+2013-10-01  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Center misspelling dots across width of word
+        https://bugs.webkit.org/show_bug.cgi?id=122046
+
+        Reviewed by Darin Adler.
+
+        Test: editing/spelling/spelling.html
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+
 2013-10-01  Daniel Bates  <dabates@apple.com>
 
         [iOS] WebCore fails to build with newer versions of clang
index a819037..1a1125b 100644 (file)
@@ -146,6 +146,8 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
         default:
             return;
     }
+    
+    FloatPoint offsetPoint = point;
 
     // Make sure to draw only complete dots.
     // NOTE: Code here used to shift the underline to the left and increase the width
@@ -155,8 +157,10 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
     if (usingDot) {
         // allow slightly more considering that the pattern ends with a transparent pixel
         float widthMod = fmodf(width, patternWidth);
-        if (patternWidth - widthMod > cMisspellingLinePatternGapWidth)
+        if (patternWidth - widthMod > cMisspellingLinePatternGapWidth) {
+            offsetPoint.move(widthMod / 2, 0);
             width -= widthMod;
+        }
     }
     
     // FIXME: This code should not use NSGraphicsContext currentContext
@@ -172,9 +176,9 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
 
     [patternColor set];
 
-    wkSetPatternPhaseInUserSpace(context, point);
+    wkSetPatternPhaseInUserSpace(context, offsetPoint);
 
-    NSRectFillUsingOperation(NSMakeRect(point.x(), point.y(), width, patternHeight), NSCompositeSourceOver);
+    NSRectFillUsingOperation(NSMakeRect(offsetPoint.x(), offsetPoint.y(), width, patternHeight), NSCompositeSourceOver);
     
     CGContextRestoreGState(context);
 }