RESOLVED FIXED 163564
AX: "(inverted-colors)" media query only matches on page reload; should match on change
https://bugs.webkit.org/show_bug.cgi?id=163564
Summary AX: "(inverted-colors)" media query only matches on page reload; should match...
James Craig
Reported 2016-10-17 13:56:17 PDT
Given the following CSS, the media query only matches on page reload if colors are inverted. It does not match when the setting changes. ``` html, body { color: #000; background-color: #fff; } @media (inverted-colors) { html, body { color: #006; background-color: #ffa; } img, video { filter: invert(100%); } } ```
Attachments
test case (475 bytes, text/html)
2016-10-17 14:02 PDT, James Craig
no flags
Patch (39.02 KB, patch)
2016-11-18 15:47 PST, Dean Jackson
no flags
Patch (39.31 KB, patch)
2016-11-18 16:31 PST, Dean Jackson
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2016-10-17 13:56:52 PDT
James Craig
Comment 2 2016-10-17 14:02:49 PDT
Created attachment 291870 [details] test case
Dean Jackson
Comment 3 2016-10-17 18:41:12 PDT
I commented in radar, but I'll get to this in a couple of weeks. I'll fix this, monochrome, and prefers-reduced-motion at the same time.
Dean Jackson
Comment 4 2016-11-18 15:47:41 PST
Dean Jackson
Comment 5 2016-11-18 16:31:01 PST
Simon Fraser (smfr)
Comment 6 2016-11-18 17:26:07 PST
Comment on attachment 295215 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295215&action=review > Source/WebCore/page/Page.cpp:2072 > + auto* styleResolver = document->styleScope().resolverIfExists(); > + if (styleResolver && styleResolver->hasMediaQueriesAffectedByAccessibilitySettingsChange()) { > + LOG(Layout, "hasMediaQueriesAffectedByAccessibilitySettingsChange, enqueueing style recalc"); > + document->styleScope().didChangeStyleSheetEnvironment(); > + // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds. > + InspectorInstrumentation::mediaQueryResultChanged(*document); Don't you need to do this for all subframes? > Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:55 > + void simulateAccessibilitySettingsChangeNotification(JSValueRef callback); Do you want to make it possible to test individual settings? > Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:78 > + [webView _doAfterNextPresentationUpdate: ^ { Ignore the style checker. ^{ > Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm:101 > + [webView _doAfterNextPresentationUpdate: ^ { Ignore the style checker. ^{
Dean Jackson
Comment 7 2016-11-18 17:47:10 PST
Comment on attachment 295215 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295215&action=review >> Source/WebCore/page/Page.cpp:2072 >> + InspectorInstrumentation::mediaQueryResultChanged(*document); > > Don't you need to do this for all subframes? Fixed. >> Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:55 >> + void simulateAccessibilitySettingsChangeNotification(JSValueRef callback); > > Do you want to make it possible to test individual settings? I can do that on iOS, but macOS has a single notification for all Accessibility changes.
Dean Jackson
Comment 8 2016-11-18 18:52:36 PST
Note You need to log in before you can comment on or make changes to this bug.