forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1794628 - Implement inverted-colors media feature r=geckoview-rev…
…iewers,morgan,emilio,m_kato,cmartin Implemented the inverted-colors media feature from Media Queries Level 5 for all platforms. Spec: https://drafts.csswg.org/mediaqueries-5/#inverted Platform specific implementations: - Windows: Checks system color filter setting, and if it is inverted (note: Windows does not live update due to having to read a reg key) - Mac: Checks dedicated inverted accessibility system setting - Android: Checks dedicated inverted system setting - Linux: No GTK API exposes anything like it so always none Locked behind new pref `layout.css.inverted-colors.enabled`, always off by default for now. Also added new WPT tests (none previously). Other browsers: - WebKit: shipped since Safari 9.1 (Jan 2017) - Blink: no signal Test page: https://goose.icu/inverted-colors Differential Revision: https://phabricator.services.mozilla.com/D173201
- Loading branch information
1 parent
7beef23
commit 2d52065
Showing
22 changed files
with
192 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
testing/web-platform/meta/css/mediaqueries/inverted-colors.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[inverted-colors.html] | ||
prefs: [layout.css.inverted-colors.enabled:true] |
29 changes: 29 additions & 0 deletions
29
testing/web-platform/tests/css/mediaqueries/inverted-colors.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.csswg.org/mediaqueries-5/#inverted" /> | ||
<script type="text/javascript" src="/resources/testharness.js"></script> | ||
<script type="text/javascript" src="/resources/testharnessreport.js"></script> | ||
|
||
<script type="text/javascript" src="resources/matchmedia-utils.js"></script> | ||
<script> | ||
query_should_be_known("(inverted-colors)"); | ||
query_should_be_known("(inverted-colors: none)"); | ||
query_should_be_known("(inverted-colors: inverted)"); | ||
|
||
query_should_be_unknown("(inverted-colors: 0)"); | ||
query_should_be_unknown("(inverted-colors: no-preference)"); | ||
query_should_be_unknown("(inverted-colors: 10px)"); | ||
query_should_be_unknown("(inverted-colors: none inverted)"); | ||
query_should_be_unknown("(inverted-colors: none/inverted)"); | ||
|
||
test(() => { | ||
// https://drafts.csswg.org/mediaqueries-5/#boolean-context | ||
let booleanContext = window.matchMedia("(inverted-colors)"); | ||
let none = window.matchMedia("(inverted-colors: none)"); | ||
assert_equals(booleanContext.matches, !none.matches); | ||
}, "Check that none evaluates to false in the boolean context"); | ||
|
||
test(() => { | ||
let invalid = window.matchMedia("(inverted-colors: 10px)"); | ||
assert_equals(invalid.matches, false); | ||
}, "Check that invalid evaluates to false"); | ||
</script> |
4 changes: 0 additions & 4 deletions
4
testing/web-platform/tests/css/mediaqueries/scripting-print-noscript-ref.html
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
testing/web-platform/tests/css/mediaqueries/scripting-print-noscript.html
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
testing/web-platform/tests/css/mediaqueries/scripting-print-script-ref.html
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
testing/web-platform/tests/css/mediaqueries/scripting-print-script.html
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
testing/web-platform/tests/css/mediaqueries/scripting.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.