Closed Bug 1479760 Opened Last year Closed 5 months ago
Font Highlighter changes color when interacting with page
On initial use, the font highlighter highlights in grey. After interacting with the page, it highlights in the specified selection color. STR: 1. Visit any website 2. Inspect any text element and open the fonts panel 3. Hover over the font family name 4. Click anywhere on the page 5. Hover the font family name again ER: - the highlighter color should always be the selection color AR: - the highlighter color is grey in step 3, then changes in step 5 to the selection color (either specified by the system or CSS)
Rephrasing the ER: The highlighter color should be persistent.
The reason it does this is because we're using the window selection API to highlight text ranges. So the font highlighter basically creates actual text selections. Just like if you would select text yourself in a web page. This means that the selections are gray when the content window doesn't have focus. And they're whatever is your custom selection color when it windows does have focus. We could experiment with the CSS ::selection pseudo-element styling to see if we can make the color always be the same. If that doesn't work, the other solution is to remove our usage of the selection API and draw some rectangle on the screens. Some disadvantages though: - there may be many text runs, so many things to draw, which may have an impact on performance - we would have to calculate all of the text runs' coordinates ourselves and position everything correctly (page zoom, scrollable areas, iframes, etc. tend to make this complex, but doable) - if the text is CSS transformed, we'd have to support this too. Mind you, we do this for our other highlighters, so it's doable. But here we have a choice of using the selection API which makes our lives so much easier.
Assignee: nobody → jfkthame
Component: Inspector: Fonts → Layout: Text and Fonts
Product: DevTools → Core
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/59e4bc8fa1ba Use the ::selection colors to paint inactive as well as active selections. r=emilio
Attachment #9054483 - Attachment description: Bug 1479760 - Use the ::selection colors to paint inactive as well as active selections. → Bug 1479760 - Use the ::selection colors to paint inactive as well as active selections. r=emilio
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/73388d92a46f Use the ::selection colors to paint inactive as well as active selections. r=emilio
You need to log in before you can comment on or make changes to this bug.