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
+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.
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);
#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;
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:
}
// 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;
bool usingDot;
NSColor *patternColor;
switch (style) {
- case TextCheckingSpellingLineStyle:
+ case DocumentMarkerSpellingLineStyle:
{
// Constants for spelling pattern color.
static bool usingDotForSpelling = false;
patternColor = spellingPatternColor.get();
break;
}
- case TextCheckingGrammarLineStyle:
+ case DocumentMarkerGrammarLineStyle:
{
// Constants for grammar pattern color.
static bool usingDotForGrammar = false;
}
#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;
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;
}
-void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
{
if (paintingDisabled())
return;
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:
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;
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
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);
setStrokeStyle(oldStyle);
}
-void GraphicsContext::drawLineForTextChecking(const FloatPoint&, float width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle style)
{
notImplemented();
}
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:
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;
}
}
// 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)