Open Bug 1692729 Opened 4 years ago Updated 4 years ago

Text gets weird subpixel-like colors on GitLab

Categories

(Core :: Graphics: Text, defect)

defect

Tracking

()

People

(Reporter: saschanaz, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

Attached image image.png (deleted) —
  1. Open https://gitlab.com/wg1/jpeg-xl/-/issues/new?issue%5Bassignee_id%5D=&issue%5Bmilestone_id%5D=
  2. Click the Title textbox

Expected: No visual change for the text
Actual: It gets weird glitch

This is on Windows 10, and it happens with or without WebRender.

:jfkthame, can you comment to the bug?

Flags: needinfo?(jfkthame)

It looks like the Gitlab theme being used adds a text-shadow to the input field when focused, and this renders really poorly in combination with subpixel antialiasing and the light-on-dark colors involved.

Do you see similar issues with all Gitlab themes, or is this specific to one of them?

Flags: needinfo?(jfkthame) → needinfo?(krosylight)
Attached image image.png (deleted) —

I think it also happens (but to a lesser extent) with the default light theme. (URL) See the new attachment where t and h gets red and blue lines. Chrome shows no visual change at all when clicked.

Flags: needinfo?(krosylight)

Oh, I can also confirm that this is a regression 👀

Regressed by: 1618639
Has Regression Range: --- → yes

They're using some Firefox-specific CSS rules such as

.form-control:-moz-focusring,
.search form:-moz-focusring {
 color:transparent;
 text-shadow:0 0 0 #fafafa
}

here, so it's not surprising behavior differs on Chrome.

FWIW, on macOS I see an apparent "thickening" of the text when focused, which I guess is the effect they're aiming for with the text-shadow, but it isn't using subpixel AA and there's no weird color effect. On Ubuntu, I do see a similar effect to the Windows issue although much less extreme; it's only clear that some ugly color fringing is happening if I enable magnification and look closely. This may be partly because I'm on a high-res screen where such artifacts are less obvious, but probably also because the subpixel AA there is much less intense than ClearType's.

(It does seem a bit surprising that they've gone to the trouble of including Firefox-specific CSS to implement this (questionable) effect, but don't seem to have anything comparable at all for Chrome -- they don't apply some different technique for "enhancing" the text of the focused control, just nothing.)

So this is an issue because we started unconditionally matching :-moz-focusring. Can we ask them to just remove that rule? It did nothing before.

This looks suspiciously close to the kind of workarounds people used to do to remove ::-moz-focus-inner ring on select, see bug 1580935. But that shouldn't be needed anymore.

An alternative for us would be to remove :-moz-focusring support, potentially, but that doesn't sound particularly risk-free.

Attached file simplified testcase (deleted) —

While it would help this particular case if we can get Gitlab to remove that styling, there's also the more general question of why we render the text so poorly here when these style rules are in effect.

One contributing factor seems to be that when the input element is focused, they apply opacity: 1 to the ::placeholder, which results in it switching from grayscale rendering to subpixel -- and hence liable to color fringing. With webrender and changing that opacity value to a bit less than 1.0, the text remains grayscale-only, which looks a little less weird. It still ends up rather blocky and ugly, however.

This simplified example has two <input>s with styling based on the gitlab case, but the second of them uses slightly-reduced opacity, so the difference can be seen. (Hover over each in turn, while looking closely at the text rendering.)

From the appearance of the grayscale hovered text in the second <input> here, it looks to me like when it is hovered (and so the text-shadow kicks in), we are losing track of the fact that the text is being drawn against a darker background. This shows up in that antialiasing pixels that should be darker than the nominal foreground color (i.e. partially blended with a dark background) suddenly become brighter instead, as if blended with a light background. Does our text-shadow painting just not know how to account for the background color?

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: