REGRESSION (r230064): Focus rings on webpages are fainter than in native UI.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2018 19:56:44 +0000 (19:56 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2018 19:56:44 +0000 (19:56 +0000)
commite22984b8bd7225ce15d4678e3f5954118b013874
tree575ab562d07a84e6566b3ee3ac740dcd0537896c
parent3254f461db593a0a230bfef377d9fe20247080e0
REGRESSION (r230064): Focus rings on webpages are fainter than in native UI.
https://bugs.webkit.org/show_bug.cgi?id=192639
rdar://problem/42669297

Reviewed by Tim Horton.

The focus ring color passed to CoreGraphics is expected to be opaque, since they
will apply opacity when drawing (because opacity is normally animated).
We were getting this by accident before when the old `RenderThemeMac::systemColor()`
used the old `convertNSColorToColor()`, which ignored alpha on NSColor.
Existing tests use fixed test focus ring color.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::colorFromPrimitiveValue const): Use RenderTheme singleton for `focusRingColor()`.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Ditto.
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::drawFocusRingAtTime): Use `CGContextStateSaver`.
* platform/mac/ThemeMac.mm:
(WebCore::drawCellFocusRingWithFrameAtTime): Force alpha to 1 on the focus ring color. Use `CGContextStateSaver`.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintFocusRing): Use RenderTheme singleton for `focusRingColor()`.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintAreaElementFocusRing): Ditto.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::focusRingColor const): Made const. Cache the result of `platformFocusRingColor()`.
* rendering/RenderTheme.h: Made `focusRingColor()` a member function instead of static.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::platformFocusRingColor const): Force alpha to 1 on the focus ring color.
(WebCore::RenderThemeMac::systemColor const): Use `focusRingColor()`, instead of caching color here.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm
Source/WebCore/platform/mac/ThemeMac.mm
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.mm