Diff
Modified: trunk/LayoutTests/ChangeLog (183609 => 183610)
--- trunk/LayoutTests/ChangeLog 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/LayoutTests/ChangeLog 2015-04-30 03:15:23 UTC (rev 183610)
@@ -1,3 +1,32 @@
+2015-04-29 Dean Jackson <[email protected]>
+
+ Create a named CSS property for system colors
+ https://bugs.webkit.org/show_bug.cgi?id=144423
+ <rdar://problem/20491011>
+
+ Reviewed by Tim Horton.
+
+ Expose the following values to CSS color properties:
+ -apple-system-blue
+ -apple-system-brown
+ -apple-system-gray
+ -apple-system-green
+ -apple-system-orange
+ -apple-system-pink
+ -apple-system-purple
+ -apple-system-red
+ -apple-system-yellow
+
+ The new test shows the computed value for each of these colors. It
+ includes generic results (no special value) and platform results for
+ Mac (other than Mavericks) and iOS.
+
+ * fast/css/apple-system-colors-expected.txt: Generic results.
+ * fast/css/apple-system-colors.html: Added - the new test.
+ * platform/mac/fast/css/apple-system-colors-expected.txt: Added OS X results.
+ * platform/ios-simulator/fast/css/apple-system-colors-expected.txt: Added iOS results.
+ * platform/mac-mavericks/fast/css/apple-system-colors-expected.txt: Generic results for Mavericks.
+
2015-04-29 Commit Queue <[email protected]>
Unreviewed, rolling out r183600.
Added: trunk/LayoutTests/fast/css/apple-system-colors-expected.txt (0 => 183610)
--- trunk/LayoutTests/fast/css/apple-system-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/apple-system-colors-expected.txt 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,10 @@
+-apple-system-blue : rgba(0, 0, 0, 0)
+-apple-system-brown : rgba(0, 0, 0, 0)
+-apple-system-gray : rgba(0, 0, 0, 0)
+-apple-system-green : rgba(0, 0, 0, 0)
+-apple-system-orange : rgba(0, 0, 0, 0)
+-apple-system-pink : rgba(0, 0, 0, 0)
+-apple-system-purple : rgba(0, 0, 0, 0)
+-apple-system-red : rgba(0, 0, 0, 0)
+-apple-system-yellow : rgba(0, 0, 0, 0)
+current-color with inherited -apple-system-blue : rgba(0, 0, 0, 0)
Property changes on: trunk/LayoutTests/fast/css/apple-system-colors-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/css/apple-system-colors.html (0 => 183610)
--- trunk/LayoutTests/fast/css/apple-system-colors.html (rev 0)
+++ trunk/LayoutTests/fast/css/apple-system-colors.html 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,33 @@
+<script>
+
+if (window.testRunner)
+ window.testRunner.dumpAsText();
+
+window.addEventListener("load", run, false);
+
+function run() {
+ var divs = document.querySelectorAll("div");
+ for (var i = 0; i < divs.length; i++) {
+ var div = divs[i];
+ var span = div.querySelector("span");
+ div.innerHTML += " : " + window.getComputedStyle(span).backgroundColor;
+ }
+}
+</script>
+<style>
+.swatch {
+ display: inline-block;
+ width: 40px;
+ height: 40px;
+}
+</style>
+<div><span class="swatch" style="background-color: -apple-system-blue"></span>-apple-system-blue</div>
+<div><span class="swatch" style="background-color: -apple-system-brown"></span>-apple-system-brown</div>
+<div><span class="swatch" style="background-color: -apple-system-gray"></span>-apple-system-gray</div>
+<div><span class="swatch" style="background-color: -apple-system-green"></span>-apple-system-green</div>
+<div><span class="swatch" style="background-color: -apple-system-orange"></span>-apple-system-orange</div>
+<div><span class="swatch" style="background-color: -apple-system-pink"></span>-apple-system-pink</div>
+<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 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
Property changes on: trunk/LayoutTests/fast/css/apple-system-colors.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/platform/ios-simulator/fast/css/apple-system-colors-expected.txt (0 => 183610)
--- trunk/LayoutTests/platform/ios-simulator/fast/css/apple-system-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/css/apple-system-colors-expected.txt 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,10 @@
+-apple-system-blue : rgb(0, 122, 255)
+-apple-system-brown : rgba(0, 0, 0, 0)
+-apple-system-gray : rgb(142, 142, 147)
+-apple-system-green : rgb(76, 217, 100)
+-apple-system-orange : rgb(255, 149, 0)
+-apple-system-pink : rgb(255, 45, 85)
+-apple-system-purple : rgba(0, 0, 0, 0)
+-apple-system-red : rgb(255, 59, 48)
+-apple-system-yellow : rgb(255, 204, 0)
+current-color with inherited -apple-system-blue : rgb(0, 122, 255)
Property changes on: trunk/LayoutTests/platform/ios-simulator/fast/css/apple-system-colors-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/platform/mac/fast/css/apple-system-colors-expected.txt (0 => 183610)
--- trunk/LayoutTests/platform/mac/fast/css/apple-system-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css/apple-system-colors-expected.txt 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,10 @@
+-apple-system-blue : rgb(27, 173, 248)
+-apple-system-brown : rgb(162, 132, 94)
+-apple-system-gray : rgb(142, 142, 145)
+-apple-system-green : rgb(99, 218, 56)
+-apple-system-orange : rgb(255, 149, 0)
+-apple-system-pink : rgb(255, 41, 104)
+-apple-system-purple : rgb(204, 115, 225)
+-apple-system-red : rgb(255, 59, 48)
+-apple-system-yellow : rgb(255, 204, 0)
+current-color with inherited -apple-system-blue : rgb(27, 173, 248)
Property changes on: trunk/LayoutTests/platform/mac/fast/css/apple-system-colors-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/platform/mac-mavericks/fast/css/apple-system-colors-expected.txt (0 => 183610)
--- trunk/LayoutTests/platform/mac-mavericks/fast/css/apple-system-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/fast/css/apple-system-colors-expected.txt 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,10 @@
+-apple-system-blue : rgba(0, 0, 0, 0)
+-apple-system-brown : rgba(0, 0, 0, 0)
+-apple-system-gray : rgba(0, 0, 0, 0)
+-apple-system-green : rgba(0, 0, 0, 0)
+-apple-system-orange : rgba(0, 0, 0, 0)
+-apple-system-pink : rgba(0, 0, 0, 0)
+-apple-system-purple : rgba(0, 0, 0, 0)
+-apple-system-red : rgba(0, 0, 0, 0)
+-apple-system-yellow : rgba(0, 0, 0, 0)
+current-color with inherited -apple-system-blue : rgba(0, 0, 0, 0)
Property changes on: trunk/LayoutTests/platform/mac-mavericks/fast/css/apple-system-colors-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (183609 => 183610)
--- trunk/Source/WebCore/ChangeLog 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/ChangeLog 2015-04-30 03:15:23 UTC (rev 183610)
@@ -1,3 +1,61 @@
+2015-04-29 Dean Jackson <[email protected]>
+
+ Create a named CSS property for system colors
+ https://bugs.webkit.org/show_bug.cgi?id=144423
+ <rdar://problem/20491011>
+
+ Reviewed by Tim Horton.
+
+ Test: fast/css/apple-system-colors.html
+
+ Expose the following values to CSS color properties:
+ -apple-system-blue
+ -apple-system-brown
+ -apple-system-gray
+ -apple-system-green
+ -apple-system-orange
+ -apple-system-pink
+ -apple-system-purple
+ -apple-system-red
+ -apple-system-yellow
+
+ On platforms other than OS X Yosemite and iOS, the
+ actual color values are undefined and become transparent
+ black. (In fact, not all are defined on iOS either.)
+
+ * WebCore.xcodeproj/project.pbxproj: Two new SPI header files.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::validSystemColorValue): New helper function that
+ checks if a CSSValueID is between the two system color values. This
+ was being tested everywhere, which meant adding a new system color was
+ at risk of being ignored. It's a static method so it can be used
+ from the SVG CSS parser too.
+ (WebCore::validPrimitiveValueColor): Use the new helper.
+ (WebCore::CSSParser::parseValue): Ditto.
+ (WebCore::CSSParser::parseBackgroundColor): Ditto.
+ (WebCore::CSSParser::parseShadow): Ditto.
+ (WebCore::parseDeprecatedGradientColorStop): Ditto.
+ (WebCore::parseGradientColorOrKeyword): Ditto.
+ * css/CSSParser.h: New static helper function.
+
+ * css/CSSValueKeywords.in: Add the new CSS value keywords.
+
+ * css/SVGCSSParser.cpp:
+ (WebCore::validSystemControlColorValue): SVG has a restricted
+ set of system colors, so use the helper from CSSParser but with
+ an extra condition.
+ (WebCore::CSSParser::parseSVGValue): Use the helper.
+
+ * platform/spi/ios/UIColorSPI.h: Added.
+ * platform/spi/cocoa/NSColorSPI.h: Added.
+
+ * rendering/RenderThemeIOS.h: New systemColor override. Also add a cache for system colors.
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::systemColor): Ask UIColor to provide the color values for the new CSS values.
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::systemColor): Ditto.
+
2015-04-29 Commit Queue <[email protected]>
Unreviewed, rolling out r183600.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (183609 => 183610)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-04-30 03:15:23 UTC (rev 183610)
@@ -1307,6 +1307,8 @@
31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; };
31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D591B116697A6C00E6BF02 /* PlugInClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
31DCD29D1AB4FBDE0072E817 /* AnimationTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 31DF63571AF187DD0078FD91 /* NSColorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DF63561AF187DD0078FD91 /* NSColorSPI.h */; };
+ 31DF63591AF194F00078FD91 /* UIColorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DF63581AF194F00078FD91 /* UIColorSPI.h */; };
31EAF97E121435A400E7C1BF /* DeviceMotionClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31EAF97C121435A400E7C1BF /* DeviceMotionClientIOS.h */; };
31EAF97F121435A400E7C1BF /* DeviceMotionClientIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31EAF97D121435A400E7C1BF /* DeviceMotionClientIOS.mm */; };
31EC1E2814FF60EE00C94662 /* JSNotificationPermissionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31EC1E2614FF60EE00C94662 /* JSNotificationPermissionCallback.cpp */; };
@@ -8447,6 +8449,8 @@
31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; };
31D591B116697A6C00E6BF02 /* PlugInClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInClient.h; sourceTree = "<group>"; };
31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationTrigger.h; path = animation/AnimationTrigger.h; sourceTree = "<group>"; };
+ 31DF63561AF187DD0078FD91 /* NSColorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSColorSPI.h; sourceTree = "<group>"; };
+ 31DF63581AF194F00078FD91 /* UIColorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIColorSPI.h; path = ios/UIColorSPI.h; sourceTree = "<group>"; };
31E8D8BA160BC94B004CE8F5 /* RenderSnapshottedPlugIn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSnapshottedPlugIn.cpp; sourceTree = "<group>"; };
31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSnapshottedPlugIn.h; sourceTree = "<group>"; };
31EAF97C121435A400E7C1BF /* DeviceMotionClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceMotionClientIOS.h; path = ios/DeviceMotionClientIOS.h; sourceTree = "<group>"; };
@@ -16534,6 +16538,7 @@
CE12524E1A1A78D200864480 /* MachVMSPI.h */,
A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */,
CE1252501A1BEBD800864480 /* NSCalendarDateSPI.h */,
+ 31DF63561AF187DD0078FD91 /* NSColorSPI.h */,
2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */,
CE12523A1A16711000864480 /* NSFileManagerSPI.h */,
CE1252461A16C2C200864480 /* NSPointerFunctionsSPI.h */,
@@ -18808,6 +18813,7 @@
CE1252481A16C3BC00864480 /* MobileGestaltSPI.h */,
6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */,
CE1252381A166FA000864480 /* QuickLookSPI.h */,
+ 31DF63581AF194F00078FD91 /* UIColorSPI.h */,
);
name = ios;
sourceTree = "<group>";
@@ -24155,6 +24161,7 @@
CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */,
4A0FFAA21AAF5EA20062803B /* RealtimeMediaSourceCenter.h in Headers */,
4162A451101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h in Headers */,
+ 31DF63571AF187DD0078FD91 /* NSColorSPI.h in Headers */,
41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */,
FD06DFA6134A4DEF006F5D7D /* DefaultAudioDestinationNode.h in Headers */,
FD31602C12B0267600C1A359 /* DelayDSPKernel.h in Headers */,
@@ -26585,6 +26592,7 @@
088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */,
088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */,
+ 31DF63591AF194F00078FD91 /* UIColorSPI.h in Headers */,
088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */,
08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */,
08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */,
Modified: trunk/Source/WebCore/css/CSSParser.cpp (183609 => 183610)
--- trunk/Source/WebCore/css/CSSParser.cpp 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2015-04-30 03:15:23 UTC (rev 183610)
@@ -514,10 +514,15 @@
}
}
+bool CSSParser::isValidSystemColorValue(CSSValueID valueID)
+{
+ return valueID >= CSSValueAqua && valueID <= CSSValueAppleSystemYellow;
+}
+
static bool validPrimitiveValueColor(CSSValueID valueID, bool strict = false)
{
return (valueID == CSSValueWebkitText || valueID == CSSValueCurrentcolor || valueID == CSSValueMenu
- || (valueID >= CSSValueAlpha && valueID <= CSSValueWindowtext)
+ || CSSParser::isValidSystemColorValue(valueID) || valueID == CSSValueAlpha
|| (valueID >= CSSValueWebkitFocusRingColor && valueID < CSSValueWebkitText && !strict));
}
@@ -2038,8 +2043,8 @@
// since we use this in our UA sheets.
else if (id == CSSValueCurrentcolor)
validPrimitive = true;
- else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu ||
- (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && inQuirksMode())) {
+ else if (isValidSystemColorValue(id) || id == CSSValueMenu
+ || (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && inQuirksMode())) {
validPrimitive = true;
} else {
parsedValue = parseColor();
@@ -2879,7 +2884,7 @@
#endif
#if ENABLE(TOUCH_EVENTS)
case CSSPropertyWebkitTapHighlightColor:
- if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu
+ if (isValidSystemColorValue(id) || id == CSSValueMenu
|| (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && inQuirksMode())) {
validPrimitive = true;
} else {
@@ -4130,8 +4135,8 @@
PassRefPtr<CSSValue> CSSParser::parseBackgroundColor()
{
CSSValueID id = m_valueList->current()->id;
- if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || id == CSSValueCurrentcolor ||
- (id >= CSSValueGrey && id < CSSValueWebkitText && inQuirksMode()))
+ if (id == CSSValueWebkitText || isValidSystemColorValue(id) || id == CSSValueMenu || id == CSSValueCurrentcolor
+ || (id >= CSSValueGrey && id < CSSValueWebkitText && inQuirksMode()))
return cssValuePool().createIdentifierValue(id);
return parseColor();
}
@@ -7624,7 +7629,7 @@
} else {
// The only other type of value that's ok is a color value.
RefPtr<CSSPrimitiveValue> parsedColor;
- bool isColor = ((value->id >= CSSValueAqua && value->id <= CSSValueWindowtext) || value->id == CSSValueMenu
+ bool isColor = (isValidSystemColorValue(value->id) || value->id == CSSValueMenu
|| (value->id >= CSSValueWebkitFocusRingColor && value->id <= CSSValueWebkitText && inQuirksMode())
|| value->id == CSSValueCurrentcolor);
if (isColor) {
@@ -8385,7 +8390,7 @@
stop.m_position = cssValuePool().createValue(1, CSSPrimitiveValue::CSS_NUMBER);
CSSValueID id = args->current()->id;
- if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu)
+ if (id == CSSValueWebkitText || CSSParser::isValidSystemColorValue(id) || id == CSSValueMenu)
stop.m_color = cssValuePool().createIdentifierValue(id);
else
stop.m_color = parser.parseColor(args->current());
@@ -8412,7 +8417,7 @@
stopArg = args->next();
CSSValueID id = stopArg->id;
- if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu)
+ if (id == CSSValueWebkitText || CSSParser::isValidSystemColorValue(id) || id == CSSValueMenu)
stop.m_color = cssValuePool().createIdentifierValue(id);
else
stop.m_color = parser.parseColor(stopArg);
@@ -8583,7 +8588,7 @@
static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(CSSParser& parser, CSSParserValue& value)
{
CSSValueID id = value.id;
- if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || id == CSSValueCurrentcolor)
+ if (id == CSSValueWebkitText || CSSParser::isValidSystemColorValue(id) || id == CSSValueMenu || id == CSSValueCurrentcolor)
return cssValuePool().createIdentifierValue(id);
return parser.parseColor(&value);
Modified: trunk/Source/WebCore/css/CSSParser.h (183609 => 183610)
--- trunk/Source/WebCore/css/CSSParser.h 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/css/CSSParser.h 2015-04-30 03:15:23 UTC (rev 183610)
@@ -121,6 +121,7 @@
static ParseResult parseValue(MutableStyleProperties*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*);
static bool parseColor(RGBA32& color, const String&, bool strict = false);
+ static bool isValidSystemColorValue(CSSValueID);
static bool parseSystemColor(RGBA32& color, const String&, Document*);
static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, ValueWithCalculation&);
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (183609 => 183610)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2015-04-30 03:15:23 UTC (rev 183610)
@@ -186,6 +186,15 @@
window
windowframe
windowtext
+-apple-system-blue
+-apple-system-brown
+-apple-system-gray
+-apple-system-green
+-apple-system-orange
+-apple-system-pink
+-apple-system-purple
+-apple-system-red
+-apple-system-yellow
-webkit-focus-ring-color
currentcolor
//
Modified: trunk/Source/WebCore/css/SVGCSSParser.cpp (183609 => 183610)
--- trunk/Source/WebCore/css/SVGCSSParser.cpp 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/css/SVGCSSParser.cpp 2015-04-30 03:15:23 UTC (rev 183610)
@@ -33,6 +33,11 @@
namespace WebCore {
+static bool isValidSystemControlColorValue(CSSValueID id)
+{
+ return id >= CSSValueActiveborder && CSSParser::isValidSystemColorValue(id);
+}
+
bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
{
if (!m_valueList->current())
@@ -187,7 +192,7 @@
parsedValue = SVGPaint::createNone();
else if (id == CSSValueCurrentcolor)
parsedValue = SVGPaint::createCurrentColor();
- else if ((id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSSValueMenu)
+ else if (isValidSystemControlColorValue(id) || id == CSSValueMenu)
parsedValue = SVGPaint::createColor(RenderTheme::defaultTheme()->systemColor(id));
else if (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_URI) {
RGBA32 c = Color::transparent;
@@ -210,8 +215,8 @@
case CSSPropertyStopColor: // TODO : icccolor
case CSSPropertyFloodColor:
case CSSPropertyLightingColor:
- if ((id >= CSSValueAqua && id <= CSSValueWindowtext) ||
- (id >= CSSValueAliceblue && id <= CSSValueYellowgreen))
+ if (CSSParser::isValidSystemColorValue(id)
+ || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen))
parsedValue = SVGColor::createFromString(valueWithCalculation.value().string);
else if (id == CSSValueCurrentcolor)
parsedValue = SVGColor::createCurrentColor();
Added: trunk/Source/WebCore/platform/spi/cocoa/NSColorSPI.h (0 => 183610)
--- trunk/Source/WebCore/platform/spi/cocoa/NSColorSPI.h (rev 0)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSColorSPI.h 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <AppKit/NSColor.h>
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+
+#if PLATFORM(MAC) && USE(APPLE_INTERNAL_SDK)
+
+#import <AppKit/NSColor_Private.h>
+
+#else
+
+@interface NSColor (Details)
++ (NSColor *)systemRedColor;
++ (NSColor *)systemGreenColor;
++ (NSColor *)systemBlueColor;
++ (NSColor *)systemOrangeColor;
++ (NSColor *)systemYellowColor;
++ (NSColor *)systemBrownColor;
++ (NSColor *)systemPinkColor;
++ (NSColor *)systemPurpleColor;
++ (NSColor *)systemGrayColor;
+@end
+
+#endif
+
+#endif
Property changes on: trunk/Source/WebCore/platform/spi/cocoa/NSColorSPI.h
___________________________________________________________________
Added: svn:keywords
Added: svn:eol-style
Added: trunk/Source/WebCore/platform/spi/ios/UIColorSPI.h (0 => 183610)
--- trunk/Source/WebCore/platform/spi/ios/UIColorSPI.h (rev 0)
+++ trunk/Source/WebCore/platform/spi/ios/UIColorSPI.h 2015-04-30 03:15:23 UTC (rev 183610)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <UIKit/UIInterface_Private.h>
+
+#else
+
+#import <UIKit/UIColor.h>
+
+@interface UIColor (Details)
+
++ (UIColor *)systemBlueColor;
++ (UIColor *)systemGrayColor;
++ (UIColor *)systemGreenColor;
++ (UIColor *)systemOrangeColor;
++ (UIColor *)systemPinkColor;
++ (UIColor *)systemRedColor;
++ (UIColor *)systemYellowColor;
+
+@end
+
+#endif
Property changes on: trunk/Source/WebCore/platform/spi/ios/UIColorSPI.h
___________________________________________________________________
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (183609 => 183610)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2015-04-30 03:15:23 UTC (rev 183610)
@@ -111,6 +111,8 @@
virtual String mediaControlsScript() override;
#endif
+ virtual Color systemColor(CSSValueID) const override;
+
private:
RenderThemeIOS();
virtual ~RenderThemeIOS() { }
@@ -120,6 +122,8 @@
String m_mediaControlsScript;
String m_mediaControlsStyleSheet;
+
+ mutable HashMap<int, RGBA32> m_systemColorCache;
};
}
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (183609 => 183610)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2015-04-30 03:15:23 UTC (rev 183610)
@@ -56,6 +56,7 @@
#import "RenderThemeIOS.h"
#import "RenderView.h"
#import "SoftLinking.h"
+#import "UIColorSPI.h"
#import "UserAgentScripts.h"
#import "UserAgentStyleSheets.h"
#import "WebCoreThreadRun.h"
@@ -65,16 +66,19 @@
#import <wtf/RefPtr.h>
#import <wtf/StdLibExtras.h>
-@interface UIApplication
-+ (UIApplication *)sharedApplication;
-@property(nonatomic,copy) NSString *preferredContentSizeCategory;
-@end
-
SOFT_LINK_FRAMEWORK(UIKit)
SOFT_LINK_CLASS(UIKit, UIApplication)
+SOFT_LINK_CLASS(UIKit, UIColor)
SOFT_LINK_CONSTANT(UIKit, UIContentSizeCategoryDidChangeNotification, CFStringRef)
#define UIContentSizeCategoryDidChangeNotification getUIContentSizeCategoryDidChangeNotification()
+#if !USE(APPLE_INTERNAL_SDK)
+@interface UIApplication
++ (UIApplication *)sharedApplication;
+@property (nonatomic, copy) NSString *preferredContentSizeCategory;
+@end
+#endif
+
@interface WebCoreRenderThemeBundle : NSObject
@end
@@ -1307,6 +1311,50 @@
}
#endif // ENABLE(VIDEO)
+Color RenderThemeIOS::systemColor(CSSValueID cssValueId) const
+{
+ {
+ auto it = m_systemColorCache.find(cssValueId);
+ if (it != m_systemColorCache.end())
+ return it->value;
+ }
+
+ Color color;
+ switch (cssValueId) {
+ case CSSValueAppleSystemBlue:
+ color = [getUIColorClass() systemBlueColor].CGColor;
+ break;
+ case CSSValueAppleSystemGray:
+ color = [getUIColorClass() systemGrayColor].CGColor;
+ break;
+ case CSSValueAppleSystemGreen:
+ color = [getUIColorClass() systemGreenColor].CGColor;
+ break;
+ case CSSValueAppleSystemOrange:
+ color = [getUIColorClass() systemOrangeColor].CGColor;
+ break;
+ case CSSValueAppleSystemPink:
+ color = [getUIColorClass() systemPinkColor].CGColor;
+ break;
+ case CSSValueAppleSystemRed:
+ color = [getUIColorClass() systemRedColor].CGColor;
+ break;
+ case CSSValueAppleSystemYellow:
+ color = [getUIColorClass() systemYellowColor].CGColor;
+ break;
+ default:
+ break;
+ }
+
+ if (!color.isValid())
+ color = RenderTheme::systemColor(cssValueId);
+
+ if (color.isValid())
+ m_systemColorCache.set(cssValueId, color.rgb());
+
+ return color;
}
+}
+
#endif //PLATFORM(IOS)
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (183609 => 183610)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-04-30 03:08:17 UTC (rev 183609)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-04-30 03:15:23 UTC (rev 183610)
@@ -48,6 +48,7 @@
#import "LocalCurrentGraphicsContext.h"
#import "LocalizedStrings.h"
#import "MediaControlElements.h"
+#import "NSColorSPI.h"
#import "NSSharingServicePickerSPI.h"
#import "Page.h"
#import "PaintInfo.h"
@@ -457,7 +458,7 @@
Color RenderThemeMac::systemColor(CSSValueID cssValueId) const
{
{
- HashMap<int, RGBA32>::iterator it = m_systemColorCache.find(cssValueId);
+ auto it = m_systemColorCache.find(cssValueId);
if (it != m_systemColorCache.end())
return it->value;
}
@@ -567,6 +568,35 @@
case CSSValueWindowtext:
color = convertNSColorToColor([NSColor windowFrameTextColor]);
break;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ case CSSValueAppleSystemBlue:
+ color = convertNSColorToColor([NSColor systemBlueColor]);
+ break;
+ case CSSValueAppleSystemBrown:
+ color = convertNSColorToColor([NSColor systemBrownColor]);
+ break;
+ case CSSValueAppleSystemGray:
+ color = convertNSColorToColor([NSColor systemGrayColor]);
+ break;
+ case CSSValueAppleSystemGreen:
+ color = convertNSColorToColor([NSColor systemGreenColor]);
+ break;
+ case CSSValueAppleSystemOrange:
+ color = convertNSColorToColor([NSColor systemOrangeColor]);
+ break;
+ case CSSValueAppleSystemPink:
+ color = convertNSColorToColor([NSColor systemPinkColor]);
+ break;
+ case CSSValueAppleSystemPurple:
+ color = convertNSColorToColor([NSColor systemPurpleColor]);
+ break;
+ case CSSValueAppleSystemRed:
+ color = convertNSColorToColor([NSColor systemRedColor]);
+ break;
+ case CSSValueAppleSystemYellow:
+ color = convertNSColorToColor([NSColor systemYellowColor]);
+ break;
+#endif
default:
break;
}