Rename GraphicsContext::drawLineForTextChecking() to GraphicsContext::drawLineForDocu...
authorjpu@apple.com <jpu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 17:42:45 +0000 (17:42 +0000)
committerjpu@apple.com <jpu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 17:42:45 +0000 (17:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82946

Reviewed by Enrica Casucci.

On OS X, we draw similar underline on dictated text that has alternative text. We rename
this function, so that we can reuse it for dictation underline.

No new tests, since there's no change of functionality.

* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* rendering/InlineTextBox.cpp:
(WebCore::lineStyleForMarkerType):
(WebCore::InlineTextBox::paintSpellingOrGrammarMarker):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
Source/WebCore/rendering/InlineTextBox.cpp

index 09c9bd2..5f2d845 100644 (file)
@@ -1,3 +1,36 @@
+2012-04-03  Jia Pu  <jpu@apple.com>
+
+        Rename GraphicsContext::drawLineForTextChecking() to GraphicsContext::drawLineForDocumentMarker()
+        https://bugs.webkit.org/show_bug.cgi?id=82946
+
+        Reviewed by Enrica Casucci.
+
+        On OS X, we draw similar underline on dictated text that has alternative text. We rename
+        this function, so that we can reuse it for dictation underline.
+
+        No new tests, since there's no change of functionality. 
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::lineStyleForMarkerType):
+        (WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
+
 2012-04-03  Jer Noble  <jer.noble@apple.com>
 
         ESC key in full screen does not result in webkitFullScreenChange event.
index c722cbc..9e46999 100644 (file)
@@ -355,12 +355,13 @@ namespace WebCore {
         FloatRect roundToDevicePixels(const FloatRect&, RoundingMode = RoundAllSides);
 
         void drawLineForText(const FloatPoint&, float width, bool printing);
-        enum TextCheckingLineStyle {
-            TextCheckingSpellingLineStyle,
-            TextCheckingGrammarLineStyle,
-            TextCheckingReplacementLineStyle
+        enum DocumentMarkerLineStyle {
+            DocumentMarkerSpellingLineStyle,
+            DocumentMarkerGrammarLineStyle,
+            DocumentMarkerAutocorrectionReplacementLineStyle,
+            DocumentMarkerDictationAlternativesLineStyle
         };
-        void drawLineForTextChecking(const FloatPoint&, float width, TextCheckingLineStyle);
+        void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle);
 
         bool paintingDisabled() const;
         void setPaintingDisabled(bool);
index ba886a0..ec846f1 100644 (file)
@@ -682,7 +682,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, boo
 #include "DrawErrorUnderline.h"
 #endif
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
@@ -691,10 +691,10 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float wi
     cairo_save(cr);
 
     switch (style) {
-    case TextCheckingSpellingLineStyle:
+    case DocumentMarkerSpellingLineStyle:
         cairo_set_source_rgb(cr, 1, 0, 0);
         break;
-    case TextCheckingGrammarLineStyle:
+    case DocumentMarkerGrammarLineStyle:
         cairo_set_source_rgb(cr, 0, 1, 0);
         break;
     default:
index aced96b..e08591d 100644 (file)
@@ -99,7 +99,7 @@ static NSColor* createPatternColor(NSString* firstChoiceName, NSString* secondCh
 }
 
 // WebKit on Mac is a standard platform component, so it must use the standard platform artwork for underline.
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
@@ -111,7 +111,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float wid
     bool usingDot;
     NSColor *patternColor;
     switch (style) {
-        case TextCheckingSpellingLineStyle:
+        case DocumentMarkerSpellingLineStyle:
         {
             // Constants for spelling pattern color.
             static bool usingDotForSpelling = false;
@@ -120,7 +120,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float wid
             patternColor = spellingPatternColor.get();
             break;
         }
-        case TextCheckingGrammarLineStyle:
+        case DocumentMarkerGrammarLineStyle:
         {
             // Constants for grammar pattern color.
             static bool usingDotForGrammar = false;
@@ -131,7 +131,8 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float wid
         }
 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
         // To support correction panel.
-        case TextCheckingReplacementLineStyle:
+        case DocumentMarkerAutocorrectionReplacementLineStyle:
+        case DocumentMarkerDictationAlternativesLineStyle:
         {
             // Constants for spelling pattern color.
             static bool usingDotForSpelling = false;
index 4417d7b..74c94f3 100644 (file)
@@ -246,7 +246,7 @@ void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool pr
     UNUSED_PARAM(printing);
 }
 
-void GraphicsContext::drawLineForTextChecking(const IntPoint& origin, int width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const IntPoint& origin, int width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
index aa49e2d..b8e95f2 100644 (file)
@@ -975,7 +975,7 @@ static void drawErrorUnderline(QPainter *painter, qreal x, qreal y, qreal width,
 }
 
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
@@ -984,10 +984,10 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float wi
     const QPen originalPen = painter->pen();
 
     switch (style) {
-    case TextCheckingSpellingLineStyle:
+    case DocumentMarkerSpellingLineStyle:
         painter->setPen(Qt::red);
         break;
-    case TextCheckingGrammarLineStyle:
+    case DocumentMarkerGrammarLineStyle:
         painter->setPen(Qt::green);
         break;
     default:
index d54c986..ce44f0c 100644 (file)
@@ -507,7 +507,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
     platformContext()->didDrawPoints(SkCanvas::kLines_PointMode, 2, pts, paint);
 }
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& pt, float width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
index f3a919d..063f7cb 100644 (file)
@@ -181,12 +181,12 @@ static const Color& grammarPatternColor() {
     return grammarColor;
 }
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
 
-    if (style != TextCheckingSpellingLineStyle && style != TextCheckingGrammarLineStyle)
+    if (style != DocumentMarkerSpellingLineStyle && style != DocumentMarkerGrammarLineStyle)
         return;
 
     // These are the same for misspelling or bad grammar
@@ -209,7 +209,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float wid
     CGContextRef context = platformContext();
     CGContextSaveGState(context);
 
-    const Color& patternColor = style == TextCheckingGrammarLineStyle ? grammarPatternColor() : spellingPatternColor();
+    const Color& patternColor = style == DocumentMarkerGrammarLineStyle ? grammarPatternColor() : spellingPatternColor();
     setCGStrokeColor(context, patternColor);
 
     wkSetPatternPhaseInUserSpace(context, point);
index 96bc3dc..92e02a0 100644 (file)
@@ -1032,7 +1032,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, boo
     setStrokeStyle(oldStyle);
 }
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint&, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle style)
 {
     notImplemented();
 }
index 452638b..54c0d98 100644 (file)
@@ -442,13 +442,13 @@ void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, boo
     restore();
 }
 
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
 {
     switch (style) {
-    case TextCheckingSpellingLineStyle:
+    case DocumentMarkerSpellingLineStyle:
         m_data->context->SetPen(wxPen(*wxRED, 2, wxLONG_DASH));
         break;
-    case TextCheckingGrammarLineStyle:
+    case DocumentMarkerGrammarLineStyle:
         m_data->context->SetPen(wxPen(*wxGREEN, 2, wxLONG_DASH));
         break;
     default:
index 7a6c561..154ce81 100644 (file)
@@ -983,18 +983,18 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
         context->clearShadow();
 }
 
-static GraphicsContext::TextCheckingLineStyle textCheckingLineStyleForMarkerType(DocumentMarker::MarkerType markerType)
+static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentMarker::MarkerType markerType)
 {
     switch (markerType) {
     case DocumentMarker::Spelling:
-        return GraphicsContext::TextCheckingSpellingLineStyle;
+        return GraphicsContext::DocumentMarkerSpellingLineStyle;
     case DocumentMarker::Grammar:
-        return GraphicsContext::TextCheckingGrammarLineStyle;
+        return GraphicsContext::DocumentMarkerGrammarLineStyle;
     case DocumentMarker::CorrectionIndicator:
-        return GraphicsContext::TextCheckingReplacementLineStyle;
+        return GraphicsContext::DocumentMarkerAutocorrectionReplacementLineStyle;
     default:
         ASSERT_NOT_REACHED();
-        return GraphicsContext::TextCheckingSpellingLineStyle;
+        return GraphicsContext::DocumentMarkerSpellingLineStyle;
     }
 }
 
@@ -1063,7 +1063,7 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, const Floa
         // In larger fonts, though, place the underline up near the baseline to prevent a big gap.
         underlineOffset = baseline + 2;
     }
-    pt->drawLineForTextChecking(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker->type()));
+    pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkerType(marker->type()));
 }
 
 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font)