Changeset 45956 in webkit


Ignore:
Timestamp:
Jul 15, 2009 4:11:18 PM (15 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Dave Hyatt.

text-shadow is not drawn for text with transparent colour
https://bugs.webkit.org/show_bug.cgi?id=21374

Test: fast/text/shadow-translucent-fill.html

  • rendering/InlineTextBox.cpp: (WebCore::paintTextWithShadows): If the text fill color is not opaque, paint all shadows separately from the text, by casting them from clipped-out opaque text.

LayoutTests:

Reviewed by Dave Hyatt.

text-shadow is not drawn for text with transparent colour
https://bugs.webkit.org/show_bug.cgi?id=21374

  • fast/text/shadow-translucent-fill.html: Added.
  • platform/mac/fast/css/shadow-multiple-expected.checksum:
  • platform/mac/fast/css/shadow-multiple-expected.png:
  • platform/mac/fast/text/shadow-translucent-fill-expected.checksum: Added.
  • platform/mac/fast/text/shadow-translucent-fill-expected.png: Added.
  • platform/mac/fast/text/shadow-translucent-fill-expected.txt: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r45953 r45956  
     12009-07-15  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        text-shadow is not drawn for text with transparent colour
     6        https://bugs.webkit.org/show_bug.cgi?id=21374
     7
     8        * fast/text/shadow-translucent-fill.html: Added.
     9        * platform/mac/fast/css/shadow-multiple-expected.checksum:
     10        * platform/mac/fast/css/shadow-multiple-expected.png:
     11        * platform/mac/fast/text/shadow-translucent-fill-expected.checksum: Added.
     12        * platform/mac/fast/text/shadow-translucent-fill-expected.png: Added.
     13        * platform/mac/fast/text/shadow-translucent-fill-expected.txt: Added.
     14
    1152009-07-15  Chris Marrin  <cmarrin@apple.com>
    216
  • trunk/LayoutTests/platform/mac/fast/css/shadow-multiple-expected.checksum

    r38008 r45956  
    1 76314ae9859ab1094ce038f386121825
     126dc49849b9d75e96b0c8ac74cf0378e
  • trunk/WebCore/ChangeLog

    r45955 r45956  
     12009-07-15  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        text-shadow is not drawn for text with transparent colour
     6        https://bugs.webkit.org/show_bug.cgi?id=21374
     7
     8        Test: fast/text/shadow-translucent-fill.html
     9
     10        * rendering/InlineTextBox.cpp:
     11        (WebCore::paintTextWithShadows): If the text fill color is not opaque,
     12        paint all shadows separately from the text, by casting them from
     13        clipped-out opaque text.
     14
    1152009-07-15  Adam Treat  <adam.treat@torchmobile.com>
    216
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r45624 r45956  
    257257static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, const IntPoint& textOrigin, int x, int y, int w, int h, ShadowData* shadow, bool stroked)
    258258{
     259    Color fillColor = context->fillColor();
     260    bool opaque = fillColor.alpha() == 255;
     261    if (!opaque)
     262        context->setFillColor(Color::black);
     263
    259264    do {
    260265        IntSize extraOffset;
     
    265270            const Color& shadowColor = shadow->color;
    266271
    267             if (shadow->next || stroked) {
     272            if (shadow->next || stroked || !opaque) {
    268273                IntRect shadowRect(x, y, w, h);
    269274                shadowRect.inflate(shadowBlur);
     
    276281            }
    277282            context->setShadow(shadowOffset, shadowBlur, shadowColor);
    278         }
     283        } else if (!opaque)
     284            context->setFillColor(fillColor);
    279285
    280286        if (startOffset <= endOffset)
     
    290296            break;
    291297
    292         if (shadow->next || stroked)
     298        if (shadow->next || stroked || !opaque)
    293299            context->restore();
    294300        else
     
    296302
    297303        shadow = shadow->next;
    298     } while (shadow || stroked);
     304    } while (shadow || stroked || !opaque);
    299305}
    300306
Note: See TracChangeset for help on using the changeset viewer.