summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/mac/GraphicsContextMac.mm
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-08 12:18:00 +0100
committerKristian Monsen <kristianm@google.com>2010-09-11 12:08:58 +0100
commit5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch)
tree775803c4ab35af50aa5f5472cd1fb95fe9d5152d /WebCore/platform/graphics/mac/GraphicsContextMac.mm
parent3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff)
downloadexternal_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'WebCore/platform/graphics/mac/GraphicsContextMac.mm')
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContextMac.mm50
1 files changed, 34 insertions, 16 deletions
diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
index 5f111f6..f3301d8 100644
--- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
@@ -119,7 +119,7 @@ static NSColor* createPatternColor(NSString* name, NSColor* defaultColor, bool&
}
// WebKit on Mac is a standard platform component, so it must use the standard platform artwork for underline.
-void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint& point, int width, bool grammar)
+void GraphicsContext::drawLineForTextChecking(const IntPoint& point, int width, TextCheckingLineStyle style)
{
if (paintingDisabled())
return;
@@ -127,23 +127,41 @@ void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint& point,
// These are the same for misspelling or bad grammar.
int patternHeight = cMisspellingLineThickness;
int patternWidth = cMisspellingLinePatternWidth;
-
+
bool usingDot;
NSColor *patternColor;
- if (grammar) {
- // Constants for grammar pattern color.
- static bool usingDotForGrammar = false;
- DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, grammarPatternColor, (createPatternColor(@"GrammarDot", [NSColor greenColor], usingDotForGrammar)));
-
- usingDot = usingDotForGrammar;
- patternColor = grammarPatternColor.get();
- } else {
- // Constants for spelling pattern color.
- static bool usingDotForSpelling = false;
- DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"SpellingDot", [NSColor redColor], usingDotForSpelling)));
-
- usingDot = usingDotForSpelling;
- patternColor = spellingPatternColor.get();
+ switch (style) {
+ case TextCheckingSpellingLineStyle:
+ {
+ // Constants for spelling pattern color.
+ static bool usingDotForSpelling = false;
+ DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"SpellingDot", [NSColor redColor], usingDotForSpelling)));
+ usingDot = usingDotForSpelling;
+ patternColor = spellingPatternColor.get();
+ break;
+ }
+ case TextCheckingGrammarLineStyle:
+ {
+ // Constants for grammar pattern color.
+ static bool usingDotForGrammar = false;
+ DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, grammarPatternColor, (createPatternColor(@"GrammarDot", [NSColor greenColor], usingDotForGrammar)));
+ usingDot = usingDotForGrammar;
+ patternColor = grammarPatternColor.get();
+ break;
+ }
+#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ case TextCheckingReplacementLineStyle:
+ {
+ // Constants for spelling pattern color.
+ static bool usingDotForSpelling = false;
+ DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"CorrectionDot", [NSColor blueColor], usingDotForSpelling)));
+ usingDot = usingDotForSpelling;
+ patternColor = spellingPatternColor.get();
+ break;
+ }
+#endif
+ default:
+ return;
}
// Make sure to draw only complete dots.