Changeset 172153 in webkit


Ignore:
Timestamp:
Aug 6, 2014 10:35:59 AM (10 years ago)
Author:
mmaxfield@apple.com
Message:

Text-shadow with (0, 0) offset and radius = 0 is ugly
https://bugs.webkit.org/show_bug.cgi?id=135357

Reviewed by Darin Adler.

Source/WebCore:

Instead, check for this kind of shadow and don't draw it.

Test: fast/text/empty-shadow.html

  • rendering/TextPainter.cpp:

(WebCore::isEmptyShadow): Does a shadow match these criteria?
(WebCore::paintTextWithShadows): If so, don't draw it.

LayoutTests:

Check that this kind of shadow ends up invisible.

  • fast/text/empty-shadow-expected.html: Added
  • fast/text/empty-shadow.html: Added
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r172150 r172153  
     12014-07-28  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Text-shadow with (0, 0) offset and radius = 0 is ugly
     4        https://bugs.webkit.org/show_bug.cgi?id=135357
     5
     6        Reviewed by Darin Adler.
     7
     8        Check that this kind of shadow ends up invisible.
     9
     10        * fast/text/empty-shadow-expected.html: Added
     11        * fast/text/empty-shadow.html: Added
     12
    1132014-08-06  Mihnea Ovidenie  <mihnea@adobe.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r172151 r172153  
     12014-07-28  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Text-shadow with (0, 0) offset and radius = 0 is ugly
     4        https://bugs.webkit.org/show_bug.cgi?id=135357
     5
     6        Reviewed by Darin Adler.
     7
     8        Instead, check for this kind of shadow and don't draw it.
     9
     10        Test: fast/text/empty-shadow.html
     11
     12        * rendering/TextPainter.cpp:
     13        (WebCore::isEmptyShadow): Does a shadow match these criteria?
     14        (WebCore::paintTextWithShadows): If so, don't draw it.
     15
    1162014-08-06  Andy Estes  <aestes@apple.com>
    217
  • trunk/Source/WebCore/rendering/TextPainter.cpp

    r165607 r172153  
    6161}
    6262
     63static bool isEmptyShadow(const ShadowData* shadowPtr)
     64{
     65    if (!shadowPtr)
     66        return true;
     67    return shadow->location() == IntPoint() && !shadow->radius();
     68}
     69
    6370static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, const AtomicString& emphasisMark,
    6471    int emphasisMarkOffset, int startOffset, int endOffset, int truncationPoint, const FloatPoint& textOrigin, const FloatRect& boxRect,
     
    7380    do {
    7481        IntSize extraOffset;
    75         if (shadow)
     82        bool shadowIsEmpty = isEmptyShadow(shadow);
     83        if (!shadowIsEmpty)
    7684            extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, horizontal));
    7785        else if (!opaque)
     
    92100        if (shadow->next() || stroked || !opaque)
    93101            context->restore();
    94         else
     102        else if (!shadowIsEmpty)
    95103            context->clearShadow();
    96104
Note: See TracChangeset for help on using the changeset viewer.