Title: [97517] trunk/Source/WebCore
Revision
97517
Author
[email protected]
Date
2011-10-14 15:13:39 -0700 (Fri, 14 Oct 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=70148
Should switch to CoreUI version of CorrectionDot, GrammarDot, and SpellingDot
-and corresponding-
<rdar://problem/10208281>

Reviewed by Anders Carlsson.

Use NS*Dot whenever it's available, and fallback to *Dot only when it is not.
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::createPatternColor):
(WebCore::GraphicsContext::drawLineForTextChecking):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97516 => 97517)


--- trunk/Source/WebCore/ChangeLog	2011-10-14 22:13:00 UTC (rev 97516)
+++ trunk/Source/WebCore/ChangeLog	2011-10-14 22:13:39 UTC (rev 97517)
@@ -1,3 +1,17 @@
+2011-10-14  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=70148
+        Should switch to CoreUI version of CorrectionDot, GrammarDot, and SpellingDot
+        -and corresponding-
+        <rdar://problem/10208281>
+
+        Reviewed by Anders Carlsson.
+
+        Use NS*Dot whenever it's available, and fallback to *Dot only when it is not.
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::createPatternColor):
+        (WebCore::GraphicsContext::drawLineForTextChecking):
+
 2011-10-14  Dmitry Lomov  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=70120

Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm (97516 => 97517)


--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2011-10-14 22:13:00 UTC (rev 97516)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2011-10-14 22:13:39 UTC (rev 97517)
@@ -82,9 +82,13 @@
 }
 
 
-static NSColor* createPatternColor(NSString* name, NSColor* defaultColor, bool& usingDot)
+static NSColor* createPatternColor(NSString* firstChoiceName, NSString* secondChoiceName, NSColor* defaultColor, bool& usingDot)
 {
-    NSImage *image = [NSImage imageNamed:name];
+    // Eventually we should be able to get rid of the secondChoiceName. For the time being we need both to keep
+    // this working on all platforms.
+    NSImage *image = [NSImage imageNamed:firstChoiceName];
+    if (!image)
+        image = [NSImage imageNamed:secondChoiceName];
     ASSERT(image); // if image is not available, we want to know
     NSColor *color = (image ? [NSColor colorWithPatternImage:image] : nil);
     if (color)
@@ -111,7 +115,7 @@
         {
             // Constants for spelling pattern color.
             static bool usingDotForSpelling = false;
-            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"SpellingDot", [NSColor redColor], usingDotForSpelling)));
+            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"NSSpellingDot", @"SpellingDot", [NSColor redColor], usingDotForSpelling)));
             usingDot = usingDotForSpelling;
             patternColor = spellingPatternColor.get();
             break;
@@ -120,7 +124,7 @@
         {
             // Constants for grammar pattern color.
             static bool usingDotForGrammar = false;
-            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, grammarPatternColor, (createPatternColor(@"GrammarDot", [NSColor greenColor], usingDotForGrammar)));
+            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, grammarPatternColor, (createPatternColor(@"NSGrammarDot", @"GrammarDot", [NSColor greenColor], usingDotForGrammar)));
             usingDot = usingDotForGrammar;
             patternColor = grammarPatternColor.get();
             break;
@@ -131,7 +135,7 @@
         {
             // Constants for spelling pattern color.
             static bool usingDotForSpelling = false;
-            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"CorrectionDot", [NSColor blueColor], usingDotForSpelling)));
+            DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"NSCorrectionDot", @"CorrectionDot", [NSColor blueColor], usingDotForSpelling)));
             usingDot = usingDotForSpelling;
             patternColor = spellingPatternColor.get();
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to