[HCM] Avoid backplating whitespace?
Categories
(Core :: Layout, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: morgan, Assigned: nlapre)
Details
(Keywords: access)
Attachments
(2 files)
This is an issue with various google apps, and I'm not sure it's within our ability to fix but flagging here in case it is:
STR:
- Open a google sheet
- Enable HCM (about:preferences > manage colors > always)
- View the "share" button in the upper right corner of the sheet
Expected: The share icon and text is unobstructed
Actual: A rectangle partially obscures the button content
It looks like google is using a single space in the span that defines the share button, for some reason. And because it's technically text, we backplate it. Is there a way for us to not backplate content that is only whitespace without moving to a "backplate by word" model where we break on every space (which I don't think we should do)?
Reporter | ||
Comment 1•2 years ago
|
||
Reporter | ||
Comment 3•2 years ago
|
||
Taking this to save it for a new hire starting in August
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
•
|
||
Here's a minimal reproducer that doesn't require going through google apps (paste into the address bar to view):
data:text/html,<svg width="20" height="20"><circle cx="10" cy="10" r="10" fill="white" /></svg><span style="display:inline-block; position:relative; left:-10px;"> </span>
Importantly, the google apps are using
rather than a conventional space. This type of space just so happens to be excluded from the checks in nsTextFrame::IsEmpty
(which relies on IsAllWhitespace
, defined here). So, nsTextFrame::IsEmpty
sees
as non-whitespace. However, we don't even get that far in IsEmpty
; instead, we end up failing the check here and returning false before even reaching the invocation of IsAllWhitespace
. If you're curious, at the time of failure mState
is
NS_FRAME_SIMPLE_DISPLAYLIST | NS_STATE_IS_HORIZONTAL | NS_STATE_MENU_HAS_POPUP_LIST | NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK | NS_STATE_IS_DIRECTION_NORMAL | NS_STATE_FLEX_IS_EMULATING_LEGACY_BOX | TEXT_NO_RENDERED_GLYPHS
according to Visual Studio. It's unclear to me how that's failing, since the check is against TEXT_ISNOT_ONLY_WHITESPACE
, but there you have it.
Morgan suggested looking at the text node sitting in the text frame's mContent
and checking that whitespace manually, which works. I'm planning to push a changeset with that strategy for discussion soon.
Assignee | ||
Comment 5•2 years ago
|
||
Some sites use text content that consists entirely of whitespace, which can
lead to unexpected rendering in High Contrast Mode - namely, backplating of
invisible characters. This commit adds logic that detects text nodes consisting
entirely of whitespace and reports their text area as 0. This commit also adds
a test for the behavior, and modifies an existing test to reflect the new
behavior.
Comment 7•2 years ago
|
||
bugherder |
Updated•1 year ago
|
Description
•