Jonas Jenwald
525be9afea
Use CSS nesting in the textLayer
2023-10-27 17:38:01 +02:00
Jonas Jenwald
4ebddcb092
Remove unnecessary alpha-value from CSS rgb
colors
...
Setting the alpha-value explicitly to `1` in `rgb` colors is unnecessary, since that's the default value, and this way we ever so slightly reduce the size of our CSS files.
Unfortunately I've not found a Stylelint rule to enforce this automatically, and the patch was generated using search and replace.
2023-10-06 09:50:03 +02:00
Jonas Jenwald
4277205d78
Enable some Stylelint color-related rules to slightly reduce file sizes
...
- Use a consistent format for all alpha-values (this rule didn't require any code changes); see https://stylelint.io/user-guide/rules/alpha-value-notation
- Use modern and slightly shorter color notation, since [according to MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#browser_compatibility ) that should be supported "everywhere" nowadays; see https://stylelint.io/user-guide/rules/color-function-notation/
- Use "short" hexadecimal colors whenever possible; see https://stylelint.io/user-guide/rules/color-hex-length/
- Help avoid adding broken hexadecimal colors (this rule didn't require any code changes); see https://stylelint.io/user-guide/rules/color-no-invalid-hex/
2023-10-05 17:51:21 +02:00
Jonas Jenwald
80e691d2ad
Enable the Stylelint declaration-block-no-duplicate-properties
rule (issue 16995)
...
Please refer to https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties
2023-09-21 13:42:05 +02:00
Jonas Jenwald
1b2b6910ac
Don't include Chrome-specific CSS rules in MOZCENTRAL builds
2023-04-20 14:14:33 +02:00
Jonas Jenwald
5cb99321d7
Introduce some :is
usage in the textLayer CSS
2023-04-18 11:39:09 +02:00
Jonas Jenwald
553c2e05cd
Introduce inset
usage in the CSS files
...
The `inset` property is a nice shorthand that can be used to avoid having to specify the positions individually; please see
- https://developer.mozilla.org/en-US/docs/Web/CSS/inset
- https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline
2023-03-19 14:32:37 +01:00
Jonas Jenwald
4b5817f8ff
Use consistent forced-colors
media-queries throughout the CSS files
...
Note how e.g. the `viewer.css` and `pdf_viewer.css` files already used this format.
2023-01-18 10:49:52 +01:00
Jonas Jenwald
67b1d15384
Use CSS variables for the textLayer highlight
colors (PR 15921 follow-up)
...
Rather than adding `@media (forced-colors: active) { ... }`-blocks throughout the CSS code, we should utilize CSS variables instead as in our other CSS files.
2023-01-18 10:42:22 +01:00
Fred Chasen
0a6b1cd2e9
Update highlight background color for forced colors
2023-01-13 14:35:12 -08:00
Calixte Denizet
c677b167b6
Set a z-index for the different layers within a page ( fixes #15861 )
...
Each layer has an absolute position, hence it induces the creation of
some stacking contexts (see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context ).
Thanks to this feature, we don't have to worry about the z-index used in
the annotation layer and how form elements interact with the other layers.
2022-12-26 22:55:08 +01:00
Calixte Denizet
eed9bf71c5
Refactor the text layer code in order to avoid to recompute it on each draw
...
The idea is just to resuse what we got on the first draw.
Now, we only update the scaleX of the different spans and the other values
are dependant of --scale-factor.
Move some properties in the CSS in order to avoid any updates in JS.
2022-12-01 18:42:43 +01:00
Calixte Denizet
68977ebc26
Use AccentColor as background for selected text in the text layer (bug 1790309)
...
and use the default color for the viewer in general.
2022-09-19 21:25:56 +02:00
Jonas Jenwald
fd6e2e2ab3
Avoid the textLayer
becoming visible in high contrast mode (issue 13230)
...
Unfortunately this CSS property is not yet available in Firefox, see https://developer.mozilla.org/en-US/docs/Web/CSS/forced-color-adjust#browser_compatibility which is tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1591210 , however this patch seems to work when testing in Google Chrome.
Given that we really cannot do any more on the PDF.js-side of things, until this CSS feature is actually implemented in Firefox, I figured that submitting this patch cannot hurt in order to get rid of an open issue.
2022-03-24 14:20:27 +01:00
Jonas Jenwald
13ef763222
[Google Chrome] Ensure that markedContent
spans are placed in the top-left corner (issue 14205)
...
*This is a tentative patch, since we unfortunately cannot easily test it (as far as I can tell).*
In Firefox this (obviously) works as-is, but in Google Chrome the `markedContent` spans are inserted within the regular text-content (in the DOM) and with non-zero heights.
2021-11-07 11:01:35 +01:00
Jonas Jenwald
12d41bcba4
Prevent mobile devices from interfering with the textLayer-elements (issue 14243)
...
*This is a tentative patch, since I don't have the necessary hardware to test it.*
See https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust , which is currently ignored in Firefox.
It seems overall safer, and more future-proof, to simply add this to the *entire* `textLayer` rather than its individual elements.
2021-11-06 11:39:43 +01:00
Rob Wu
1eeb153688
Visually hide br in text selections
...
Fixes #13840
2021-08-01 19:42:05 +02:00
Jonas Jenwald
daa563ae81
Correctly align the textLayer
content with horizontal/spread scrolling modes (issue 13605)
...
This is *very* similar to PR 12848, however for this `textLayer`-case it appears to only be an issue in documents with marked content.
2021-06-21 18:59:59 +02:00
Brendan Dahl
1da42e8b8e
Fix find highlighting regression from #13306 .
...
When we insert extra spans for highlighting we want
them to be positioned normally instead of absolute or
relative.
Fixes #13345 .
2021-06-01 15:25:40 -07:00
Jonas Jenwald
883ce5d120
Fix highlighting of search results when the textLayer
contains br
-elements (PR 13257 follow-up, issue 13323)
...
Apparently we need to layout `br`-elements in the same *exact* way as the regular `span`-elements which contain the text-content.
2021-05-02 15:36:01 +02:00
Brendan Dahl
d10da907da
Fix position of highlighted all text. ( #13306 )
...
Adds a new integration test to ensure we don't
regress this again.
2021-04-28 10:15:31 +02:00
Brendan Dahl
fc9501a637
Add support for basic structure tree for accessibility.
...
When a PDF is "marked" we now generate a separate DOM that represents
the structure tree from the PDF. This DOM is inserted into the <canvas>
element and allows screen readers to walk the tree and have more
information about headings, images, links, etc. To link the structure
tree DOM (which is empty) to the text layer aria-owns is used. This
required modifying the text layer creation so that marked items are
now tracked.
2021-04-09 09:56:28 -07:00
Jonas Jenwald
246a6f9d13
Enable the Stylelint length-zero-no-unit
rule
...
Note that these changes were done automatically, using `gulp lint --fix`.
With this rule, we'll thus enforce a *consistent* formatting of zero-lengths in our CSS files.
Please find additional details about the Stylelint rule at https://stylelint.io/user-guide/rules/length-zero-no-unit
2021-01-10 14:09:36 +01:00
Jonas Jenwald
8aa2718d22
Re-format all web/*.css
files using Stylelint/Prettier
...
This was done automatically, using `gulp lint --fix`.
2020-08-30 21:49:08 +02:00
Tim van der Meij
dd1c8a9149
Convert all RGB colors to RGBA colors
2020-01-01 14:48:55 +01:00
PalmerAL
5f15dc2023
Use span
instead of div
in the text layer
...
This improves copy/pasting text content since it reduces the amount of unnecessary newlines.
2018-11-18 15:54:08 +01:00
Wojciech Maj
dbb0e88bc1
Clean up browser-specific CSS
2018-04-04 00:25:12 +02:00
Tim van der Meij
a2cac8fa71
Use default line height for the text layer
...
Fixes #6614 .
2015-12-02 23:00:12 +01:00
Yury Delendik
b8ad68af25
Non/less flashing text layer during selection.
2015-11-05 10:48:22 -06:00
Yury Delendik
513a3d8c91
Replaces text selection example
2014-12-20 23:41:34 -06:00
Yury Delendik
70a0935737
Move text_layer_builder and pdf_viewer styles out
2014-09-30 10:48:29 -05:00