From 49869426f3e99fc01e904ffd0f4fdd82dab6c111 Mon Sep 17 00:00:00 2001 From: "dino@apple.com" Date: Wed, 24 Sep 2014 19:57:12 +0000 Subject: [PATCH] [Yosemite] Button text doesn't go white while pushing the button, like it does for real buttons https://bugs.webkit.org/show_bug.cgi?id=137054 rdar://problem/17559038 Reviewed by NOBODY (OOPS!). On Yosemite and above, system buttons paint with white-ish text when they are pressed. Since this isn't exposed by API, I've hardcoded the value into RenderThemeMac. The actual state is exposed by adding a :active rule to html.css that uses a new CSSValueKeyword: ActiveButtonText. Unfortunately I can't find a way to test this, because the active state isn't testable. We should really expose the Inspector's forcePseudoState function into window.internals. * css/CSSValueKeywords.in: Add "activebuttontext". * css/html.css: (input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]::-webkit-file-upload-button:active, button:active): New rule for active button elements. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::systemColor): Handle CSSValueActivebuttontext as black. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor): Handle CSSValueActivebuttontext as white with 75% opacity. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173928 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 29 +++++++++++++++++++++++++++++ Source/WebCore/css/CSSValueKeywords.in | 1 + Source/WebCore/css/html.css | 4 ++++ Source/WebCore/rendering/RenderTheme.cpp | 2 ++ Source/WebCore/rendering/RenderThemeMac.mm | 5 +++++ 5 files changed, 41 insertions(+) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 9a13b19..d38fe4c4 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,32 @@ +2014-09-23 Dean Jackson + + [Yosemite] Button text doesn't go white while pushing the button, like it does for real buttons + https://bugs.webkit.org/show_bug.cgi?id=137054 + rdar://problem/17559038 + + Reviewed by Sam Weinig. + + On Yosemite and above, system buttons paint with white-ish text when they + are pressed. Since this isn't exposed by API, I've hardcoded the value + into RenderThemeMac. + + The actual state is exposed by adding a :active rule to html.css that + uses a new CSSValueKeyword: ActiveButtonText. + + Unfortunately I can't find a way to test this, because the active state isn't + testable. We should really expose the Inspector's forcePseudoState function into + window.internals. + + * css/CSSValueKeywords.in: Add "activebuttontext". + * css/html.css: + (input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]::-webkit-file-upload-button:active, button:active): New rule for active + button elements. + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::systemColor): Handle CSSValueActivebuttontext as black. + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::systemColor): Handle CSSValueActivebuttontext as + white with 75% opacity. + 2014-09-24 Christophe Dumez Use is() instead of isSVG*Element() diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index e62724e..1a3cc2d 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -162,6 +162,7 @@ buttonface buttonhighlight buttonshadow buttontext +activebuttontext captiontext graytext highlight diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 88b966b..2feaa92 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -690,6 +690,10 @@ input[type="button"], input[type="submit"], input[type="reset"], input[type="fil box-sizing: border-box } +input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]::-webkit-file-upload-button:active, button:active { + color: ActiveButtonText; +} + input[type="range"] { -webkit-appearance: slider-horizontal; padding: initial; diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index fb5ee5c..63c103c 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -1152,6 +1152,8 @@ Color RenderTheme::systemColor(CSSValueID cssValueId) const return 0xFF888888; case CSSValueButtontext: return 0xFF000000; + case CSSValueActivebuttontext: + return 0xFF000000; case CSSValueCaptiontext: return 0xFF000000; case CSSValueGraytext: diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 0ff05bf..82f101e 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -516,6 +516,11 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueId) const case CSSValueButtontext: color = convertNSColorToColor([NSColor controlTextColor]); break; + case CSSValueActivebuttontext: +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 + color = 0xC0FFFFFF; +#endif + break; case CSSValueCaptiontext: color = convertNSColorToColor([NSColor textColor]); break; -- 1.8.3.1