Center misspelling dots across width of word

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: http://svn.webkit.org/repository/webkit/trunk@156716 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 04f92d1b
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
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
......@@ -147,6 +147,8 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
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
// to make sure everything gets underlined, but that results in drawing out of
......@@ -155,9 +157,11 @@ 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
// In order to remove this requirement we will need to use CGPattern instead of NSColor
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment