Diff
Modified: trunk/LayoutTests/ChangeLog (208914 => 208915)
--- trunk/LayoutTests/ChangeLog 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/LayoutTests/ChangeLog 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1,3 +1,20 @@
+2016-11-18 Dean Jackson <[email protected]>
+
+ AX: "(inverted-colors)" media query only matches on page reload; should match on change
+ https://bugs.webkit.org/show_bug.cgi?id=163564
+ <rdar://problem/28807350>
+
+ Reviewed by Simon Fraser.
+
+ * fast/media/mq-inverted-colors-live-update-in-subframes-expected.html: Added.
+ * fast/media/mq-inverted-colors-live-update-in-subframes.html: Added.
+ * fast/media/mq-inverted-colors-live-update-expected.html: Added.
+ * fast/media/mq-inverted-colors-live-update.html: Added.
+ * fast/media/mq-monochrome-live-update-expected.html: Added.
+ * fast/media/mq-monochrome-live-update.html: Added.
+ * fast/media/mq-prefers-reduced-motion-live-update-expected.html: Added.
+ * fast/media/mq-prefers-reduced-motion-live-update.html: Added.
+
2016-11-18 Myles C. Maxfield <[email protected]>
[WebGL2] Implement texStorage2D()
Modified: trunk/LayoutTests/TestExpectations (208914 => 208915)
--- trunk/LayoutTests/TestExpectations 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/LayoutTests/TestExpectations 2016-11-19 02:51:15 UTC (rev 208915)
@@ -70,6 +70,12 @@
# This test is for ios-simulator-wk1
editing/input/focus-change-with-marked-text.html [ Skip ]
+# These only run on Mac and iOS WK2
+fast/media/mq-inverted-colors-live-update.html [ Skip ]
+fast/media/mq-inverted-colors-live-update-in-subframes.html [ Skip ]
+fast/media/mq-monochrome-live-update.html [ Skip ]
+fast/media/mq-prefers-reduced-motion-live-update.html [ Skip ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific tests.
#//////////////////////////////////////////////////////////////////////////////////////////
Added: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-expected.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-expected.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-expected.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>CSS4 media query test: inverted-colors.</title>
+<style type="text/css">
+p { color: black; }
+#a { color: green; }
+</style>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: rgb(0, 0, 0) - should be rgb(0, 0, 0)</p>
+ <p>After was: rgb(0, 128, 0) - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-expected.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes-expected.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes-expected.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes-expected.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,19 @@
+<html>
+<head>
+<title>CSS4 media query test: inverted-colors.</title>
+</head>
+<body>
+ <iframe srcdoc='
+ <style type="text/css">
+ p { color: black; }
+
+ @media (inverted-colors) {
+ #a { color: green; }
+ }
+ </style>
+ <p id="a"></p>
+ '></iframe>
+ <p>Before was: <span id="before">rgb(0, 0, 0)</span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after">rgb(0, 128, 0)</span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes-expected.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,77 @@
+<html>
+<head>
+<title>CSS4 media query test: inverted-colors.</title>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function getUIScript()
+{
+ return `
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`
+}
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var frame = document.querySelector("iframe");
+ frame.contentWindow.postMessage({ type: "before" }, "*");
+}
+
+window.addEventListener("load", runTest, false);
+
+window.addEventListener("message", function (event) {
+ if (event.data.type == "beforeResponse") {
+ document.getElementById("before").textContent = event.data.color;
+ window.internals.settings.forcedColorsAreInvertedAccessibilityValue = "on";
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ var frame = document.querySelector("iframe");
+ frame.contentWindow.postMessage({ type: "after" }, "*");
+ });
+ }
+ } else if (event.data.type == "afterResponse") {
+ document.getElementById("after").textContent = event.data.color;
+ testRunner.notifyDone();
+ }
+}, false);
+
+</script>
+</head>
+<body>
+ <iframe srcdoc='
+ <style type="text/css">
+ p { color: black; }
+
+ @media (inverted-colors) {
+ #a { color: green; }
+ }
+ </style>
+ <script>
+ window.addEventListener("message", function (event) {
+ var element = document.getElementById("a");
+ if (event.data.type == "before") {
+ event.source.postMessage({
+ type: "beforeResponse",
+ color: window.getComputedStyle(element).color
+ }, event.origin);
+ } else if (event.data.type == "after") {
+ event.source.postMessage({
+ type: "afterResponse",
+ color: window.getComputedStyle(element).color
+ }, event.origin);
+ }
+ }, false);
+ </script>
+ <p id="a"></p>
+ '></iframe>
+ <p>Before was: <span id="before"></span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after"></span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update-in-subframes.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-inverted-colors-live-update.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors-live-update.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<title>CSS4 media query test: inverted-colors.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (inverted-colors) {
+ #a { color: green; }
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function getUIScript()
+{
+ return `
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`
+}
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var element = document.getElementById("a");
+
+ window.internals.settings.forcedColorsAreInvertedAccessibilityValue = "on";
+ document.getElementById("before").textContent = window.getComputedStyle(element).color;
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ document.getElementById("after").textContent = window.getComputedStyle(element).color;
+ testRunner.notifyDone();
+ });
+ }
+}
+
+window.addEventListener("load", runTest, false);
+</script>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before"></span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after"></span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors-live-update.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-monochrome-live-update-expected.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-monochrome-live-update-expected.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-monochrome-live-update-expected.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>CSS4 media query test: monochrome.</title>
+<style type="text/css">
+p { color: black; }
+#a { color: green; }
+</style>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: rgb(0, 0, 0) - should be rgb(0, 0, 0)</p>
+ <p>After was: rgb(0, 128, 0) - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-monochrome-live-update-expected.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-monochrome-live-update.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-monochrome-live-update.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-monochrome-live-update.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<title>CSS4 media query test: monochrome.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (monochrome) {
+ #a { color: green; }
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function getUIScript()
+{
+ return `
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`
+}
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var element = document.getElementById("a");
+
+ window.internals.settings.forcedDisplayIsMonochromeAccessibilityValue = "on";
+ document.getElementById("before").textContent = window.getComputedStyle(element).color;
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ document.getElementById("after").textContent = window.getComputedStyle(element).color;
+ testRunner.notifyDone();
+ });
+ }
+}
+
+window.addEventListener("load", runTest, false);
+</script>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before"></span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after"></span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-monochrome-live-update.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update-expected.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update-expected.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update-expected.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-reduced-motion.</title>
+<style type="text/css">
+p { color: black; }
+#a { color: green; }
+</style>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: rgb(0, 0, 0) - should be rgb(0, 0, 0)</p>
+ <p>After was: rgb(0, 128, 0) - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update-expected.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update.html (0 => 208915)
--- trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update.html 2016-11-19 02:51:15 UTC (rev 208915)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-reduced-motion.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (prefers-reduced-motion) {
+ #a { color: green; }
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function getUIScript()
+{
+ return `
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`
+}
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var element = document.getElementById("a");
+
+ window.internals.settings.forcedPrefersReducedMotionAccessibilityValue = "on";
+ document.getElementById("before").textContent = window.getComputedStyle(element).color;
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ document.getElementById("after").textContent = window.getComputedStyle(element).color;
+ testRunner.notifyDone();
+ });
+ }
+}
+
+window.addEventListener("load", runTest, false);
+</script>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before"></span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after"></span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/media/mq-prefers-reduced-motion-live-update.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (208914 => 208915)
--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2016-11-19 02:51:15 UTC (rev 208915)
@@ -11,6 +11,11 @@
scrollingcoordinator/ios [ Pass ]
editing/selection/character-granularity-rect.html [ Pass ]
+fast/media/mq-inverted-colors-live-update.html [ Pass ]
+fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
+fast/media/mq-monochrome-live-update.html [ Pass ]
+fast/media/mq-prefers-reduced-motion-live-update.html [ Pass ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (208914 => 208915)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-11-19 02:51:15 UTC (rev 208915)
@@ -14,6 +14,11 @@
fast/events/force-click-on-link-navigation.html [ Pass ]
fast/events/force-click-text-selection-behavior.html [ Failure ]
+fast/media/mq-inverted-colors-live-update.html [ Pass ]
+fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
+fast/media/mq-monochrome-live-update.html [ Pass ]
+fast/media/mq-prefers-reduced-motion-live-update.html [ Pass ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/Source/WebCore/ChangeLog (208914 => 208915)
--- trunk/Source/WebCore/ChangeLog 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/ChangeLog 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1,3 +1,31 @@
+2016-11-18 Dean Jackson <[email protected]>
+
+ AX: "(inverted-colors)" media query only matches on page reload; should match on change
+ https://bugs.webkit.org/show_bug.cgi?id=163564
+ <rdar://problem/28807350>
+
+ Reviewed by Simon Fraser.
+
+ Mark some media queries as responding to notifications that
+ system accessibility settings have changed. When Page gets told
+ that has happened, check if any of the results have changed.
+
+ Tests: fast/media/mq-inverted-colors-live-update.html
+ fast/media/mq-monochrome-live-update.html
+ fast/media/mq-prefers-reduced-motion-live-update.html
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::isAccessibilitySettingsDependent):
+ (WebCore::MediaQueryEvaluator::evaluate):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::addAccessibilitySettingsDependentMediaQueryResult):
+ (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange):
+ * css/StyleResolver.h:
+ (WebCore::StyleResolver::hasAccessibilitySettingsDependentMediaQueries):
+ * page/Page.cpp:
+ (WebCore::Page::accessibilitySettingsDidChange):
+ * page/Page.h:
+
2016-11-18 Anders Carlsson <[email protected]>
Rename the 'other' Apple Pay Button type to 'donate'
Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (208914 => 208915)
--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -63,6 +63,15 @@
typedef bool (*MediaQueryFunction)(CSSValue*, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix);
typedef HashMap<AtomicStringImpl*, MediaQueryFunction> MediaQueryFunctionMap;
+static bool isAccessibilitySettingsDependent(const AtomicString& mediaFeature)
+{
+ return mediaFeature == MediaFeatureNames::invertedColors
+ || mediaFeature == MediaFeatureNames::maxMonochrome
+ || mediaFeature == MediaFeatureNames::minMonochrome
+ || mediaFeature == MediaFeatureNames::monochrome
+ || mediaFeature == MediaFeatureNames::prefersReducedMotion;
+}
+
static bool isViewportDependent(const AtomicString& mediaFeature)
{
return mediaFeature == MediaFeatureNames::width
@@ -120,9 +129,9 @@
{
auto& queries = querySet.queryVector();
if (!queries.size())
- return true; // empty query list evaluates to true
+ return true; // Empty query list evaluates to true.
- // iterate over queries, stop if any of them eval to true (OR semantics)
+ // Iterate over queries, stop if any of them eval to true (OR semantics).
bool result = false;
for (size_t i = 0; i < queries.size() && !result; ++i) {
auto& query = queries[i];
@@ -132,18 +141,19 @@
if (mediaTypeMatch(query.mediaType())) {
auto& expressions = query.expressions();
- // iterate through expressions, stop if any of them eval to false (AND semantics)
+ // Iterate through expressions, stop if any of them eval to false (AND semantics).
size_t j = 0;
for (; j < expressions.size(); ++j) {
bool expressionResult = evaluate(expressions[j]);
if (styleResolver && isViewportDependent(expressions[j].mediaFeature()))
styleResolver->addViewportDependentMediaQueryResult(expressions[j], expressionResult);
+ if (styleResolver && isAccessibilitySettingsDependent(expressions[j].mediaFeature()))
+ styleResolver->addAccessibilitySettingsDependentMediaQueryResult(expressions[j], expressionResult);
if (!expressionResult)
break;
}
- // assume true if we are at the end of the list,
- // otherwise assume false
+ // Assume true if we are at the end of the list, otherwise assume false.
result = applyRestrictor(query.restrictor(), expressions.size() == j);
} else
result = applyRestrictor(query.restrictor(), false);
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (208914 => 208915)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1850,6 +1850,20 @@
return false;
}
+void StyleResolver::addAccessibilitySettingsDependentMediaQueryResult(const MediaQueryExpression& _expression_, bool result)
+{
+ m_accessibilitySettingsDependentMediaQueryResults.append(MediaQueryResult { _expression_, result });
+}
+
+bool StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange() const
+{
+ for (auto& result : m_accessibilitySettingsDependentMediaQueryResults) {
+ if (m_mediaQueryEvaluator.evaluate(result._expression_) != result.result)
+ return true;
+ }
+ return false;
+}
+
static FilterOperation::OperationType filterOperationForType(CSSValueID type)
{
switch (type) {
Modified: trunk/Source/WebCore/css/StyleResolver.h (208914 => 208915)
--- trunk/Source/WebCore/css/StyleResolver.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/css/StyleResolver.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -207,6 +207,10 @@
bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
bool hasMediaQueriesAffectedByViewportChange() const;
+ void addAccessibilitySettingsDependentMediaQueryResult(const MediaQueryExpression&, bool result);
+ bool hasAccessibilitySettingsDependentMediaQueries() const { return !m_accessibilitySettingsDependentMediaQueryResults.isEmpty(); }
+ bool hasMediaQueriesAffectedByAccessibilitySettingsChange() const;
+
void addKeyframeStyle(Ref<StyleRuleKeyframes>&&);
bool checkRegionStyle(const Element* regionElement);
@@ -503,6 +507,7 @@
RenderStyle* m_overrideDocumentElementStyle { nullptr };
Vector<MediaQueryResult> m_viewportDependentMediaQueryResults;
+ Vector<MediaQueryResult> m_accessibilitySettingsDependentMediaQueryResults;
#if ENABLE(CSS_DEVICE_ADAPTATION)
RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
Modified: trunk/Source/WebCore/page/Page.cpp (208914 => 208915)
--- trunk/Source/WebCore/page/Page.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/page/Page.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -2058,4 +2058,24 @@
invalidateInjectedStyleSheetCacheInAllFrames();
}
+void Page::accessibilitySettingsDidChange()
+{
+ bool neededRecalc = false;
+
+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (Document* document = frame->document()) {
+ auto* styleResolver = document->styleScope().resolverIfExists();
+ if (styleResolver && styleResolver->hasMediaQueriesAffectedByAccessibilitySettingsChange()) {
+ document->styleScope().didChangeStyleSheetEnvironment();
+ neededRecalc = true;
+ // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
+ InspectorInstrumentation::mediaQueryResultChanged(*document);
+ }
+ }
+ }
+
+ if (neededRecalc)
+ LOG(Layout, "hasMediaQueriesAffectedByAccessibilitySettingsChange, enqueueing style recalc");
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/page/Page.h (208914 => 208915)
--- trunk/Source/WebCore/page/Page.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebCore/page/Page.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -317,7 +317,9 @@
WEBCORE_EXPORT void setHorizontalScrollElasticity(ScrollElasticity);
ScrollElasticity horizontalScrollElasticity() const { return static_cast<ScrollElasticity>(m_horizontalScrollElasticity); }
-
+
+ WEBCORE_EXPORT void accessibilitySettingsDidChange();
+
// Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
// and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
// FrameViews in the page cache, but FrameView::pagination() only affects the current
Modified: trunk/Source/WebKit2/ChangeLog (208914 => 208915)
--- trunk/Source/WebKit2/ChangeLog 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/ChangeLog 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1,3 +1,37 @@
+2016-11-18 Dean Jackson <[email protected]>
+
+ AX: "(inverted-colors)" media query only matches on page reload; should match on change
+ https://bugs.webkit.org/show_bug.cgi?id=163564
+ <rdar://problem/28807350>
+
+ Reviewed by Simon Fraser.
+
+ Listen for the appropriate notifications that accessibility settings
+ have changed. This is a single notification on macOS, which uses WebViewImpl,
+ and more fine-grained notifications on iOS, using WKWebView.
+
+ When we see the notification, send a message to the WebProcess which will
+ then tell the WebCore::Page.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ (-[WKWebView _accessibilitySettingsDidChange:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (-[WKAccessibilitySettingsObserver initWithImpl:]):
+ (-[WKAccessibilitySettingsObserver dealloc]):
+ (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::accessibilitySettingsDidChange):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::accessibilitySettingsDidChange):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::accessibilitySettingsDidChange):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2016-11-18 Jeremy Jones <[email protected]>
USE WK_MAC_TBA for version number in _webViewRequestPointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12))
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (208914 => 208915)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -540,6 +540,10 @@
[center addObserver:self selector:@selector(_contentSizeCategoryDidChange:) name:UIContentSizeCategoryDidChangeNotification object:nil];
_page->contentSizeCategoryDidChange([self _contentSizeCategory]);
+ [center addObserver:self selector:@selector(_accessibilitySettingsDidChange:) name:UIAccessibilityGrayscaleStatusDidChangeNotification object:nil];
+ [center addObserver:self selector:@selector(_accessibilitySettingsDidChange:) name:UIAccessibilityInvertColorsStatusDidChangeNotification object:nil];
+ [center addObserver:self selector:@selector(_accessibilitySettingsDidChange:) name:UIAccessibilityReduceMotionStatusDidChangeNotification object:nil];
+
[[_configuration _contentProviderRegistry] addPage:*_page];
_page->setForceAlwaysUserScalable([_configuration ignoresViewportScaleLimits]);
#endif
@@ -2248,6 +2252,11 @@
return [[UIApplication sharedApplication] preferredContentSizeCategory];
}
+- (void)_accessibilitySettingsDidChange:(NSNotification *)notification
+{
+ _page->accessibilitySettingsDidChange();
+}
+
- (void)setAllowsBackForwardNavigationGestures:(BOOL)allowsBackForwardNavigationGestures
{
if (_allowsBackForwardNavigationGestures == allowsBackForwardNavigationGestures)
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (208914 => 208915)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -43,6 +43,7 @@
OBJC_CLASS NSImmediateActionGestureRecognizer;
OBJC_CLASS NSTextInputContext;
OBJC_CLASS NSView;
+OBJC_CLASS WKAccessibilitySettingsObserver;
OBJC_CLASS WKBrowsingContextController;
OBJC_CLASS WKEditorUndoTargetObjC;
OBJC_CLASS WKFullScreenWindowController;
@@ -208,6 +209,8 @@
bool shouldDelayWindowOrderingForEvent(NSEvent *);
bool windowResizeMouseLocationIsInVisibleScrollerThumb(CGPoint);
+ void accessibilitySettingsDidChange();
+
// -[NSView mouseDownCanMoveWindow] returns YES when the NSView is transparent,
// but we don't want a drag in the NSView to move the window, even if it's transparent.
static bool mouseDownCanMoveWindow() { return false; }
@@ -631,6 +634,7 @@
#endif
RetainPtr<WKWindowVisibilityObserver> m_windowVisibilityObserver;
+ RetainPtr<WKAccessibilitySettingsObserver> m_accessibilitySettingsObserver;
bool m_shouldDeferViewInWindowChanges { false };
bool m_viewInWindowChangeWasDeferred { false };
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (208914 => 208915)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -122,6 +122,46 @@
- (BOOL)handleEventByKeyboardLayout:(NSEvent *)event;
@end
+@interface WKAccessibilitySettingsObserver : NSObject {
+ WebKit::WebViewImpl *_impl;
+}
+
+- (instancetype)initWithImpl:(WebKit::WebViewImpl&)impl;
+@end
+
+@implementation WKAccessibilitySettingsObserver
+
+- (instancetype)initWithImpl:(WebKit::WebViewImpl&)impl
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _impl = &impl;
+
+ NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
+ [workspaceNotificationCenter addObserver:self selector:@selector(_settingsDidChange:) name:NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification object:nil];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
+ [workspaceNotificationCenter removeObserver:self name:NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification object:nil];
+
+ [super dealloc];
+}
+
+- (void)_settingsDidChange:(NSNotification *)notification
+{
+ WTFLogAlways("received notification");
+
+ _impl->accessibilitySettingsDidChange();
+}
+
+@end
+
@interface WKWindowVisibilityObserver : NSObject {
NSView *_view;
WebKit::WebViewImpl *_impl;
@@ -134,7 +174,6 @@
- (void)startObservingLookupDismissal;
@end
-
@implementation WKWindowVisibilityObserver
- (instancetype)initWithView:(NSView *)view impl:(WebKit::WebViewImpl&)impl
@@ -1180,6 +1219,7 @@
, m_layoutStrategy([WKViewLayoutStrategy layoutStrategyWithPage:m_page view:m_view viewImpl:*this mode:kWKLayoutModeViewSize])
, m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
, m_windowVisibilityObserver(adoptNS([[WKWindowVisibilityObserver alloc] initWithView:view impl:*this]))
+ , m_accessibilitySettingsObserver(adoptNS([[WKAccessibilitySettingsObserver alloc] initWithImpl:*this]))
, m_primaryTrackingArea(adoptNS([[NSTrackingArea alloc] initWithRect:m_view.frame options:trackingAreaOptions() owner:m_view userInfo:nil]))
{
static_cast<PageClientImpl&>(*m_pageClient).setImpl(*this);
@@ -1839,6 +1879,11 @@
return false;
}
+void WebViewImpl::accessibilitySettingsDidChange()
+{
+ m_page->accessibilitySettingsDidChange();
+}
+
bool WebViewImpl::acceptsFirstMouse(NSEvent *event)
{
if (!mightBeginDragWhileInactive() && !mightBeginScrollWhileInactive())
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208914 => 208915)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -2603,6 +2603,14 @@
m_drawingArea->deviceScaleFactorDidChange();
}
+void WebPageProxy::accessibilitySettingsDidChange()
+{
+ if (!isValid())
+ return;
+
+ m_process->send(Messages::WebPage::AccessibilitySettingsDidChange(), m_pageID);
+}
+
void WebPageProxy::setUseFixedLayout(bool fixed)
{
if (!isValid())
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (208914 => 208915)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -684,6 +684,7 @@
void setIntrinsicDeviceScaleFactor(float);
void setCustomDeviceScaleFactor(float);
void windowScreenDidChange(WebCore::PlatformDisplayID);
+ void accessibilitySettingsDidChange();
void setUseFixedLayout(bool);
void setFixedLayoutSize(const WebCore::IntSize&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208914 => 208915)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1674,6 +1674,11 @@
return m_page->deviceScaleFactor();
}
+void WebPage::accessibilitySettingsDidChange()
+{
+ m_page->accessibilitySettingsDidChange();
+}
+
void WebPage::setUseFixedLayout(bool fixed)
{
// Do not overwrite current settings if initially setting it to false.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (208914 => 208915)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -391,6 +391,8 @@
void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
void windowScreenDidChange(uint32_t);
+ void accessibilitySettingsDidChange();
+
void scalePage(double scale, const WebCore::IntPoint& origin);
void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
double pageScaleFactor() const;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (208914 => 208915)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-11-19 02:51:15 UTC (rev 208915)
@@ -201,6 +201,8 @@
SetTextZoomFactor(double zoomFactor)
WindowScreenDidChange(uint32_t displayID)
+ AccessibilitySettingsDidChange()
+
ScalePage(double scale, WebCore::IntPoint origin)
ScalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates)
ScaleView(double scale)
Modified: trunk/Tools/ChangeLog (208914 => 208915)
--- trunk/Tools/ChangeLog 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/ChangeLog 2016-11-19 02:51:15 UTC (rev 208915)
@@ -1,3 +1,29 @@
+2016-11-18 Dean Jackson <[email protected]>
+
+ AX: "(inverted-colors)" media query only matches on page reload; should match on change
+ https://bugs.webkit.org/show_bug.cgi?id=163564
+ <rdar://problem/28807350>
+
+ Reviewed by Simon Fraser.
+
+ Add a UIScriptController method that tricks WebKit into thinking
+ it has received a notification that accessibility settings have
+ changed. Combined with our forced overrides, this allows us to
+ test if a page would react to the notifications.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::simulateAccessibilitySettingsChangeNotification):
+ * DumpRenderTree/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptController::simulateAccessibilitySettingsChangeNotification):
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::simulateAccessibilitySettingsChangeNotification):
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::simulateAccessibilitySettingsChangeNotification):
+ * WebKitTestRunner/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptController::simulateAccessibilitySettingsChangeNotification):
+
2016-11-18 Alex Christensen <[email protected]>
Fix API test after r208902
Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (208914 => 208915)
--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -63,6 +63,10 @@
});
}
+void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef)
+{
+}
+
double UIScriptController::zoomScale() const
{
return gWebScrollView.zoomScale;
Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (208914 => 208915)
--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -64,6 +64,10 @@
});
}
+void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef)
+{
+}
+
JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
{
return nullptr;
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (208914 => 208915)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2016-11-19 02:51:15 UTC (rev 208915)
@@ -29,6 +29,8 @@
void zoomToScale(double scale, object callback);
+ void simulateAccessibilitySettingsChangeNotification(object callback);
+
// Interaction.
// These functions post events asynchronously. The callback is fired when the events have been dispatched, but any
// resulting behavior may also be asynchronous.
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (208914 => 208915)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-11-19 02:51:15 UTC (rev 208915)
@@ -56,6 +56,10 @@
void UIScriptController::doAsyncTask(JSValueRef)
{
}
+
+void simulateAccessibilitySettingsChangeNotification(JSValueRef)
+{
+}
#endif
void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
@@ -162,6 +166,10 @@
{
}
+void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef)
+{
+}
+
JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
{
return nullptr;
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (208914 => 208915)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2016-11-19 02:51:15 UTC (rev 208915)
@@ -52,6 +52,8 @@
void doAsyncTask(JSValueRef callback);
void zoomToScale(double scale, JSValueRef callback);
+ void simulateAccessibilitySettingsChangeNotification(JSValueRef callback);
+
void touchDownAtPoint(long x, long y, long touchCount, JSValueRef callback);
void liftUpAtPoint(long x, long y, long touchCount, JSValueRef callback);
void singleTapAtPoint(long x, long y, JSValueRef callback);
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (208914 => 208915)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -68,6 +68,21 @@
}];
}
+void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef callback)
+{
+ unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+ auto* webView = TestController::singleton().mainWebView()->platformView();
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center postNotificationName:UIAccessibilityInvertColorsStatusDidChangeNotification object:webView];
+
+ [webView _doAfterNextPresentationUpdate: ^{
+ if (!m_context)
+ return;
+ m_context->asyncTaskComplete(callbackID);
+ }];
+}
+
double UIScriptController::zoomScale() const
{
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (208914 => 208915)
--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2016-11-19 02:45:25 UTC (rev 208914)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2016-11-19 02:51:15 UTC (rev 208915)
@@ -90,6 +90,25 @@
#endif
}
+void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef callback)
+{
+#if WK_API_ENABLED
+ unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+ auto* webView = TestController::singleton().mainWebView()->platformView();
+ NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
+ [center postNotificationName:NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification object:webView];
+
+ [webView _doAfterNextPresentationUpdate: ^{
+ if (!m_context)
+ return;
+ m_context->asyncTaskComplete(callbackID);
+ }];
+#else
+ UNUSED_PARAM(callback);
+#endif
+}
+
JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
{
#if WK_API_ENABLED