[Yosemite] Button text doesn't go white while pushing the button, like it does for...
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 19:57:12 +0000 (19:57 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 19:57:12 +0000 (19:57 +0000)
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
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/html.css
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeMac.mm

index 9a13b19..d38fe4c 100644 (file)
@@ -1,3 +1,32 @@
+2014-09-23  Dean Jackson  <dino@apple.com>
+
+        [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  <cdumez@apple.com>
 
         Use is<SVG*Element>() instead of isSVG*Element()
index e62724e..1a3cc2d 100644 (file)
@@ -162,6 +162,7 @@ buttonface
 buttonhighlight
 buttonshadow
 buttontext
+activebuttontext
 captiontext
 graytext
 highlight
index 88b966b..2feaa92 100644 (file)
@@ -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;
index fb5ee5c..63c103c 100644 (file)
@@ -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:
index 0ff05bf..82f101e 100644 (file)
@@ -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;