Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ The release run heads these entries with the version and opens a fresh

## Unreleased

- **Fix**: selecting text in a pdf view hid the words it selected. The
`::selection` background v7.2.0 states is `Highlight`, which is opaque, and
the layer carrying it paints over the glyph layer. It is see-through now, so
the text reads through its own selection.

## v7.2.0 - 2026-09-20

- **Fix**: a pdf underline and squiggle were drawn through the text rather than
Expand Down
27 changes: 17 additions & 10 deletions src/odr/internal/html/pdf_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,9 +1819,12 @@ class HtmlServiceImpl final : public HtmlService {
out.out() << ".i{color:transparent;font-family:sf,sans-serif}";
// A selection paints text in the highlight's own colour, which beats
// `transparent` and shows this layer over the glyphs it stands for. An
// author `::selection` drops the UA background, so state that too.
out.out() << ".i::selection,.i *::selection"
"{color:transparent;background-color:Highlight}";
// author `::selection` drops the UA background, so state that too - and
// state it see-through, because this layer paints over the glyph one.
out.out()
<< ".i::selection,.i *::selection"
"{color:transparent;background-color:rgba(70,130,220,.32);"
"background-color:color-mix(in srgb,Highlight 45%,transparent)}";
// Selection-layer run span. `overflow:hidden` clips a wider system font;
// `.t`'s inherited `pre` blocks wrapping while preserving a run's own
// leading/trailing space, which is real PDF content.
Expand Down Expand Up @@ -2294,10 +2297,12 @@ class HtmlServiceImpl final : public HtmlService {
"color:transparent;vertical-align:baseline}";
// As `.i` in the dual layer above, with `*` reaching a run's own span
// and a search `mark`.
out.out() << ".i::selection,.i *::selection,"
".ov::selection,.ov *::selection,"
".sp::selection,.sp *::selection"
"{color:transparent;background-color:Highlight}";
out.out()
<< ".i::selection,.i *::selection,"
".ov::selection,.ov *::selection,"
".sp::selection,.sp *::selection"
"{color:transparent;background-color:rgba(70,130,220,.32);"
"background-color:color-mix(in srgb,Highlight 45%,transparent)}";
// A hit in the overlay is clipped away with it, so the glyphs it belongs
// to carry the highlight instead - the whole run of them, which is as
// narrow as the overlay can say.
Expand Down Expand Up @@ -2872,9 +2877,11 @@ class HtmlServiceImpl final : public HtmlService {
rule("fn", "color:transparent;");
// The same guard for a line the embedded font makes invisible; the dual
// layer's `fnN` rides a `user-select:none` run and needs none.
font_styles += ".fn" + n + "::selection,.fn" + n +
" *::selection"
"{color:transparent;background-color:Highlight}";
font_styles +=
".fn" + n + "::selection,.fn" + n +
" *::selection"
"{color:transparent;background-color:rgba(70,130,220,.32);"
"background-color:color-mix(in srgb,Highlight 45%,transparent)}";
}
}

Expand Down
Loading