Make the caret visible in the text layer in caret browsing mode

In order to do that we must change the text layer opacity to 1 but
it has several implications:
 - the selection color must have an alpha component,
 - the background color of the span used for highlighted words
   must have an alpha component either, but now the opacity is 1
   we can use some backdrop-filters in HCM making the highlighted
   words more visible.
 - fix a regression caused by #17196: the css variable --hcm-highlight-filter
   has to live under the #viewer element because in HCM it's overwritten
   by js at this level, hence links annotations for example didn't
   have the right colors when hovered.
This commit is contained in:
Calixte Denizet 2024-01-18 18:36:03 +01:00
parent 1cdbcfef82
commit 83c78dbfa8
7 changed files with 96 additions and 42 deletions

View file

@ -884,12 +884,23 @@ class PDFViewer {
this.viewer.style.setProperty(
"--hcm-highlight-filter",
pdfDocument.filterFactory.addHighlightHCMFilter(
"highlight",
"CanvasText",
"Canvas",
"HighlightText",
"Highlight"
)
);
this.viewer.style.setProperty(
"--hcm-highlight-selected-filter",
pdfDocument.filterFactory.addHighlightHCMFilter(
"highlight_selected",
"CanvasText",
"Canvas",
"HighlightText",
"ButtonText"
)
);
}
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {