Nico Weber
57e2b5ef59
LibPDF+Tests: Correctly decode text strings without explicit encoding
2023-11-22 09:08:06 -07:00
Nico Weber
8f47acee6a
LibTextCodec: Add PDFDocEncoding decoder
2023-11-22 09:08:06 -07:00
Nico Weber
e39a790c82
LibPDF: Stop converting encodings in object parser
...
Per 1.7 spec 3.8.1, there are multiple logical text string types:
* text strings
* ASCII strings
* byte strings
Text strings can be in UTF-16BE, PDFDocEncoding, or (since PDF 2.0)
UTF-8.
But byte strings shouldn't be converted but treated as binary
data.
This makes us no longer convert strings used for drawing page text.
TABLE 5.6 "Text-showing operators" lists the operands for text-showing
operators as just "string", not "text string" (even though these strings
confusingly are called "text strings" in the body text), so not doing
this there is correct (and matches other viewers).
We also no longer incorrectly convert strings used for cypto data
(such as passwords), if they start with an UTF-16BE or UTF-8 marker.
No behavior change for outlines and info dict entries.
https://pdfa.org/understanding-utf-8-in-pdf-2-0/ has a good overview of
this.
(ASCII strings only contain ASCII characters and behave the same
anyways.)
2023-11-22 09:08:06 -07:00
Nico Weber
8ee0c75f43
LibPDF: Add (automated!) test for outline encoding
...
Manually added an Outlines dict with three items, one each for
every text string encoding in its title.
(Preview.app apparently can't handle UTF-8 in outlines either.)
2023-11-22 09:08:06 -07:00
Nico Weber
d345c5b793
LibPDF: Add (automated!) test for info dict encoding
...
Manually added an info dict with the three text string encoding
methods to encoding.pdf.
(Preview.app apparently can't handle UTF-8 in info dicts!)
2023-11-22 09:08:06 -07:00
Nico Weber
65b895595a
LibPDF: Add an encoding test file
...
For now, this uses UTF-16BE and UTF-8 marked strings in page body text.
These markings should be ignored in body text.
Hand-written, with `set fenc=latin1` and `set binary` in vim, and
xref etc fixed up by running
mutool clean Tests/LibPDF/encoding.pdf Tests/LibPDF/encoding.pdf
as usual.
2023-11-22 09:08:06 -07:00
Nico Weber
4c6afd4763
Tests: Install recently added PDF test files
...
These aren't needed for any automated tests, but it's still nice to have
them in the OS for manual testing.
2023-11-22 09:08:06 -07:00
Nico Weber
14bcb5219d
LibPDF: Tolerate comments before drawing operators
...
Necessary to be able to render
https://github.com/pdf-association/pdf20examples/blob/master/pdf20-utf8-test.pdf
2023-11-22 08:56:43 +00:00
Nico Weber
9e8cf4fc1a
LibPDF: Tolerate comment after last dict item
...
Necessary to be able to open
https://github.com/pdf-association/pdf20examples/blob/master/pdf20-utf8-test.pdf
2023-11-22 08:56:43 +00:00
Nicole
7ca4e4a967
Base: Add some emojis
...
Adds:
U+1F390 fully-qualified # 🎐 E0.6 wind chime
U+1F54D fully-qualified # 🕍 E1.0 synagogue
U+1F54B fully-qualified # 🕋 E1.0 kaaba
U+1F95C fully-qualified # 🥜 E3.0 peanuts
U+1F3E6 fully-qualified # 🏦 E0.6 bank
U+1F690 fully-qualified # 🚐 E1.0 minibus
2023-11-22 08:52:58 +00:00
Sam Atkins
f69d38a346
LibWeb: Use ComponentValue::is_ident("..."sv) helper
2023-11-22 09:45:51 +01:00
Sam Atkins
6cd6186399
LibWeb: Don't assume grid size is always Function or Token
...
This stops `grid-template-columns: minmax({},{})` from crashing.
2023-11-22 09:45:51 +01:00
Sam Atkins
1a17b8a304
LibWeb: Don't assume grid-area parts are Tokens
...
This stops `grid-area: {}` from crashing.
2023-11-22 09:45:51 +01:00
Sam Atkins
ab9d39bf4a
LibWeb: Don't assume grid-row/grid-column parts are Tokens
...
This stops `grid-column: {}` from crashing.
2023-11-22 09:45:51 +01:00
Sam Atkins
314a30b12e
LibWeb: Don't assume grid-line parts are Tokens
...
This stops `grid-row-start: {}` from crashing.
Also tidy up the parsing code a little.
2023-11-22 09:45:51 +01:00
Sam Atkins
1f6e13d8fe
LibWeb: Don't assume repeat() contents are Tokens
...
This stops `grid-template-rows: repeat({})` from crashing.
2023-11-22 09:45:51 +01:00
Sam Atkins
5e54ff1858
LibWeb: Don't assume rect() contents are Tokens
...
This stops `clip: rect({});` from crashing.
2023-11-22 09:45:51 +01:00
Sam Atkins
aba2946b1e
LibWeb: Use ComponentValue::is_function("..."sv) helper
2023-11-22 09:45:51 +01:00
Xexxa
bd8b907f53
Base: Adjust emoji
...
🏂 - U+1F3C2 SNOWBOARDER
Reuse snow colour from U+1F3BF.
🍨 - U+1F368 ICE CREAM
Reuse ice cream colour from U+1F366.
🧨 - U+1F9E8 FIRECRACKER
Make the lit fuse reflect on the firecracker.
🤖 - U+1F916 ROBOT
🗑️ - U+1F5D1 WASTEBASKET
Make shadow more symmetrical.
💂 - U+1F482 GUARD
💂♂️ - U+1F482 U+200D U+2642 MAN GUARD
💂♀️ - U+1F482 U+200D U+2640 WOMAN GUARD
👸 - U+1F478 PRINCESS
Make colors more consistent with U+1F468_U+200D_U+1F9B1.
🐳 - U+1F433 SPOUTING WHALE
Reuse water colour from U+1F3C4_U+200D_U+2642, adjust foam color to
not be #FFFFFF.
🪿 - U+1FABF GOOSE
🍊 - U+1F34A TANGERINE
🍋 - U+1F34B LEMON
🍎 - U+1F34E RED APPLE
🍏 - U+1F34F GREEN APPLE
🎨 - U+1F3A8 ARTIST PALETTE
Add shadow.
🍐 - U+1F350 PEAR
Add shadow, remove unnecessary padding.
🕯️ - U+1F56F CANDLE
Make flame reflect on the candle, remove unnecessary padding.
🐣 - U+1F423 HATCHING CHICK
🍶 - U+1F376 SAKE
💺 - U+1F4BA SEAT
🖍️ - U+1F58D CRAYON
Remove unnecessary padding.
2023-11-21 20:16:06 -05:00
Aliaksandr Kalenik
d9990c6ea9
LibWeb: Remove opacity parameter for DrawScaledBitmap painting command
...
Every usage of this command specifies opacity equal to 1.
2023-11-21 17:00:56 +01:00
Aliaksandr Kalenik
a5cf875e23
LibWeb: Fix typo in FillEllipse painting command name
2023-11-21 17:00:56 +01:00
Aliaksandr Kalenik
790bfd7ef9
LibAccelGfx: Skip glyphs with missing bitmaps
...
Fixes crashing when we can't produce a bitmap for a glyph.
2023-11-21 17:00:56 +01:00
Aliaksandr Kalenik
48faa0e706
LibAccelGfx: Ensure capacity of vertices vector in draw_glyph_run()
2023-11-21 17:00:56 +01:00
Aliaksandr Kalenik
2471f07356
LibWeb: Skip painting of empty borders in GPU painter
2023-11-21 17:00:56 +01:00
Aliaksandr Kalenik
01058dac95
LibWeb: Skip execution of painting commands with empty bounding rect
2023-11-21 17:00:56 +01:00
implicitfield
00c1da8cbc
LibWeb: Support cellpadding
attribute on table
elements
2023-11-21 16:54:02 +01:00
implicitfield
3d1fbcb26b
LibWeb: Support valign
attribute on tr
elements
2023-11-21 16:54:02 +01:00
implicitfield
468b2a5ace
LibWeb: Support size
attribute on font
elements
2023-11-21 16:54:02 +01:00
implicitfield
5df52a5082
LibWeb: Use LibwebLeft and LibwebRight to align table cells
2023-11-21 16:54:02 +01:00
implicitfield
ccea69ad40
LibWeb: Add special handling for text-align when applied to tables
...
This matches what other engines do, and stops table content from being
misaligned.
2023-11-21 16:54:02 +01:00
implicitfield
a54e62bea0
LibWeb: Support align
attribute on table
elements
2023-11-21 16:54:02 +01:00
implicitfield
7a766bdb83
LibWeb: Respect the document's link_color for Linktext identifiers
2023-11-21 16:54:02 +01:00
Nico Weber
ec190baa55
MacPDF: Replace newlines with spaces in outline titles
...
Else, outline items that have newlines in them end up with a weird
vertical offset.
(This does affect the outline item's tooltip, which shows the whole
title. But not having a newline there seems alright, arguably
preferable.)
2023-11-21 10:07:41 +01:00
Nico Weber
e13954410a
MacPDF: Show tooltip with full title on elided outline titles
2023-11-21 10:07:41 +01:00
Nico Weber
fac0a456e6
MacPDF: Use correct encoding for outline titles
...
The title of an OutlineItem is already in UTF-8.
This is currently done in LibPDF's Parser::parse_string(). I think
that's not quite the right place (it shouldn't be done for all strings)
and not done quite right (text strings should convert from
PDFDocEncoding to UTF-8 unless prefixed by an UTF-8 BOM), but even if
that changes, I think we'll keep OutlineItem.title in UTF-8.
2023-11-21 10:07:41 +01:00
Sam Atkins
148f873321
LibWeb: Merge background-position parsing into position code
...
Implemented by adding the extra 3-value syntax as its own case and only
running it when parsing background-position. I'm sure it could be
implemented in a smarter way but this is still a bunch less code than
before. :^)
2023-11-21 01:29:26 +01:00
Sam Atkins
26d6ba6f58
LibWeb: Parse the CSS position type automatically
...
This means `object-position` will no longer incorrectly accept the
3-value background-position syntax.
Remove the now-ambiguous and unused `position` enum while we're at it.
(This enum only existed as a hack.)
2023-11-21 01:29:26 +01:00
Sam Atkins
19da17f07e
LibWeb: Allow calc() in CSS position values
2023-11-21 01:29:26 +01:00
Aliaksandr Kalenik
1b0cc67a28
LibAccelGfx+LibWeb: Add basic push/pop stacking context implementation
...
With basic PushStackingContext and PopStackingContext commands
implementation scrolling works again after changes being made in:
4e04f81626
2023-11-20 23:44:19 +01:00
Aliaksandr Kalenik
2579b01be8
LibAccelGfx: Add missing painter transform applications
...
Adds missing painter's transform to rect in:
- fill_rect_with_rounded_corners()
- fill_rect_with_linear_gradient()
- draw_glyph_run()
- set_clip_rect()
2023-11-20 23:44:19 +01:00
Andreas Kling
cc9de38ea4
LibWeb: Fix null pointer dereference in DOM::Node::remove()
...
Instead of blindly dereferencing m_registered_observer_list, just use
the add_registered_observer() helper.
Fixes #22005
2023-11-20 20:50:53 +01:00
Aliaksandr Kalenik
7320fdc1f5
LibWeb: Implement FillEllipse command for GPU executor
2023-11-20 20:08:41 +01:00
Aliaksandr Kalenik
53c015695e
LibAccelGfx+LibWeb: Implement rounded corners rectangle painting
...
For now corners antialiasing is missing.
2023-11-20 19:35:25 +01:00
david072
0e1bd54896
Shell/PosixParser: Correctly parse the OR_IF token
...
This fixes an unfortunate typo where we would parse the OR_IF token as
an AST::And node. Now, it is parsed into an AST::Or node :^).
2023-11-20 22:02:30 +03:30
Shannon Booth
c5d3ccca00
LibWeb: Port AriaData from DeprecatedString to String
2023-11-20 15:00:19 +01:00
Shannon Booth
6c42de3e8b
LibWeb: Port XMLSerializer from DeprecatedString to String
2023-11-20 15:00:19 +01:00
Shannon Booth
e28fb5c64c
LibWeb: Port Cookie from DeprecatedString to String
2023-11-20 15:00:19 +01:00
Shannon Booth
e3bc8610a9
LibWeb: Port HTMLInputElement from DeprecatedString to String
...
And dealing with the fallout of doing so. I am not 100% sure that it is
safe for us to be treating Strings in the value sanitization algorithm
in all cases as if they are ASCII, but this commit does not change any
existing behaviour there.
2023-11-20 15:00:19 +01:00
Shannon Booth
6c9fffc4c1
LibGfx: Add String variants of Color::to_string*()
2023-11-20 15:00:19 +01:00
Shannon Booth
6aff55d655
LibWeb: Port NavigatorID from DeprecatedString to String
2023-11-20 15:00:19 +01:00