Add a new color -apple-wireless-playback-target-active
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 23:48:11 +0000 (23:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 23:48:11 +0000 (23:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146269
<rdar://problem/21465189>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-06-24
Reviewed by Dean Jackson.

Source/WebCore:

At the moment we use -apple-system-blue to indicate an Airplay route is
active. This might not always be blue, so we need to add another system
color with a name that will allow us to change the underlying color.
Initially -apple-wireless-playback-target-active will be an alias to
-apple-system-blue.

Existing tests are modified to include the new color value.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.updateWirelessTargetPickerButton):
* Modules/mediacontrols/mediaControlsiOS.css:
(video::-webkit-media-controls-wireless-playback-picker-button.playing):
Use the new color value in the media controls.

* css/CSSParser.cpp:
(WebCore::isAppleLegacyCssValueKeyword): Returns true if the value keyword
has an '-apple' prefix which has to be replaced by '-webkit'

(WebCore::cssValueKeywordID): Call a new function which handles all the
'-apple' legacy keywords.

* css/CSSValueKeywords.in: Define the new color keyword.

* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemColor):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::systemColor):
Define the value of the new color keyword to be an alias of systemBlueColor.

LayoutTests:

Modify existing tests to include the new color value.

* fast/css/apple-system-colors-expected.txt:
* fast/css/apple-system-colors.html:
* platform/ios-simulator/fast/css/apple-system-colors-expected.txt:
* platform/mac-mavericks/fast/css/apple-system-colors-expected.txt:
* platform/mac/fast/css/apple-system-colors-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/apple-system-colors-expected.txt
LayoutTests/fast/css/apple-system-colors.html
LayoutTests/platform/ios-simulator/fast/css/apple-system-colors-expected.txt
LayoutTests/platform/mac-mavericks/fast/css/apple-system-colors-expected.txt
LayoutTests/platform/mac/fast/css/apple-system-colors-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm

index 7153eef..ddea8d2 100644 (file)
@@ -1,3 +1,19 @@
+2015-06-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add a new color -apple-wireless-playback-target-active
+        https://bugs.webkit.org/show_bug.cgi?id=146269
+        <rdar://problem/21465189>
+
+        Reviewed by Dean Jackson.
+
+        Modify existing tests to include the new color value.
+
+        * fast/css/apple-system-colors-expected.txt:
+        * fast/css/apple-system-colors.html:
+        * platform/ios-simulator/fast/css/apple-system-colors-expected.txt:
+        * platform/mac-mavericks/fast/css/apple-system-colors-expected.txt:
+        * platform/mac/fast/css/apple-system-colors-expected.txt:
+
 2015-06-24  Doug Russell  <d_russell@apple.com>
 
         Bug 146177 - AX: AXObjectCache should try to use an unignored accessibilityObject
index e1f1a88..3390728 100644 (file)
@@ -7,4 +7,5 @@
 -apple-system-purple : rgba(0, 0, 0, 0)
 -apple-system-red : rgba(0, 0, 0, 0)
 -apple-system-yellow : rgba(0, 0, 0, 0)
+-apple-wireless-playback-target-active : rgba(0, 0, 0, 0)
 current-color with inherited -apple-system-blue : rgba(0, 0, 0, 0)
index bc2a461..a7027e3 100644 (file)
@@ -30,4 +30,5 @@ function run() {
 <div><span class="swatch" style="background-color: -apple-system-purple"></span>-apple-system-purple</div>
 <div><span class="swatch" style="background-color: -apple-system-red"></span>-apple-system-red</div>
 <div><span class="swatch" style="background-color: -apple-system-yellow"></span>-apple-system-yellow</div>
+<div><span class="swatch" style="background-color: -apple-wireless-playback-target-active"></span>-apple-wireless-playback-target-active</div>
 <div style="color: -apple-system-blue"><span class="swatch" style="background-color: currentcolor;"></span>current-color with inherited -apple-system-blue</div>
\ No newline at end of file
index f6d931a..eeb728b 100644 (file)
@@ -7,4 +7,5 @@
 -apple-system-purple : rgba(0, 0, 0, 0)
 -apple-system-red : rgb(255, 59, 48)
 -apple-system-yellow : rgb(255, 204, 0)
+-apple-wireless-playback-target-active : rgb(0, 122, 255)
 current-color with inherited -apple-system-blue : rgb(0, 122, 255)
index e1f1a88..3390728 100644 (file)
@@ -7,4 +7,5 @@
 -apple-system-purple : rgba(0, 0, 0, 0)
 -apple-system-red : rgba(0, 0, 0, 0)
 -apple-system-yellow : rgba(0, 0, 0, 0)
+-apple-wireless-playback-target-active : rgba(0, 0, 0, 0)
 current-color with inherited -apple-system-blue : rgba(0, 0, 0, 0)
index 8a67b19..8a67d59 100644 (file)
@@ -7,4 +7,5 @@
 -apple-system-purple : rgb(204, 115, 225)
 -apple-system-red : rgb(255, 59, 48)
 -apple-system-yellow : rgb(255, 204, 0)
+-apple-wireless-playback-target-active : rgb(27, 173, 248)
 current-color with inherited -apple-system-blue : rgb(27, 173, 248)
index 343d67c..3897b24 100644 (file)
@@ -1,3 +1,40 @@
+2015-06-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add a new color -apple-wireless-playback-target-active
+        https://bugs.webkit.org/show_bug.cgi?id=146269
+        <rdar://problem/21465189>
+
+        Reviewed by Dean Jackson.
+
+        At the moment we use -apple-system-blue to indicate an Airplay route is
+        active. This might not always be blue, so we need to add another system
+        color with a name that will allow us to change the underlying color.
+        Initially -apple-wireless-playback-target-active will be an alias to
+        -apple-system-blue.
+
+        Existing tests are modified to include the new color value.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.updateWirelessTargetPickerButton):
+        * Modules/mediacontrols/mediaControlsiOS.css:
+        (video::-webkit-media-controls-wireless-playback-picker-button.playing):
+        Use the new color value in the media controls.
+        
+        * css/CSSParser.cpp:
+        (WebCore::isAppleLegacyCssValueKeyword): Returns true if the value keyword
+        has an '-apple' prefix which has to be replaced by '-webkit'
+        
+        (WebCore::cssValueKeywordID): Call a new function which handles all the
+        '-apple' legacy keywords.
+        
+        * css/CSSValueKeywords.in: Define the new color keyword.
+        
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::systemColor):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::systemColor):
+        Define the value of the new color keyword to be an alias of systemBlueColor.
+
 2015-06-24  Matt Rajca  <mrajca@apple.com>
 
         MediaSession: propagate MediaSessionMetadata to WebPageProxy
index aa5de80..4eb0399 100644 (file)
@@ -1043,7 +1043,7 @@ Controller.prototype = {
     updateWirelessTargetPickerButton: function() {
         var wirelessTargetPickerColor;
         if (this.controls.wirelessTargetPicker.classList.contains('playing'))
-            wirelessTargetPickerColor = "-apple-system-blue";
+            wirelessTargetPickerColor = "-apple-wireless-playback-target-active";
         else
             wirelessTargetPickerColor = "rgba(255,255,255,0.45)";
         if (window.devicePixelRatio == 2)
index eb1714d..9bae36c 100644 (file)
@@ -317,7 +317,7 @@ audio::-webkit-media-controls-wireless-playback-picker-button.playing,
 video::-webkit-media-controls-wireless-playback-picker-button.playing {
     opacity: 1;
     mix-blend-mode: normal;
-    background-color: -apple-system-blue;
+    background-color: -apple-wireless-playback-target-active;
 }
 
 /* ================== PICTURE IN PICTURE BUTTON ====================== */
index d8dbdff..5e8f05c 100644 (file)
@@ -12831,6 +12831,17 @@ void cssPropertyNameIOSAliasing(const char* propertyName, const char*& propertyN
 }
 #endif
 
+static bool isAppleLegacyCssValueKeyword(const char* valueKeyword, unsigned length)
+{
+    static const char* applePrefix = "-apple-";
+    static const char* appleSystemPrefix = "-apple-system";
+    static const char* appleWirelessPlaybackTargetActive = getValueName(CSSValueAppleWirelessPlaybackTargetActive);
+
+    return hasPrefix(valueKeyword, length, applePrefix)
+        && !hasPrefix(valueKeyword, length, appleSystemPrefix)
+        && !WTF::equal(reinterpret_cast<const LChar*>(valueKeyword), reinterpret_cast<const LChar*>(appleWirelessPlaybackTargetActive), length);
+}
+
 template <typename CharacterType>
 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length)
 {
@@ -12849,7 +12860,7 @@ static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned
         // This makes the string one character longer.
         // On iOS we don't want to change values starting with -apple-system to -webkit-system.
         // FIXME: Remove this mangling without breaking the web.
-        if ((hasPrefix(buffer, length, "-apple-") && !hasPrefix(buffer, length, "-apple-system")) || hasPrefix(buffer, length, "-khtml-")) {
+        if (isAppleLegacyCssValueKeyword(buffer, length) || hasPrefix(buffer, length, "-khtml-")) {
             memmove(buffer + 7, buffer + 6, length + 1 - 6);
             memcpy(buffer, "-webkit", 7);
             ++length;
index 931aabd..620c7e2 100644 (file)
@@ -186,6 +186,7 @@ threedshadow
 window
 windowframe
 windowtext
+-apple-wireless-playback-target-active
 -apple-system-blue
 -apple-system-brown
 -apple-system-gray
index c9c8f38..5448f63 100644 (file)
@@ -1318,6 +1318,9 @@ Color RenderThemeIOS::systemColor(CSSValueID cssValueID) const
 
     Color color;
     switch (cssValueID) {
+    case CSSValueAppleWirelessPlaybackTargetActive:
+        color = [getUIColorClass() systemBlueColor].CGColor;
+        break;
     case CSSValueAppleSystemBlue:
         color = [getUIColorClass() systemBlueColor].CGColor;
         break;
index 4a7ccb2..9b729a9 100644 (file)
@@ -576,6 +576,9 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID) const
         color = convertNSColorToColor([NSColor windowFrameTextColor]);
         break;
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    case CSSValueAppleWirelessPlaybackTargetActive:
+        color = convertNSColorToColor([NSColor systemBlueColor]);
+        break;
     case CSSValueAppleSystemBlue:
         color = convertNSColorToColor([NSColor systemBlueColor]);
         break;