CSS4: Support "inverted" media feature. http://dev.w3.org/csswg/mediaqueries-4/#inverted Based on IndieUI, which uses old name "colors-inverted": http://www.w3.org/TR/indie-ui-context/#media-feature-colors-inverted
<rdar://problem/18586398>
Apple UIKit API for detecting color inversion on iOS // From <UIKit/UIAccessibility.h> // Returns whether the system preference for invert colors is enabled. UIKIT_EXTERN BOOL UIAccessibilityIsInvertColorsEnabled() NS_AVAILABLE_IOS(6_0); UIKIT_EXTERN NSString *const UIAccessibilityInvertColorsStatusDidChangeNotification NS_AVAILABLE_IOS(6_0);
Created attachment 240086 [details] Patch
Not for review yet, but it works fine. I need to write the ChangeLog and make sure it compiles on other platforms. Oh, I did the monochrome media query as well, although I need to read the spec to make sure we do the right thing if the rule asks for particular bit depths. I'm not sure we can test this. We'd have to expose an internals API to invert the screen. Is this a completely safe thing to do? Also, the media query does not re-evaluate as the screen swaps. The page needs to be reloaded. We can detect the change on iOS, but I have not found any notification for OS X.
Attachment 240086 [details] did not pass style-queue: ERROR: Source/WebCore/css/MediaQueryEvaluator.cpp:240: inverted_colorsMediaFeatureEval is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 240137 [details] Patch
Attachment 240137 [details] did not pass style-queue: ERROR: Source/WebCore/css/MediaQueryEvaluator.cpp:240: inverted_colorsMediaFeatureEval is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 16 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 240137 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240137&action=review r=me. I think you could support Windows here with the change I suggested below. > Source/WebCore/platform/win/PlatformScreenWin.cpp:89 > + return false; I think this could be #if USE(CG) return CGDisplayUsesInvertedPolarity(); #else return false; #endif
Committed r174901: <http://trac.webkit.org/changeset/174901>