Title: [132076] trunk
Revision
132076
Author
[email protected]
Date
2012-10-22 08:52:23 -0700 (Mon, 22 Oct 2012)

Log Message

[css3-text] Add rendering support for -webkit-text-decoration-style
https://bugs.webkit.org/show_bug.cgi?id=94094

Patch by Bruno de Oliveira Abinader <[email protected]> on 2012-10-22
Reviewed by Julien Chaffraix.

Source/WebCore:

This patch implements the "text-decoration-style" property rendering as
specified in CSS3 working draft, with "-webkit-" prefix. The specification can
be found here: http://dev.w3.org/csswg/css3-text/#text-decoration-style

Additionally, Mozilla implementation details can be found here:
https://developer.mozilla.org/en/CSS/text-decoration-style

Tests: fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html
       fast/css3-text/css3-text-decoration/text-decoration-style.html

* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setPlatformStrokeStyle):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLine):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::toQPenStyle):
(WebCore::GraphicsContext::drawLine):
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::setupPaintForStroking):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::createPen):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::strokeStyleToWxPenStyle):
Added 'DoubleStroke' and 'WavyStroke' to StrokeStyle enum and updated
platform-specific stroke handling. Some styles requires
platform-specific implementation (handled in bug 92868).
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
(WebCore::textDecorationStyleToStrokeStyle): Added static function that
translates text decoration to stroke styles.
(WebCore::InlineTextBox::paintDecoration): Text decoration style does
not specify a property for line thickness (like border-width does for
border style), so we statically set it to 1 for now. The 'double' style
implementation simply adds a parallel line (depending if it is
underline, overline or line-through) and the space between lines follows
the approach used by border's 'double' style.
* rendering/InlineTextBox.h:
(InlineTextBox):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
Added text decoration style rendering support to
InlineTextBox::paintDecoration().

LayoutTests:

Added paint and repaint layout tests for CSS3 text-decoration-style
property. Pixel results are not included due to missing platform support
for some decoration styles (handled on bug 93507). These are going
to be added when platform support is complete.

* fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt: Added.
* fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt: Added.
* fast/css3-text/css3-text-decoration/text-decoration-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132075 => 132076)


--- trunk/LayoutTests/ChangeLog	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/LayoutTests/ChangeLog	2012-10-22 15:52:23 UTC (rev 132076)
@@ -1,3 +1,20 @@
+2012-10-22  Bruno de Oliveira Abinader  <[email protected]>
+
+        [css3-text] Add rendering support for -webkit-text-decoration-style
+        https://bugs.webkit.org/show_bug.cgi?id=94094
+
+        Reviewed by Julien Chaffraix.
+
+        Added paint and repaint layout tests for CSS3 text-decoration-style
+        property. Pixel results are not included due to missing platform support
+        for some decoration styles (handled on bug 93507). These are going
+        to be added when platform support is complete.
+
+        * fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt: Added.
+        * fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-style.html: Added.
+
 2012-10-22  Erik Arvidsson  <[email protected]>
 
         HTMLBaseElement href attribute binding returns wrong URL

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt (0 => 132076)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt	2012-10-22 15:52:23 UTC (rev 132076)
@@ -0,0 +1,9 @@
+lorem ipsum
+
+lorem ipsum
+
+lorem ipsum
+
+lorem ipsum
+
+lorem ipsum

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html (0 => 132076)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html	2012-10-22 15:52:23 UTC (rev 132076)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <!-- Bugzilla link: http://webkit.org/b/94094 -->
+        <title>CSS Test: CSS3 text-decoration-style repaint</title>
+        <link rel="help" href=""
+        <meta name="flags" content="ahem"/>
+        <script>
+            if (window.testRunner)
+                testRunner.dumpAsText(true);
+        </script>
+        <script src="" type="text/_javascript_"></script>
+        <script>
+            function repaintTest() {
+                document.getElementById("test-initial-blank").style.webkitTextDecorationStyle = '';
+                document.getElementById("test-initial-explicit").style.webkitTextDecorationStyle = 'initial';
+                document.getElementById("test-invalid-unknown").style.webkitTextDecorationStyle = 'unknown';
+                document.getElementById("test-inherit-explicit").style.webkitTextDecorationStyle = 'inherit';
+                document.getElementById("test-repaint-parent").style.webkitTextDecorationStyle = 'double';
+            }
+        </script>
+    </head>
+    <body _onload_="runRepaintTest();" style="font: 20px Ahem; -webkit-font-smoothing: none; -webkit-text-stroke: 1px black; -webkit-text-fill-color: white;">
+        <!-- Blank and 'initial' values fallbacks to 'solid' on repaintTest(). -->
+        <p><span id="test-initial-blank" style="text-decoration: underline; -webkit-text-decoration-style: double;">lorem ipsum</span></p>
+        <p><span id="test-initial-explicit" style="text-decoration: underline; -webkit-text-decoration-style: double;">lorem ipsum</span></p>
+        <!-- Unknown value is ignored and fallback to last valid value on repaintTest() -->
+        <p><span id="test-invalid-unknown" style="text-decoration: underline; -webkit-text-decoration-style: double;">lorem ipsum</span></p>
+        <!-- Ancestor can explicitly request 'inherit' from parent on repaintTest() -->
+        <p><span style="text-decoration: underline; -webkit-text-decoration-style: double;"><span id="test-inherit-explicit" style="-webkit-text-decoration-style: dashed;">lorem ipsum</span></span></p>
+        <!-- Ancestor span should not inherit 'double' style from parent on repaintTest(). -->
+        <p><span id="test-repaint-parent" style="text-decoration: underline;"><span>lorem ipsum</span></span></p>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt (0 => 132076)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt	2012-10-22 15:52:23 UTC (rev 132076)
@@ -0,0 +1,9 @@
+lorem ipsum lorem ipsum lorem ipsum
+
+lorem ipsum lorem ipsum lorem ipsum
+
+lorem ipsum lorem ipsum lorem ipsum
+
+lorem ipsum lorem ipsum lorem ipsum
+
+lorem ipsum lorem ipsum lorem ipsum

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style.html (0 => 132076)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style.html	2012-10-22 15:52:23 UTC (rev 132076)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <!-- Bugzilla link: http://webkit.org/b/94094 -->
+        <title>CSS Test: CSS3 text-decoration-style</title>
+        <link rel="help" href=""
+        <meta name="flags" content="ahem"/>
+        <script>
+            if (window.testRunner)
+                testRunner.dumpAsText(true);
+        </script>
+        <style>
+            div { padding: 10px; diplay: inline; }
+            div.solid { border: 5px solid; }
+            div.double { border: 5px double; }
+            div.dashed { border: 5px dashed; }
+            div.dotted { border: 5px dotted; }
+            span.underline { -webkit-text-decoration-line: underline; }
+            span.overline { -webkit-text-decoration-line: overline; }
+            span.line-through { -webkit-text-decoration-line: line-through; }
+            span.solid { -webkit-text-decoration-style: solid; }
+            span.double { -webkit-text-decoration-style: double; }
+            span.dashed { -webkit-text-decoration-style: dashed; }
+            span.dotted { -webkit-text-decoration-style: dotted; }
+            span.wavy { -webkit-text-decoration-style: wavy; }
+        </style>
+    </head>
+    <body style="font: 20px Ahem; -webkit-font-smoothing: none; -webkit-text-stroke: 1px black; -webkit-text-fill-color: white;">
+        <div class="solid"><span class="underline solid">lorem ipsum</span> <span class="overline solid">lorem ipsum</span> <span class="line-through solid">lorem ipsum</span></div><br/>
+        <div class="double"><span class="underline double">lorem ipsum</span> <span class="overline double">lorem ipsum</span> <span class="line-through double">lorem ipsum</span></div><br/>
+        <div class="dashed"><span class="underline dashed">lorem ipsum</span> <span class="overline dashed">lorem ipsum</span> <span class="line-through dashed">lorem ipsum</span></div><br/>
+        <div class="dotted"><span class="underline dotted">lorem ipsum</span> <span class="overline dotted">lorem ipsum</span> <span class="line-through dotted">lorem ipsum</span></div><br/>
+        <div><span class="underline wavy">lorem ipsum</span> <span class="overline wavy">lorem ipsum</span> <span class="line-through wavy">lorem ipsum</span></div>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (132075 => 132076)


--- trunk/Source/WebCore/ChangeLog	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/ChangeLog	2012-10-22 15:52:23 UTC (rev 132076)
@@ -1,3 +1,54 @@
+2012-10-22  Bruno de Oliveira Abinader  <[email protected]>
+
+        [css3-text] Add rendering support for -webkit-text-decoration-style
+        https://bugs.webkit.org/show_bug.cgi?id=94094
+
+        Reviewed by Julien Chaffraix.
+
+        This patch implements the "text-decoration-style" property rendering as
+        specified in CSS3 working draft, with "-webkit-" prefix. The specification can
+        be found here: http://dev.w3.org/csswg/css3-text/#text-decoration-style
+
+        Additionally, Mozilla implementation details can be found here:
+        https://developer.mozilla.org/en/CSS/text-decoration-style
+
+        Tests: fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html
+               fast/css3-text/css3-text-decoration/text-decoration-style.html
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::setPlatformStrokeStyle):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawLine):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::toQPenStyle):
+        (WebCore::GraphicsContext::drawLine):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::setupPaintForStroking):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::createPen):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::strokeStyleToWxPenStyle):
+        Added 'DoubleStroke' and 'WavyStroke' to StrokeStyle enum and updated
+        platform-specific stroke handling. Some styles requires
+        platform-specific implementation (handled in bug 92868).
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        (WebCore::textDecorationStyleToStrokeStyle): Added static function that
+        translates text decoration to stroke styles.
+        (WebCore::InlineTextBox::paintDecoration): Text decoration style does
+        not specify a property for line thickness (like border-width does for
+        border style), so we statically set it to 1 for now. The 'double' style
+        implementation simply adds a parallel line (depending if it is
+        underline, overline or line-through) and the space between lines follows
+        the approach used by border's 'double' style.
+        * rendering/InlineTextBox.h:
+        (InlineTextBox):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+        Added text decoration style rendering support to
+        InlineTextBox::paintDecoration().
+
 2012-10-22  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] Use the DNS resolve queue

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-10-22 15:52:23 UTC (rev 132076)
@@ -137,7 +137,11 @@
         NoStroke,
         SolidStroke,
         DottedStroke,
-        DashedStroke
+        DashedStroke,
+#if ENABLE(CSS3_TEXT)
+        DoubleStroke,
+        WavyStroke,
+#endif // CSS3_TEXT
     };
 
     enum InterpolationQuality {

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -802,6 +802,10 @@
         cairo_set_line_width(platformContext()->cr(), 0);
         break;
     case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+    case DoubleStroke:
+    case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94110 - Needs platform support.
+#endif // CSS3_TEXT
         cairo_set_dash(platformContext()->cr(), 0, 0, 0);
         break;
     case DottedStroke:

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -425,6 +425,10 @@
     switch (strokeStyle()) {
     case NoStroke:
     case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+    case DoubleStroke:
+    case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94112 - Needs platform support.
+#endif // CSS3_TEXT
         break;
     case DottedStroke:
         patWidth = (int)width;

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -156,6 +156,10 @@
         return Qt::NoPen;
         break;
     case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+    case DoubleStroke:
+    case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support.
+#endif
         return Qt::SolidLine;
         break;
     case DottedStroke:
@@ -402,6 +406,10 @@
     switch (style) {
     case NoStroke:
     case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+    case DoubleStroke:
+    case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support.
+#endif
         break;
     case DottedStroke: {
         capStyle = Qt::RoundCap;

Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -412,6 +412,10 @@
         switch (m_state->m_strokeStyle) {
         case NoStroke:
         case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+        case DoubleStroke:
+        case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93509 - Needs platform support.
+#endif // CSS3_TEXT
             break;
         case DashedStroke:
             width = m_state->m_dashRatio * width;

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -354,6 +354,10 @@
     int penStyle = PS_NULL;
     switch (style) {
         case SolidStroke:
+#if ENABLE(CSS3_TEXT)
+        case DoubleStroke:
+        case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94114 - Needs platform support.
+#endif // CSS3_TEXT
             penStyle = PS_SOLID;
             break;
         case DottedStroke:  // not supported on Windows CE

Modified: trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp (132075 => 132076)


--- trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -99,6 +99,12 @@
         return wxDOT;
     if (p == DashedStroke)
         return wxLONG_DASH;
+#if ENABLE(CSS3_TEXT)
+    if (p == DoubleStroke)
+        return wxSOLID;
+    if (p == WavyStroke) // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94111 - Needs platform support.
+        return wxSOLID;
+#endif // CSS3_TEXT
     if (p == NoStroke)
         return wxTRANSPARENT;
     

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (132075 => 132076)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2012-10-22 15:52:23 UTC (rev 132076)
@@ -766,10 +766,10 @@
     }
 
     // Paint decorations
-    int textDecorations = styleToUse->textDecorationsInEffect();
+    ETextDecoration textDecorations = styleToUse->textDecorationsInEffect();
     if (textDecorations != TDNONE && paintInfo.phase != PaintPhaseSelection) {
         updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace());
-        paintDecoration(context, boxOrigin, textDecorations, textShadow);
+        paintDecoration(context, boxOrigin, textDecorations, styleToUse->textDecorationStyle(), textShadow);
     }
 
     if (paintInfo.phase == PaintPhaseForeground) {
@@ -925,8 +925,38 @@
 
 #endif
 
-void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, int deco, const ShadowData* shadow)
+static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorationStyle)
 {
+    StrokeStyle strokeStyle = SolidStroke;
+    switch (decorationStyle) {
+    case TextDecorationStyleSolid:
+        strokeStyle = SolidStroke;
+        break;
+#if ENABLE(CSS3_TEXT)
+    case TextDecorationStyleDouble:
+        strokeStyle = DoubleStroke;
+        break;
+    case TextDecorationStyleDotted:
+        strokeStyle = DottedStroke;
+        break;
+    case TextDecorationStyleDashed:
+        strokeStyle = DashedStroke;
+        break;
+    case TextDecorationStyleWavy:
+        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=92868 - Needs platform support.
+        strokeStyle = WavyStroke;
+        break;
+#endif // CSS3_TEXT
+    }
+
+    return strokeStyle;
+}
+
+void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, ETextDecoration deco, TextDecorationStyle decorationStyle, const ShadowData* shadow)
+{
+    // FIXME: We should improve this rule and not always just assume 1.
+    const float textDecorationThickness = 1.f;
+
     if (m_truncation == cFullTruncation)
         return;
 
@@ -947,7 +977,7 @@
     
     // Use a special function for underlines to get the positioning exactly right.
     bool isPrinting = textRenderer()->document()->printing();
-    context->setStrokeThickness(1.0f); // FIXME: We should improve this rule and not always just assume 1.
+    context->setStrokeThickness(textDecorationThickness);
 
     bool linesAreOpaque = !isPrinting && (!(deco & UNDERLINE) || underline.alpha() == 255) && (!(deco & OVERLINE) || overline.alpha() == 255) && (!(deco & LINE_THROUGH) || linethrough.alpha() == 255);
 
@@ -976,7 +1006,7 @@
 
     ColorSpace colorSpace = renderer()->style()->colorSpace();
     bool setShadow = false;
-    
+
     do {
         if (shadow) {
             if (!shadow->next()) {
@@ -991,21 +1021,35 @@
             shadow = shadow->next();
         }
 
+#if ENABLE(CSS3_TEXT)
+        // Offset between lines - always non-zero, so lines never cross each other.
+        float doubleOffset = textDecorationThickness + 1.f;
+#endif // CSS3_TEXT
+        context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle));
         if (deco & UNDERLINE) {
             context->setStrokeColor(underline, colorSpace);
-            context->setStrokeStyle(SolidStroke);
             // Leave one pixel of white between the baseline and the underline.
             context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting);
+#if ENABLE(CSS3_TEXT)
+            if (decorationStyle == TextDecorationStyleDouble)
+                context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1 + doubleOffset), width, isPrinting);
+#endif // CSS3_TEXT
         }
         if (deco & OVERLINE) {
             context->setStrokeColor(overline, colorSpace);
-            context->setStrokeStyle(SolidStroke);
             context->drawLineForText(localOrigin, width, isPrinting);
+#if ENABLE(CSS3_TEXT)
+            if (decorationStyle == TextDecorationStyleDouble)
+                context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() - doubleOffset), width, isPrinting);
+#endif // CSS3_TEXT
         }
         if (deco & LINE_THROUGH) {
             context->setStrokeColor(linethrough, colorSpace);
-            context->setStrokeStyle(SolidStroke);
             context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting);
+#if ENABLE(CSS3_TEXT)
+            if (decorationStyle == TextDecorationStyleDouble)
+                context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting);
+#endif // CSS3_TEXT
         }
     } while (shadow);
 

Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (132075 => 132076)


--- trunk/Source/WebCore/rendering/InlineTextBox.h	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h	2012-10-22 15:52:23 UTC (rev 132076)
@@ -183,7 +183,7 @@
 #endif
 
 private:
-    void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, int decoration, const ShadowData*);
+    void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, ETextDecoration, TextDecorationStyle, const ShadowData*);
     void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor);
     void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar);
     void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&);

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (132075 => 132076)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-10-22 15:52:23 UTC (rev 132076)
@@ -619,6 +619,8 @@
     ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); }
 #if ENABLE(CSS3_TEXT)
     TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
+#else
+    TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; }
 #endif // CSS3_TEXT
     int wordSpacing() const;
     int letterSpacing() const;

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (132075 => 132076)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2012-10-22 15:36:26 UTC (rev 132075)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2012-10-22 15:52:23 UTC (rev 132076)
@@ -336,15 +336,15 @@
 inline ETextDecoration operator|(ETextDecoration a, ETextDecoration b) { return ETextDecoration(int(a) | int(b)); }
 inline ETextDecoration& operator|=(ETextDecoration& a, ETextDecoration b) { return a = a | b; }
 
-#if ENABLE(CSS3_TEXT)
 enum TextDecorationStyle {
     TextDecorationStyleSolid,
+#if ENABLE(CSS3_TEXT)
     TextDecorationStyleDouble,
     TextDecorationStyleDotted,
     TextDecorationStyleDashed,
     TextDecorationStyleWavy
+#endif // CSS3_TEXT
 };
-#endif // CSS3_TEXT
 
 enum EPageBreak {
     PBAUTO, PBALWAYS, PBAVOID
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to