Index: Source/platform/graphics/GraphicsContext.cpp |
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp |
index e835e54391595b90bc087ab7258d04f26c46b5ce..58c24d36345bec45acd3fc2bfd3c97ca3dd23225 100644 |
--- a/Source/platform/graphics/GraphicsContext.cpp |
+++ b/Source/platform/graphics/GraphicsContext.cpp |
@@ -719,7 +719,6 @@ void GraphicsContext::drawInnerShadow(const RoundedRect& rect, const Color& shad |
clearDrawLooper(); |
} |
-// This is only used to draw borders. |
void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) |
{ |
if (paintingDisabled()) |
@@ -907,32 +906,35 @@ void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool pr |
if (width <= 0) |
return; |
- int thickness = SkMax32(static_cast<int>(strokeThickness()), 1); |
- SkRect r; |
- r.fLeft = WebCoreFloatToSkScalar(pt.x()); |
- // Avoid anti-aliasing lines. Currently, these are always horizontal. |
- // Round to nearest pixel to match text and other content. |
- r.fTop = WebCoreFloatToSkScalar(floorf(pt.y() + 0.5f)); |
- r.fRight = r.fLeft + WebCoreFloatToSkScalar(width); |
- r.fBottom = r.fTop + SkIntToScalar(thickness); |
- |
SkPaint paint; |
switch (strokeStyle()) { |
case NoStroke: |
case SolidStroke: |
case DoubleStroke: |
- case WavyStroke: |
+ case WavyStroke: { |
+ int thickness = SkMax32(static_cast<int>(strokeThickness()), 1); |
+ SkRect r; |
+ r.fLeft = WebCoreFloatToSkScalar(pt.x()); |
+ // Avoid anti-aliasing lines. Currently, these are always horizontal. |
+ // Round to nearest pixel to match text and other content. |
+ r.fTop = WebCoreFloatToSkScalar(floorf(pt.y() + 0.5f)); |
+ r.fRight = r.fLeft + WebCoreFloatToSkScalar(width); |
+ r.fBottom = r.fTop + SkIntToScalar(thickness); |
paint = immutableState()->fillPaint(); |
- break; |
+ // Text lines are drawn using the stroke color. |
+ paint.setColor(effectiveStrokeColor()); |
+ drawRect(r, paint); |
+ return; |
+ } |
case DottedStroke: |
- case DashedStroke: |
- paint = immutableState()->strokePaint(); |
- break; |
+ case DashedStroke: { |
+ int y = floorf(pt.y() + std::max<float>(strokeThickness() / 2.0f, 0.5f)); |
+ drawLine(IntPoint(pt.x(), y), IntPoint(pt.x() + width, y)); |
+ return; |
+ } |
} |
- // Text lines are drawn using the stroke color. |
- paint.setColor(effectiveStrokeColor()); |
- drawRect(r, paint); |
+ ASSERT_NOT_REACHED(); |
} |
// Draws a filled rectangle with a stroked border. |