Title: [173928] trunk/Source/WebCore
Revision
173928
Author
[email protected]
Date
2014-09-24 12:57:12 -0700 (Wed, 24 Sep 2014)

Log Message

[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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173927 => 173928)


--- trunk/Source/WebCore/ChangeLog	2014-09-24 19:52:14 UTC (rev 173927)
+++ trunk/Source/WebCore/ChangeLog	2014-09-24 19:57:12 UTC (rev 173928)
@@ -1,3 +1,32 @@
+2014-09-23  Dean Jackson  <[email protected]>
+
+        [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  <[email protected]>
 
         Use is<SVG*Element>() instead of isSVG*Element()

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (173927 => 173928)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2014-09-24 19:52:14 UTC (rev 173927)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2014-09-24 19:57:12 UTC (rev 173928)
@@ -162,6 +162,7 @@
 buttonhighlight
 buttonshadow
 buttontext
+activebuttontext
 captiontext
 graytext
 highlight

Modified: trunk/Source/WebCore/css/html.css (173927 => 173928)


--- trunk/Source/WebCore/css/html.css	2014-09-24 19:52:14 UTC (rev 173927)
+++ trunk/Source/WebCore/css/html.css	2014-09-24 19:57:12 UTC (rev 173928)
@@ -690,6 +690,10 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (173927 => 173928)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-09-24 19:52:14 UTC (rev 173927)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-09-24 19:57:12 UTC (rev 173928)
@@ -1152,6 +1152,8 @@
         return 0xFF888888;
     case CSSValueButtontext:
         return 0xFF000000;
+    case CSSValueActivebuttontext:
+        return 0xFF000000;
     case CSSValueCaptiontext:
         return 0xFF000000;
     case CSSValueGraytext:

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (173927 => 173928)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-09-24 19:52:14 UTC (rev 173927)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-09-24 19:57:12 UTC (rev 173928)
@@ -516,6 +516,11 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to