Closed Bug 1022553 Opened 10 years ago Closed 2 years ago

Audio/video controls unusable in High Contrast mode

Categories

(Toolkit :: Video/Audio Controls, defect, P3)

All
Windows
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: Unfocused, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Keywords: access)

Attachments

(6 files, 1 obsolete file)

Attached image Screenshot (deleted) —
The audio/video controls are completely unusable when using High Contrast mode. See attached screenshot.
Flags: firefox-backlog+
Blocks: fx-high-contrast
No longer blocks: 1022551
Keywords: access
Priority: -- → P1
The main problem seems to be that we're using background-image extensively: https://dxr.mozilla.org/mozilla-central/source/toolkit/themes/shared/media/videocontrols.css Not sure if there's a good CSS-only alternative (maybe some hack involving ::before?) or whether we should use img tags instead (not great in terms of separating styling from content.) Boris, short of bug 957988, is there some way to make Gecko not remove background images in this particular case?
Flags: needinfo?(bzbarsky)
Severity: normal → major
OS: Windows 8.1 → Windows
Hardware: x86_64 → All
Whiteboard: p=3
Version: unspecified → Trunk
So the issue here is that background colors/images are ignored when forcing document colors, which is the default behavior in high-contrast themes. This means that you get the same problem simply if you force the user-prefence colors in preferences, right? The right general fix for this is to put the relevant styles into a UA or user sheet, not an author sheet. Those are not affected by this setting. Unfortunately, video controls use an xbl stylesheet, not a UA sheet, even though conceptually they are part of UA styling... I suppose we could introduce a new cascade level specifically for XBL, which will be just like doc rules except for ignoring the CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED bit.
Flags: needinfo?(bzbarsky)
(In reply to Boris Zbarsky [:bz] from comment #2) > So the issue here is that background colors/images are ignored when forcing > document colors, which is the default behavior in high-contrast themes. > > This means that you get the same problem simply if you force the > user-prefence colors in preferences, right? yes > I suppose we could introduce a new cascade level specifically for XBL, which > will be just like doc rules except for ignoring the > CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED bit. This might be handy for bug 1022605 too.
David, thoughts on that idea? See comment 2.
Flags: needinfo?(dbaron)
Sounds fine with me.
Flags: needinfo?(dbaron)
(In reply to Dão Gottwald [:dao] from comment #1) > Not sure if there's a good CSS-only alternative (maybe some hack involving > ::before?) or whether we should use img tags instead (not great in terms of > separating styling from content.) FWIW, they're background-images because having them be <image>s caused |load| events to be emitted... Which were visible to content, and that's bad. Especially early on when <video> itself emitted a |load| event (although iirc that's since been removed).
Blocks: 492516
Attached image High contrast(Nightly52xNightly53).png (deleted) —
The Audio/video controls in High Contrast mode in the latest nightly are displayed differently comparing with Firefox Nightly 52.0a1. The controls in Firefox Nightly 52.0a1 are also invisible but there is box displayed where the icon should be. (Please see the screenshot attached.)
(In reply to Hani Yacoub from comment #8) > Created attachment 8828358 [details] > High contrast(Nightly52xNightly53).png > > The Audio/video controls in High Contrast mode in the latest nightly are > displayed differently comparing with Firefox Nightly 52.0a1. > The controls in Firefox Nightly 52.0a1 are also invisible but there is box > displayed where the icon should be. (Please see the screenshot attached.) I don't think this makes a meaningful difference. They were unusable before and they're pretty much just as unusable now.
(In reply to Boris Zbarsky [:bz] (still a bit busy) from comment #2) > The right general fix for this is to put the relevant styles into a UA or > user sheet, not an author sheet. Those are not affected by this setting. > Unfortunately, video controls use an xbl stylesheet, not a UA sheet, even > though conceptually they are part of UA styling... > > I suppose we could introduce a new cascade level specifically for XBL, which > will be just like doc rules except for ignoring the > CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED bit. Jet, how hard is this and/or could someone from the platform team work on this?
Flags: needinfo?(bugs)
Let's ask dholbert who's also looking into bug 1319653
Flags: needinfo?(bugs) → needinfo?(dholbert)
(For reference, for me & anyone else: To easily trigger High Contrast Mode on non-windows platforms, set about:config pref browser.display.document_color_use = 2. This is exposed in our Preferences UI, too, though it's a bit buried so the about:config pref is more direct.)
Before comment 10 can be implemented, it might make sense to dynamic inject a UA sheet with DOMWindowUtils like this: http://searchfox.org/mozilla-central/rev/fdb811340ac4e6b93703d72ee99217f3b1d250ac/toolkit/content/datepicker.xhtml#40-47
Sorry, I meant comment 2. And with background-image properties in UA sheet they will not be ignored in high contrast mode.
Sorry for not getting to this sooner - I've been focused on Quantum Flow stuff recently, and I didn't know the answer to comment 11 (RE how hard this is) offhand. Just poked around the code with jaws, with bz's suggestions in mind from comment 2 here, and I think it's pretty straightforward. jaws has some relevant code up in tabs and is spinning up a patch right now -- transferring needinfo to him.
Flags: needinfo?(dholbert) → needinfo?(jaws)
Comment on attachment 8882066 [details] Bug 1022553 - Attempt to introduce a stylesheet type for XBL documents. https://reviewboard.mozilla.org/r/153162/#review158380 Please make sure to file a bug on doing this for stylo too... ::: layout/style/SheetType.h:25 (Diff revision 1) > enum class SheetType : uint8_t { > Agent, // CSS > User, // CSS > PresHint, > Doc, // CSS > + XblDoc, // CSS You need to document why this new type is not in gCSSSheetTypes. And you presumably want to document why the end of nsStyleSet::GatherRuleProcessors doesn't need to create an nsCSSRuleProcessor for this type. And avoit it hitting the fatal assert there. In nsStyleSet::FileRules you need to update the "Cascading order" comment and more importantly the code: you need to SetLevel the right thing before walking XBL rules. You also need to save the right start/end rulenode pointers for the new level so the !important rules can also be done with the right SetLevel. And you probably need to add the new thing to gCascadeLevels in the !important section, right? ::: layout/style/nsRuleNode.cpp:10643 (Diff revision 1) > // author-specified rules if we're looking at a non-color > // property or if we're looking at the background color and it's > // set to transparent. Anything else should get set to a dummy > // value instead. > if (aAuthorColorsAllowed || > + ruleData.mLevel == SheetType::XblDoc || This part doesn't look right. Why is this not checked where we check for agent/user styles? ::: layout/style/nsStyleStruct.h:107 (Diff revision 1) > #define NS_RULE_NODE_IS_ANIMATION_RULE 0x01000000 > // Free bit 0x02000000 > #define NS_RULE_NODE_USED_DIRECTLY 0x04000000 > #define NS_RULE_NODE_IS_IMPORTANT 0x08000000 > -#define NS_RULE_NODE_LEVEL_MASK 0xf0000000 > -#define NS_RULE_NODE_LEVEL_SHIFT 28 > +#define NS_RULE_NODE_LEVEL_MASK 0xe0000000 > +#define NS_RULE_NODE_LEVEL_SHIFT 24 Why these changes? They don't look right to me at all... In particular, changing the shift from 28 to 24 is just wrong and will lead to incorrect levels being gotten from rulenodes, as far as I can tell.
Attachment #8882066 - Flags: review?(bzbarsky) → review-
Flags: needinfo?(jaws)
Moving to p3 because no activity for at least 24 weeks.
Priority: P1 → P3

This should be fixed as of backplate landing, :dholbert do you know what the original STR for that screenshot in #c1 were?

Flags: needinfo?(dholbert)

I think this is still an issue, actually, though it doesn't look as bad as the original screenshots here. (But still kinda unusable.)

The STR are just to view & interact with the controls for any <video controls> element. A trivial reduced testcase (with no actual video data) is data:text/html,<video controls>. And some examples with actual video content are http://camendesign.com/code/video_for_everybody/test.html and https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video .

And the "Actual results" at this point (for me, in Linux nightly with high-contrast mode activated via about:preferences "Override the colors...: Always"):

  • the icons are all invisible unless hovered (play/pause, mute/unmute, fullscreen)
  • the slider tracks are invisible
  • the picture-in-picture overlay (which appears on the right side of video when I hover it) is white-on-lightgray
Flags: needinfo?(dholbert)
Attached image screenshot with yellow-on-black (deleted) —

(In reply to Daniel Holbert [:dholbert] from comment #22)

  • the icons are all invisible unless hovered (play/pause, mute/unmute, fullscreen)

Note: it looks like these icons are actually just always white (regardless of my chosen foreground/background colors), so they may or may not be visible depending on the background color.

I think these icons are SVG, so this might really end up depending on bug 1616916 (and could require some opt-in markup in the SVG, if opt-in is needed).

  • the slider tracks are invisible
  • the picture-in-picture overlay (which appears on the right side of video when I hover it) is white-on-lightgray

These ^^ issues still happen regardless of my choice of background color, FWIW.

Depends on: 1616916

The styling for these controls is e.g.

.playButton {
  background-image: url(chrome://global/skin/media/pauseButton.svg);
}

https://searchfox.org/mozilla-central/source/toolkit/themes/shared/media/videocontrols.css#168

You can take a look at the button itself (in isolation) by just directly visiting chrome://global/skin/media/pauseButton.svg , or you can see it in searchfox at
https://searchfox.org/mozilla-central/source/toolkit/themes/shared/media/pauseButton.svg

Its fill-color is set via fill="context-fill" in the SVG source, which uses a mozilla-internal way to pass in a custom possibly-browser-theme-controlled color from an external document to an embedded SVG document. (The outer document opts in to passing in the value by setting e.g. -moz-context-properties: fill; as you can see elsewhere in videocontrols.css, and the inner document opts in to using that value via the special color keyword context-fill. This only works for the svg-specific properties fill and stroke, as I recall, because we don't want it to become a generalized thing.)

Anyway, I say all that just to clarify how these icons are drawn right now. Ideally we should have them do whatever is necessary to honor the high-contrast requirements, via bug 1616916 or whatever other high-contrast-for-SVG work ends up happening.

Thanks for taking a look and adding all that info! :)

This patch gets us most of the way, but with this patch applied, the control bar icons color is always forced to ButtonText due to bug 1625036. With bug 1625036 fixed, everything should work fine.

Depends on: 1625043
Attachment #9135854 - Attachment is obsolete: true
Attached image video controls.png (deleted) —

HTML5 video from https://www.w3.org/2010/05/video/mediaevents.html doesn't display the progress bars (video and sound) on Windows 10 and HCM. This also reproduces on older Firefox versions, so not a recent regression. Please let me know if I should file a new bug for this.

Mac OSX 11.6 and Ubuntu 21.04 are not affected.

(In reply to Petruta Horea [:phorea] from comment #28)

Created attachment 9266227 [details]
video controls.png

HTML5 video from https://www.w3.org/2010/05/video/mediaevents.html doesn't display the progress bars (video and sound) on Windows 10 and HCM. This also reproduces on older Firefox versions, so not a recent regression. Please let me know if I should file a new bug for this.

Mac OSX 11.6 and Ubuntu 21.04 are not affected.

Yes, please file a new bug.

Flags: needinfo?(petruta.rasa)

Thank you!(In reply to :Gijs (he/him) from comment #29)

Yes, please file a new bug.

Thank you! I've created bug 1758081 for the mentioned issue.

Flags: needinfo?(petruta.rasa)

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

Hi Morgan - I'm no longer seeing any contrast problems with our native video controls on Windows 10 High Contrast Mode and Windows 11 High Contrast Themes. Do you think this issue can be closed?

Severity: -- → S2
Flags: needinfo?(mreschenberg)

Yep! Sounds good :)

Flags: needinfo?(mreschenberg)

Thanks! Closing this bug as resolved - fixed.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: