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%); } } ```
<rdar://problem/28807350>
Created attachment 291870 [details] test case
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.
Created attachment 295203 [details] Patch
Created attachment 295215 [details] Patch
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. ^{
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.
Committed r208915: <http://trac.webkit.org/changeset/208915>