Changeset 132076 in webkit
- Timestamp:
- Oct 22, 2012 8:52:23 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r132071 r132076 1 2012-10-22 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 3 [css3-text] Add rendering support for -webkit-text-decoration-style 4 https://bugs.webkit.org/show_bug.cgi?id=94094 5 6 Reviewed by Julien Chaffraix. 7 8 Added paint and repaint layout tests for CSS3 text-decoration-style 9 property. Pixel results are not included due to missing platform support 10 for some decoration styles (handled on bug 93507). These are going 11 to be added when platform support is complete. 12 13 * fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.txt: Added. 14 * fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html: Added. 15 * fast/css3-text/css3-text-decoration/text-decoration-style-expected.txt: Added. 16 * fast/css3-text/css3-text-decoration/text-decoration-style.html: Added. 17 1 18 2012-10-22 Erik Arvidsson <arv@chromium.org> 2 19 -
trunk/Source/WebCore/ChangeLog
r132074 r132076 1 2012-10-22 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 3 [css3-text] Add rendering support for -webkit-text-decoration-style 4 https://bugs.webkit.org/show_bug.cgi?id=94094 5 6 Reviewed by Julien Chaffraix. 7 8 This patch implements the "text-decoration-style" property rendering as 9 specified in CSS3 working draft, with "-webkit-" prefix. The specification can 10 be found here: http://dev.w3.org/csswg/css3-text/#text-decoration-style 11 12 Additionally, Mozilla implementation details can be found here: 13 https://developer.mozilla.org/en/CSS/text-decoration-style 14 15 Tests: fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html 16 fast/css3-text/css3-text-decoration/text-decoration-style.html 17 18 * platform/graphics/GraphicsContext.h: 19 * platform/graphics/cairo/GraphicsContextCairo.cpp: 20 (WebCore::GraphicsContext::setPlatformStrokeStyle): 21 * platform/graphics/cg/GraphicsContextCG.cpp: 22 (WebCore::GraphicsContext::drawLine): 23 * platform/graphics/qt/GraphicsContextQt.cpp: 24 (WebCore::toQPenStyle): 25 (WebCore::GraphicsContext::drawLine): 26 * platform/graphics/skia/PlatformContextSkia.cpp: 27 (WebCore::PlatformContextSkia::setupPaintForStroking): 28 * platform/graphics/wince/GraphicsContextWinCE.cpp: 29 (WebCore::createPen): 30 * platform/graphics/wx/GraphicsContextWx.cpp: 31 (WebCore::strokeStyleToWxPenStyle): 32 Added 'DoubleStroke' and 'WavyStroke' to StrokeStyle enum and updated 33 platform-specific stroke handling. Some styles requires 34 platform-specific implementation (handled in bug 92868). 35 * rendering/InlineTextBox.cpp: 36 (WebCore::InlineTextBox::paint): 37 (WebCore::textDecorationStyleToStrokeStyle): Added static function that 38 translates text decoration to stroke styles. 39 (WebCore::InlineTextBox::paintDecoration): Text decoration style does 40 not specify a property for line thickness (like border-width does for 41 border style), so we statically set it to 1 for now. The 'double' style 42 implementation simply adds a parallel line (depending if it is 43 underline, overline or line-through) and the space between lines follows 44 the approach used by border's 'double' style. 45 * rendering/InlineTextBox.h: 46 (InlineTextBox): 47 * rendering/style/RenderStyle.h: 48 * rendering/style/RenderStyleConstants.h: 49 Added text decoration style rendering support to 50 InlineTextBox::paintDecoration(). 51 1 52 2012-10-22 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 53 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r130636 r132076 138 138 SolidStroke, 139 139 DottedStroke, 140 DashedStroke 140 DashedStroke, 141 #if ENABLE(CSS3_TEXT) 142 DoubleStroke, 143 WavyStroke, 144 #endif // CSS3_TEXT 141 145 }; 142 146 -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r129657 r132076 803 803 break; 804 804 case SolidStroke: 805 #if ENABLE(CSS3_TEXT) 806 case DoubleStroke: 807 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94110 - Needs platform support. 808 #endif // CSS3_TEXT 805 809 cairo_set_dash(platformContext()->cr(), 0, 0, 0); 806 810 break; -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r130565 r132076 426 426 case NoStroke: 427 427 case SolidStroke: 428 #if ENABLE(CSS3_TEXT) 429 case DoubleStroke: 430 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94112 - Needs platform support. 431 #endif // CSS3_TEXT 428 432 break; 429 433 case DottedStroke: -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r131663 r132076 157 157 break; 158 158 case SolidStroke: 159 #if ENABLE(CSS3_TEXT) 160 case DoubleStroke: 161 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support. 162 #endif 159 163 return Qt::SolidLine; 160 164 break; … … 403 407 case NoStroke: 404 408 case SolidStroke: 409 #if ENABLE(CSS3_TEXT) 410 case DoubleStroke: 411 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support. 412 #endif 405 413 break; 406 414 case DottedStroke: { -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r130940 r132076 413 413 case NoStroke: 414 414 case SolidStroke: 415 #if ENABLE(CSS3_TEXT) 416 case DoubleStroke: 417 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93509 - Needs platform support. 418 #endif // CSS3_TEXT 415 419 break; 416 420 case DashedStroke: -
trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
r131577 r132076 355 355 switch (style) { 356 356 case SolidStroke: 357 #if ENABLE(CSS3_TEXT) 358 case DoubleStroke: 359 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94114 - Needs platform support. 360 #endif // CSS3_TEXT 357 361 penStyle = PS_SOLID; 358 362 break; -
trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r124135 r132076 100 100 if (p == DashedStroke) 101 101 return wxLONG_DASH; 102 #if ENABLE(CSS3_TEXT) 103 if (p == DoubleStroke) 104 return wxSOLID; 105 if (p == WavyStroke) // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94111 - Needs platform support. 106 return wxSOLID; 107 #endif // CSS3_TEXT 102 108 if (p == NoStroke) 103 109 return wxTRANSPARENT; -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r131311 r132076 767 767 768 768 // Paint decorations 769 inttextDecorations = styleToUse->textDecorationsInEffect();769 ETextDecoration textDecorations = styleToUse->textDecorationsInEffect(); 770 770 if (textDecorations != TDNONE && paintInfo.phase != PaintPhaseSelection) { 771 771 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); 772 paintDecoration(context, boxOrigin, textDecorations, textShadow);772 paintDecoration(context, boxOrigin, textDecorations, styleToUse->textDecorationStyle(), textShadow); 773 773 } 774 774 … … 926 926 #endif 927 927 928 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, int deco, const ShadowData* shadow) 929 { 928 static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorationStyle) 929 { 930 StrokeStyle strokeStyle = SolidStroke; 931 switch (decorationStyle) { 932 case TextDecorationStyleSolid: 933 strokeStyle = SolidStroke; 934 break; 935 #if ENABLE(CSS3_TEXT) 936 case TextDecorationStyleDouble: 937 strokeStyle = DoubleStroke; 938 break; 939 case TextDecorationStyleDotted: 940 strokeStyle = DottedStroke; 941 break; 942 case TextDecorationStyleDashed: 943 strokeStyle = DashedStroke; 944 break; 945 case TextDecorationStyleWavy: 946 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=92868 - Needs platform support. 947 strokeStyle = WavyStroke; 948 break; 949 #endif // CSS3_TEXT 950 } 951 952 return strokeStyle; 953 } 954 955 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, ETextDecoration deco, TextDecorationStyle decorationStyle, const ShadowData* shadow) 956 { 957 // FIXME: We should improve this rule and not always just assume 1. 958 const float textDecorationThickness = 1.f; 959 930 960 if (m_truncation == cFullTruncation) 931 961 return; … … 948 978 // Use a special function for underlines to get the positioning exactly right. 949 979 bool isPrinting = textRenderer()->document()->printing(); 950 context->setStrokeThickness( 1.0f); // FIXME: We should improve this rule and not always just assume 1.980 context->setStrokeThickness(textDecorationThickness); 951 981 952 982 bool linesAreOpaque = !isPrinting && (!(deco & UNDERLINE) || underline.alpha() == 255) && (!(deco & OVERLINE) || overline.alpha() == 255) && (!(deco & LINE_THROUGH) || linethrough.alpha() == 255); … … 977 1007 ColorSpace colorSpace = renderer()->style()->colorSpace(); 978 1008 bool setShadow = false; 979 1009 980 1010 do { 981 1011 if (shadow) { … … 992 1022 } 993 1023 1024 #if ENABLE(CSS3_TEXT) 1025 // Offset between lines - always non-zero, so lines never cross each other. 1026 float doubleOffset = textDecorationThickness + 1.f; 1027 #endif // CSS3_TEXT 1028 context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle)); 994 1029 if (deco & UNDERLINE) { 995 1030 context->setStrokeColor(underline, colorSpace); 996 context->setStrokeStyle(SolidStroke);997 1031 // Leave one pixel of white between the baseline and the underline. 998 1032 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting); 1033 #if ENABLE(CSS3_TEXT) 1034 if (decorationStyle == TextDecorationStyleDouble) 1035 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1 + doubleOffset), width, isPrinting); 1036 #endif // CSS3_TEXT 999 1037 } 1000 1038 if (deco & OVERLINE) { 1001 1039 context->setStrokeColor(overline, colorSpace); 1002 context->setStrokeStyle(SolidStroke);1003 1040 context->drawLineForText(localOrigin, width, isPrinting); 1041 #if ENABLE(CSS3_TEXT) 1042 if (decorationStyle == TextDecorationStyleDouble) 1043 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() - doubleOffset), width, isPrinting); 1044 #endif // CSS3_TEXT 1004 1045 } 1005 1046 if (deco & LINE_THROUGH) { 1006 1047 context->setStrokeColor(linethrough, colorSpace); 1007 context->setStrokeStyle(SolidStroke);1008 1048 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting); 1049 #if ENABLE(CSS3_TEXT) 1050 if (decorationStyle == TextDecorationStyleDouble) 1051 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting); 1052 #endif // CSS3_TEXT 1009 1053 } 1010 1054 } while (shadow); -
trunk/Source/WebCore/rendering/InlineTextBox.h
r131311 r132076 184 184 185 185 private: 186 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, int decoration, const ShadowData*);186 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, ETextDecoration, TextDecorationStyle, const ShadowData*); 187 187 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor); 188 188 void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r131925 r132076 620 620 #if ENABLE(CSS3_TEXT) 621 621 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); } 622 #else 623 TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; } 622 624 #endif // CSS3_TEXT 623 625 int wordSpacing() const; -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r131925 r132076 337 337 inline ETextDecoration& operator|=(ETextDecoration& a, ETextDecoration b) { return a = a | b; } 338 338 339 #if ENABLE(CSS3_TEXT)340 339 enum TextDecorationStyle { 341 340 TextDecorationStyleSolid, 341 #if ENABLE(CSS3_TEXT) 342 342 TextDecorationStyleDouble, 343 343 TextDecorationStyleDotted, 344 344 TextDecorationStyleDashed, 345 345 TextDecorationStyleWavy 346 };347 346 #endif // CSS3_TEXT 347 }; 348 348 349 349 enum EPageBreak {
Note: See TracChangeset
for help on using the changeset viewer.