Bug 136612 - REGRESSION (r172153): Text drawn with wrong color when second text shadow has zero offset and blur (breaks buttons at aws.amazon.com)
Summary: REGRESSION (r172153): Text drawn with wrong color when second text shadow has...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Myles C. Maxfield
URL: data:text/html,<div%20style="color:%2...
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2014-09-07 12:46 PDT by mitz
Modified: 2014-09-15 13:05 PDT (History)
12 users (show)

See Also:


Attachments
Patch (8.88 KB, patch)
2014-09-08 13:04 PDT, Myles C. Maxfield
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2014-09-07 12:46:56 PDT
To reproduce, open the URL. The text is drawn in black, but it should be green.

This was caused by <http://trac.webkit.org/r172153>, the fix for bug 135357.
Comment 1 mitz 2014-09-07 12:47:52 PDT
<rdar://problem/18260645>
Comment 2 Myles C. Maxfield 2014-09-08 13:04:27 PDT
Created attachment 237805 [details]
Patch
Comment 3 Darin Adler 2014-09-08 14:10:50 PDT
Comment on attachment 237805 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=237805&action=review

> Source/WebCore/rendering/TextPainter.cpp:68
>  static bool isEmptyShadow(const ShadowData* shadow)
>  {
>      if (!shadow)
> -        return true;
> +        return false;
>      return shadow->location() == IntPoint() && !shadow->radius();
>  }

I think it’s confusing to change the behavior of this function without changing its name. Maybe it should take a reference and the null check could be at the call site. Or maybe we can just call this a pure bug fix and say that the old behavior was a bug.

> Source/WebCore/rendering/TextPainter.cpp:86
> +        if (isEmptyShadow(shadow)) {
> +            shadow = shadow->next();
> +            continue;
> +        }

Should put this before the definitions of extraOffset and didSaveContext.

> Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:598
> +        bool didSaveContext = false;

You forgot to change the code below to use this boolean! It still says “if (shadow->next())” but should say “if (didSaveContext)”.
Comment 4 Myles C. Maxfield 2014-09-08 19:54:21 PDT
Comment on attachment 237805 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=237805&action=review

>> Source/WebCore/rendering/TextPainter.cpp:68
>>  }
> 
> I think it’s confusing to change the behavior of this function without changing its name. Maybe it should take a reference and the null check could be at the call site. Or maybe we can just call this a pure bug fix and say that the old behavior was a bug.

I think that calling this a pure bug fix is the right way to go.

>> Source/WebCore/rendering/TextPainter.cpp:86
>> +        }
> 
> Should put this before the definitions of extraOffset and didSaveContext.

Done.

>> Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:598
>> +        bool didSaveContext = false;
> 
> You forgot to change the code below to use this boolean! It still says “if (shadow->next())” but should say “if (didSaveContext)”.

Done.
Comment 5 Myles C. Maxfield 2014-09-08 19:56:51 PDT
http://trac.webkit.org/changeset/173418
Comment 6 mitz 2014-09-12 23:23:12 PDT
(In reply to comment #5)
> http://trac.webkit.org/changeset/173418

This change made things worse! Now a single shadow with zero offset and blur makes text vanish entirely:
<div style="color: green; text-shadow: blue 0 0">text</div>
Comment 7 mitz 2014-09-12 23:26:39 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > http://trac.webkit.org/changeset/173418
> 
> This change made things worse! Now a single shadow with zero offset and blur makes text vanish entirely:
> <div style="color: green; text-shadow: blue 0 0">text</div>

Reported that separately as bug 136801. It’s incredible that there isn’t a single regression test for this.
Comment 8 Darin Adler 2014-09-14 12:05:46 PDT
Wow, really embarrassing.

Myles, I won’t be able to think about anything other than this bug if we play Destiny now!
Comment 9 Myles C. Maxfield 2014-09-15 13:05:16 PDT
On it.