Bug 138029

Summary: Carets in GMail and iCloud compositions are the foreground text color
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, joepeck, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Myles C. Maxfield 2014-10-23 15:54:09 PDT
Carets in GMail and iCloud compositions are the foreground text color
Comment 1 Myles C. Maxfield 2014-10-23 15:57:25 PDT
Created attachment 240374 [details]
Patch
Comment 2 Myles C. Maxfield 2014-10-23 15:58:28 PDT
<rdar://problem/18755592>
Comment 3 Myles C. Maxfield 2014-10-23 16:03:12 PDT
Comment on attachment 240374 [details]
Patch

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

> Source/WebCore/editing/FrameSelection.cpp:1483
> +    if (!topColor.alpha())

This needs to be topColor.hasAlpha()
Comment 4 Simon Fraser (smfr) 2014-10-23 16:06:14 PDT
Comment on attachment 240374 [details]
Patch

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

> Source/WebCore/editing/FrameSelection.cpp:1477
> +static inline bool layeredColorsAppearSame(Color bottomColor, Color topColor)

Not a huge fan of the name (would prefer something like colorDistinctOverColor() or something),

Can this just call blend() and check if the result == bottomColor?

> Source/WebCore/editing/FrameSelection.cpp:1481
> +    if (bottomColor.red() == topColor.red() && bottomColor.green() == topColor.green() && bottomColor.blue() == topColor.blue())

Would be nice to push this into Color. (colorComponentsEqual or something).

> Source/WebCore/editing/FrameSelection.cpp:1483
> +    if (!topColor.alpha())

hasAlpha? Do you care about how much alpha?
Comment 5 Myles C. Maxfield 2014-10-23 16:16:18 PDT
Created attachment 240375 [details]
Patch
Comment 6 WebKit Commit Bot 2014-10-23 16:49:04 PDT
Comment on attachment 240375 [details]
Patch

Clearing flags on attachment: 240375

Committed r175152: <http://trac.webkit.org/changeset/175152>
Comment 7 WebKit Commit Bot 2014-10-23 16:49:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Joseph Pecoraro 2014-10-23 17:33:33 PDT
Seems iOS builds are complaining:

Source/WebCore/editing/FrameSelection.cpp:1477:20: error: unused function 'disappearsIntoBackground' [-Werror,-Wunused-function]
static inline bool disappearsIntoBackground(Color foreground, Color background)
1 error generated.
Comment 9 Darin Adler 2014-10-23 20:16:31 PDT
Comment on attachment 240375 [details]
Patch

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

> Source/WebCore/editing/FrameSelection.cpp:1480
> +static inline bool disappearsIntoBackground(Color foreground, Color background)
> +{
> +    return background.blend(foreground) == background;
> +}

Needs to be wrapped in #if ENABLE(TEXT_CARET).

Also, is == too strict? Should we have some threshold for close colors?
Comment 10 Simon Fraser (smfr) 2014-10-23 20:23:03 PDT
Build issue was fixed in http://trac.webkit.org/changeset/175155

I mentioned the perceptive matching issue to Myles; he didn't want to get into that rat hole.