On November 5, 2012 at 7:27 PM Bruno Abinader <[email protected]> wrote:


> 2012/11/5 Nico Weber <[email protected] [mailto:[email protected]] >
> 
> 
> > The spelling underline on OS X is not a wavy line. If you end up
> > changing the skia code, please make sure the chromium/mac spelling
> > underline doesn't become a wavy line.
> > 
> > Nico
> > 

> 
> Interesting point. Said this, I'd say it is so far a matter of porting the
> drawErrorUnderline() code from Cairo/Qt into Skia and use it instead of
> modifying drawLineForDocumentMarker. For Qt/Cairo implementations, instead of
> duplicating code, just make use of the already implemented function with
> attention to use proper text decoration colors.
Hi, 
The attached patch replaces drawErrorUnderline() call in
drawLineForDocumentMarker() with a call to drawLine() using wavy stroke. The
patch is small and the result is pretty the same (I can attach the screenshots
if you want to see it). Please take a look.

Lamarque V. Souza
Software Engineer (basyskom.com)
Nokia Certified Qt Specialist
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 44bc0ed..dc83bf7 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -992,6 +992,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, boo
 }
 
 
+#if !ENABLE(CSS3_TEXT)
 /*
  *   NOTE: This code is completely based upon the one from
  *   Source/WebCore/platform/graphics/cairo/DrawErrorUnderline.{h|cpp}
@@ -1068,6 +1069,7 @@ static void drawErrorUnderline(QPainter *painter, qreal x, qreal y, qreal width,
 
     painter->drawPath(path);
 }
+#endif // CSS3_TEXT
 
 
 void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
@@ -1089,7 +1091,17 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float
         return;
     }
 
+#if ENABLE(CSS3_TEXT)
+    StrokeStyle oldStrokeStyle = strokeStyle();
+    setStrokeStyle(WavyStroke);
+    float oldStrokeThickness = strokeThickness();
+    setStrokeThickness(cMisspellingLineThickness);
+    drawLine(IntPoint(origin.x(), origin.y() + cMisspellingLineThickness / 2), IntPoint(origin.x() + width, origin.y() + cMisspellingLineThickness / 2));
+    setStrokeStyle(oldStrokeStyle);
+    setStrokeThickness(oldStrokeThickness);
+#else
     drawErrorUnderline(painter, origin.x(), origin.y(), width, cMisspellingLineThickness);
+#endif // CSS3_TEXT
     painter->setPen(originalPen);
 }
 
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to