1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-03 23:48:07 +03:00
Commit Graph

616 Commits

Author SHA1 Message Date
Michael Wedl
3c6696ed90 Fix named pages inheritence 2023-06-20 15:37:39 +02:00
kygoh
f55b82365c Create test case for table cell min-width ignored 2023-06-07 17:19:05 +00:00
kygoh
af141bac1e Fix coding style 2023-05-31 15:08:20 +00:00
kygoh
5976f6d530 Move collapse border test cases to layout 2023-05-31 14:53:25 +00:00
kygoh
16f8410435 Sync source with upstream 2023-05-31 09:25:20 +00:00
Guillaume Ayoub
0a03e3d1cf Use UTF8 indices instead of unicode indices for line split
Related to ietf-tools/datatracker#5507
2023-05-29 14:59:33 +02:00
kygoh
68f3486a63 Keep source updated 2023-05-26 11:41:24 +00:00
kygoh
fd1dbc7d63 Move collapsed-borders conflict resolution logic to layout.table module 2023-05-26 03:53:07 +00:00
kygoh
ecc794143b Add test case for table with border-collapse in page margins 2023-05-21 08:05:58 +00:00
Guillaume Ayoub
0381529724 Don’t crash when lines end with a soft hyphen
The removed code was not tested, and was probably not useful anymore.

This fix doesn’t fix the problem with soft hyphens put at the end of words.
These soft hyphens should not be replaced by real hyphens.

Fix #1878.
2023-05-21 09:54:54 +02:00
Guillaume Ayoub
67554a5ecc Use more transparency for text-decoration tests 2023-05-11 11:06:19 +02:00
Alexander Mankuta
94714f49ae
Drawn underline and overline behind text 2023-05-10 16:50:03 +03:00
Guillaume Ayoub
90981d2236 Clean PROPER_CHILDREN 2023-04-14 16:07:53 +02:00
Guillaume Ayoub
b45c4af784 Simplify _run calls in tests 2023-04-14 14:31:37 +02:00
Guillaume Ayoub
7bcfb14998 Use dictionary to store API options
This commit uses an "option" dictionary to store various API options that were
used as arguments in many public and private functions. This change allows to
easily document default values, to reduce the number of arguments and to avoid
many repetitions in documentation and signatures.

The changes to the public API are minimal, and should only have an impact for
users who passed unnamed arguments.
2023-04-13 19:34:22 +02:00
Guillaume Ayoub
6ff1b97f4c Remove font hinting information by default
Even if it can be an important feature for some users, the fact that nobody
ever complained means that it’s not useful for the majority of users. The
option is available but disabled by default.
2023-04-12 10:26:11 +02:00
Guillaume Ayoub
2358a01bc4 Add an option to disable hinting
Hinting is now enabled by default. Fix #1858.
2023-04-09 21:21:03 +02:00
Guillaume Ayoub
190a576cce Test cache folder option 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
6191d60951 Test DPI option 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
3a745c5be9 Add the --dpi option 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
eb6491f895 Add API controlling JPEG quality 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
51971f3293 Fix tests for attachments 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
5cdd751af1 Test new default compression values 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
fdbdfc150c Add API to compress generated PDF files
This feature compresses PDF streams (as it was already the case) and ask pydyf
to use a compact PDF structure with compressed object stream and
cross-reference object (for PDF version >=1.5).
2023-04-07 23:30:40 +02:00
Guillaume Ayoub
e49d955509 Make tests pass with pydyf 0.6.0 2023-04-07 23:30:40 +02:00
Guillaume Ayoub
c550a55014 Don’t crash when line can be split before trailing spaces
We normally don’t break lines before spaces, but some characters (such as line
separators) can force line breaks anywhere.

Fix #1852.
2023-04-07 08:42:19 +02:00
Lucie Anglade
a3e69e4416 Prefix date.
Fix #1843
2023-03-16 18:36:17 +01:00
Guillaume Ayoub
386901ae5f Fix word-spacing in complicated situations 2023-03-11 00:08:09 +01:00
Jonas Castro
aa28d5c177 Add test case for image absolute vertical positioning 2023-02-26 15:40:41 -03:00
Guillaume Ayoub
404b32ac72 Fix bookmarks coordinates
In version 57.x, we used to use two different functions to generate abstract
bookmarks (whose coordinates origin is the top-left corner) and PDF
bookmarks (whose coordinates origin is the bottom-left corner). Now that we
only use one function, Document.make_bookmark_tree, we have to give the scale
and the matrix parameters so that we can retrieve both depending on the
context.

Fix #1815.
2023-02-23 11:49:59 +01:00
Guillaume Ayoub
96c97d19f8 Fix background drawing for out-of-the-page transformed boxes
Fix #1809.
2023-02-16 11:57:31 +01:00
Guillaume Ayoub
dc7c2cb18c Don’t crash when fixed elements aren’t displayed yet in aborted line
Fix #1806.
2023-02-13 20:06:45 +01:00
Guillaume Ayoub
16cf66c807 Don’t crash when out-of-flow box is split in out-of-flow parent
This code is not handled correctly. This commit avoids the crash, but it
doesn’t give a correct result. We have two different problems to solve:

- floats in floats are broken;
- split out-of-flow elements in split out-of-flow elements are broken.

Fix #1807 (but doesn’t give the right result).
2023-02-10 22:25:02 +01:00
Guillaume Ayoub
e29fa36e24 Test PDF forms 2023-01-24 11:41:35 +01:00
Guillaume Ayoub
281fecfcf2 Make FakeHTML reuse the parent’s function to get UA stylesheets
It’s more robust and may continue to work even if the parent function changes
again.
2023-01-24 11:41:23 +01:00
Guillaume Ayoub
b803f47599 Fix _ua_stylesheets monkey-patching for tests 2023-01-23 13:35:14 +01:00
Guillaume Ayoub
0b1617edc8 Reorganize anchors management 2023-01-23 11:27:44 +01:00
Guillaume Ayoub
79e84dadff Don’t use HTML handlers when they’re not required
Let’s use them only when we have to change the box children or handle replaced
boxes.
2023-01-10 16:39:38 +01:00
Guillaume Ayoub
9a381f0829 Keep absolute URIs for URIs starting with base URI without fragment
Fix #1767.
2022-12-02 16:13:27 +01:00
Guillaume Ayoub
88dc3df4aa Fix and test repeating linear gradients 2022-12-02 15:31:16 +01:00
Guillaume Ayoub
c4c23fca73 More fixes around SVG gradients 2022-11-18 22:59:56 +01:00
Guillaume Ayoub
1e6424d54c Fix SVG namespace everywhere
Looks like the http-to-https sed was a bit too hungry…
2022-11-14 23:26:16 +01:00
Guillaume Ayoub
a843257e54 Improve tests and fix code for SVG gradients 2022-11-14 23:24:24 +01:00
Guillaume Ayoub
a7f46b272c Fix tests 2022-11-14 13:27:30 +01:00
Guillaume Ayoub
0625bf7256 Fix repeating radial gradients in SVG 2022-11-14 10:35:47 +01:00
Guillaume Ayoub
e2b30af70b Fix and clean many linear gradients in SVG 2022-11-14 09:39:50 +01:00
Guillaume Ayoub
df97154331 Fix linear gradients transform matrix 2022-11-13 17:47:30 +01:00
Guillaume Ayoub
2b94b922f9 Handle inheritance for defined elements 2022-11-13 12:25:00 +01:00
Guillaume Ayoub
632be52c01 Keep format when transposing images
Fix #1755.
2022-10-27 15:07:15 +02:00
Guillaume Ayoub
cb870ae4d4 Correctly set target counters in pages’ absolute elements
Fix #1747.
2022-10-24 15:17:08 +02:00
Guillaume Ayoub
71e9e257cc Always set font size when font is changed in line
In setting the font size also sets the font family, and that’s useful when we
have different fonts in the same text block. It happens for example when
characters are missing from a font and are replaced by a fallback font’s
character.

Fix #1748.
2022-10-21 22:29:00 +02:00
Guillaume Ayoub
8c8d059052 Don’t crash when currentColor is set on root svg tag
Fix #1740.
2022-10-15 16:19:37 +02:00
Guillaume Ayoub
ab914a52d3 Fix and test corner cases about white spaces and running elements 2022-10-09 20:11:20 +02:00
Guillaume Ayoub
4185ad3409 Don’t remove attachments when adding internal anchors
Fix #1733.
2022-10-04 11:16:33 +02:00
Guillaume Ayoub
ad5222b65f Remove useless import 2022-10-03 17:10:01 +02:00
Guillaume Ayoub
709184b7d9 Remove print 2022-10-01 11:34:05 +02:00
Guillaume Ayoub
4f7c3cfa1d Unmark tests for gradients 2022-09-30 18:47:36 +02:00
Guillaume Ayoub
028ec78ccc Clean Ghostscript error 2022-09-27 11:23:09 +02:00
Guillaume Ayoub
c7265f5bc2 Improve coverage and fix gradient painting 2022-09-27 10:59:31 +02:00
Guillaume Ayoub
7d2913ccad Improve coverage 2022-09-26 17:25:29 +02:00
Guillaume Ayoub
cecad07166 Improve test coverage 2022-09-24 06:31:03 +02:00
Guillaume Ayoub
a4fc7a11a9 Handle image-orientation 2022-09-23 15:44:16 +02:00
Guillaume Ayoub
58c5f29925 Allow the skew() function to take only one parameter
Fix #1722.
2022-09-22 10:26:23 +02:00
Guillaume Ayoub
6fb4c08e49 Fix top-margin of out-of-flow elements at the top of pages
We were already trying to get the correct top margin of the child, but we
didn’t include subtleties introduced by unforced page breaks. The logic is
still duplicated, it already was, but at least now the copy-paste is correctly
done.

Fix #1058.
2022-09-21 18:17:46 +02:00
Guillaume Ayoub
c274f9fb54
Merge pull request #1704 from Kozea/pdf-ua
Support PDF/UA
2022-09-17 00:05:34 +02:00
Guillaume Ayoub
450cbd430f Add tests for footnotes in columns 2022-09-15 13:55:05 +02:00
Guillaume Ayoub
cf67b267ea Display sizes when drawing tests fail 2022-09-13 12:11:06 +02:00
Guillaume Ayoub
b99dc71cb5 Rename test file for footnotes 2022-09-13 12:04:10 +02:00
Guillaume Ayoub
738a1679be Fix corner-case test
As explained in the comment, the rendering here is not defined. At least now we
display all the footnotes…
2022-09-13 09:12:05 +02:00
Guillaume Ayoub
9e1bf174ff Cut too long lines 2022-09-06 10:02:25 +02:00
Guillaume Ayoub
9ab4623a58 Go through the variable resolution for special inheritance cases
Fix #1697.
2022-08-29 23:16:23 +02:00
Guillaume Ayoub
3fca521d67 Merge branch 'master' into pdf-ua 2022-08-18 15:58:57 +02:00
Guillaume Ayoub
67cd41a9dd
Merge pull request #1695 from lutrasecurity/lang
Add language information to PDF
2022-08-18 15:58:29 +02:00
Guillaume Ayoub
9a4c5fc3c9 Fix the way column rules are drawn 2022-08-18 15:22:45 +02:00
Guillaume Ayoub
e9c45c7060 Clean and test "text-transform: capitalize"
Related to #1703.
2022-08-15 16:08:06 +02:00
Guillaume Ayoub
c64eec81cc Correctly detect reported footnotes for repagination
Fix #1700.
2022-08-15 12:26:06 +02:00
Konstantin Weddige
42db8bdb03 Update tests 2022-07-22 12:22:22 +02:00
Guillaume Ayoub
86a6597e61 Don’t store or test download names anymore
They’re actually not used at all.
2022-07-21 11:44:54 +02:00
Guillaume Ayoub
5c91673b9d Add failing test for broken nested counters
Related to #1685.
2022-07-18 11:07:15 +02:00
Guillaume Ayoub
0a21cf9ffe Merge branch '56.x' 2022-07-13 22:48:06 +02:00
Guillaume Ayoub
adec43adc4 Fix code and tests for max-height set on footnotes
The bug in the code was caused by the page_is_empty variable. It’s useless to
test this variable here because we know that we rendered at least the current
line. It’s not updated earlier, but if it were it would always be True.

This commit also fixes minor bugs in the tests.

Fix #1674.
2022-07-13 22:45:26 +02:00
Lucie Anglade
8f5bee1d51 Some tests for max-height on footnote area.
Related to #1674.
2022-07-13 22:10:12 +02:00
Guillaume Ayoub
91a2474400 Fix OTB test on Fedora
The metrics and floats roundings seems to be slightly different on different
platforms. Using a lower line-height value should fix the problem everywhere.

Fix #1677.
2022-07-13 10:23:57 +02:00
Guillaume Ayoub
11bc920910 Merge branch '56.x' 2022-07-10 20:38:07 +02:00
Guillaume Ayoub
f2cecc78ea Fix gradients with opacity set
Fix #1678.
2022-07-10 20:37:33 +02:00
Guillaume Ayoub
99b6d301da Merge branch '56.x' 2022-07-07 17:26:13 +02:00
Guillaume Ayoub
9ce65478b2 Fix default vertical position of out-of-flow split elements
Fix #1673.
2022-07-07 17:18:12 +02:00
Guillaume Ayoub
76d174f578 Fix split table headers’ top border when rows are split 2022-07-07 15:43:51 +02:00
Guillaume Ayoub
cb9540ba3b Correctly detect empty split lines at the end of tables
The previous detection was failing when some cells were empty (or fully
rendered) and when the current rendering position was not overflowing the page.
In this case, the line with empty cells was rendered and was visible for
example when cells had padding.
2022-07-07 10:45:24 +02:00
Guillaume Ayoub
c028c672d7 Merge branch '56.x' 2022-07-05 16:14:17 +02:00
Guillaume Ayoub
3bd9a8e014 Don’t limit the opacity groups to the original box size
It doesn’t work when elements are displayed outside or when the box is
transformed.
2022-07-05 16:06:46 +02:00
Guillaume Ayoub
2484ca2cc7 Rotate images with EXIF rotation
Fix #1667.
2022-07-02 15:01:16 +02:00
Guillaume Ayoub
bcf40367d7 Merge branch '56.x' 2022-07-01 09:43:09 +02:00
Guillaume Ayoub
1a4d2a70ef Fix and test nth selector for pages
Fix #1668.
2022-07-01 09:42:24 +02:00
Guillaume Ayoub
5feaf5e084 Fix and add failing test
We still have a lot of corner cases to fix for floats, judging from the number
of xfail tests in this file…
2022-06-30 16:12:02 +02:00
Guillaume Ayoub
902bde7d9c Take care of floats when removing placeholders
Removing placeholders is something we have to do when we must discard a part of
the layout that has already been done. It currently removes absolutely
positioned placeholders and footnotes.

The same has to be done with split floats, that’s what this commit is about.

We have to change the structure of the broken_out_of_flow attribute, as we have
to get a reliable way to reach the saved data using from the real element in
the tree. The new structure is thus a dictionary whose keys are the boxes in
the tree (placeholder for absolutes, partial elements for floats) and whose
values are the original_box+parent+resume_at.

Fix #1669.
2022-06-30 15:29:50 +02:00
Guillaume Ayoub
74f367c2a3 Merge branch '56.x' 2022-06-29 19:06:58 +02:00
Guillaume Ayoub
00d5b03587 Don’t break reproducible PDF creation when using images
Fix #1666.

Note that the added test doesn’t test this problem, because the "hash" function
is stable when we use the same process. If someone finds a nice way to solve
this…
2022-06-29 19:03:58 +02:00
Guillaume Ayoub
5d9e5f7040 Update and fix URLs in comments and documentation 2022-06-28 15:59:06 +02:00
Guillaume Ayoub
c031a40439
Merge pull request #1660 from Kozea/line-clamp
Support nested line-clamp
2022-06-17 10:09:38 +02:00
Guillaume Ayoub
d8533dad9c
Merge pull request #1644 from Kozea/bitmap-fonts
Bitmap fonts
2022-06-17 10:08:49 +02:00
Guillaume Ayoub
e38bff8b99 Don’t crash when inherited SVG attributes are not set on the parent 2022-06-17 10:07:28 +02:00
Guillaume Ayoub
eadd5c0c7b Remove xfail for passing tests about opacity 2022-06-16 17:23:09 +02:00
Guillaume Ayoub
d3883c4428 Test nested line-clamp 2022-06-13 16:36:05 +02:00
Guillaume Ayoub
191e015f89 Test bitmap fonts 2022-06-13 16:23:44 +02:00
Guillaume Ayoub
358b9469bf
Merge pull request #1651 from Kozea/pdfa
Support PDF/A
2022-06-13 14:52:12 +02:00
Guillaume Ayoub
04e1ff2f7a Fix chained variables in the same selector block
As a side effect, fix also the case when a variable is missing in the root
element.

Fix #1656.
2022-06-10 20:10:33 +02:00
Guillaume Ayoub
e4885f9cff Don’t crash when @font-face’s src ends with a comma
That was the only @comma_separated_list function to assume "tokens" is not
empty.

Fix #1653.
2022-06-01 16:59:30 +02:00
Guillaume Ayoub
3211163f8c Add and fix tests for custom metadata 2022-05-27 11:26:24 +02:00
Guillaume Ayoub
bff1dd5b22 Add option to set PDF version
Related to #1131.
2022-05-27 11:26:24 +02:00
Guillaume Ayoub
ed84e5a8ea Test PDF/A 2022-05-27 11:26:24 +02:00
Guillaume Ayoub
09364c254e Refactor PDF generation 2022-05-27 11:26:15 +02:00
Guillaume Ayoub
e212c83b50 Remove useless parameters from testing utils 2022-05-23 23:09:32 +02:00
Guillaume Ayoub
a001af7c33 Remove useless parameters from tests helpers 2022-05-23 12:01:11 +02:00
Guillaume Ayoub
56b79ba375 Fix test name 2022-05-23 09:55:13 +02:00
Guillaume Ayoub
6ade02b234 Use f-strings when possible 2022-05-17 16:40:30 +02:00
Guillaume Ayoub
1545a45092 Merge branch '55.x' 2022-05-10 14:34:25 +02:00
Guillaume Ayoub
50ad4d1ac0 Fix relative paths for SVG files stored as data URLs
Fix #1641.
2022-05-10 14:31:25 +02:00
Guillaume Ayoub
96f26504ce Use the original box when breaking waiting children
Before this commit, when we had to break previously rendered waiting children
in a line, we re-rendered the already-rendered children. That was bad, because
the tree of the children that were already rendered were different from the
original tree, that may include leading spaces for example. It also required a
complex mix of the original resume-at with the original skip-stack.

This new solution includes both the original child (to render it from a fresh
start) and the already-rendered child (to get the previous positions). The
skip-stack mix is now useless, removing a lot of complex code.

This change is scary and will probably break some corner cases. But tests pass,
and a new one has been added to avoid future regressions.

Fix #1638.
2022-05-09 22:39:31 +02:00
Guillaume Ayoub
c53528753b Merge branch '55.x' 2022-05-05 16:29:26 +02:00
Guillaume Ayoub
bc4053510a Fix absolute position for rtl
Fix #1637. Related to #1613.
2022-05-05 16:28:55 +02:00
Guillaume Ayoub
a4d52533ec Add and improve tests for the "html" module 2022-05-05 15:47:43 +02:00
Guillaume Ayoub
733815c96b Test invalid images 2022-05-04 16:01:40 +02:00
Guillaume Ayoub
491503c482 Handle "footnote-policy: auto" footnotes correctly 2022-05-03 09:48:17 +02:00
Guillaume Ayoub
eb489e5847 Minor cleanups 2022-05-03 09:33:14 +02:00
Guillaume Ayoub
7fe5e43a2d Minor cleanups 2022-05-02 22:34:51 +02:00
aschmitz
2f207d13ab fix: sequential footnotes could disappear when overflowing
Previously, if a footnote triggered an overflow (that is, it was too
large for the containing space), but footnote-policy didn't make us push
down the line containing it, any subsequent footnotes in the same
linebox would not be set into a footnote area, because they would never
be passed to layout_footnote and report_footnote. (Their call sites
would be set, but their content would not be.)

This also fixes a potential infinite loop where using footnote-policy
could have forced the first line of a page to be pushed to the next
page: that will just result in an infinite loop, so instead we set the
line and move on if we are on the first line of a page. (This behavior
is not specified in GCPM, but no other behavior seems practical: the
only alternative would be to expand the page, which is almost certainly
less desirable.)
2022-05-02 21:50:31 +02:00
aschmitz
29bd8f932f fix: sequential footnotes could disappear when overflowing
Previously, if a footnote triggered an overflow (that is, it was too
large for the containing space), but footnote-policy didn't make us push
down the line containing it, any subsequent footnotes in the same
linebox would not be set into a footnote area, because they would never
be passed to layout_footnote and report_footnote. (Their call sites
would be set, but their content would not be.)

This also fixes a potential infinite loop where using footnote-policy
could have forced the first line of a page to be pushed to the next
page: that will just result in an infinite loop, so instead we set the
line and move on if we are on the first line of a page. (This behavior
is not specified in GCPM, but no other behavior seems practical: the
only alternative would be to expand the page, which is almost certainly
less desirable.)
2022-05-02 14:27:51 -05:00
Guillaume Ayoub
aa348dabe7 Add failing test about floats
Related to #1629.
2022-04-28 16:48:46 +02:00
Guillaume Ayoub
bc1770f97b Rename tests 2022-04-28 16:48:46 +02:00
Lucie Anglade
185ea5380f Make test pass indenpently of default font size 2022-04-28 12:12:09 +02:00
Guillaume Ayoub
67075b4c46 Merge branch '55.x' 2022-04-25 23:43:37 +02:00
Guillaume Ayoub
3ad6982f4e Fix available height for absolute boxes with "bottom" property set
Fix #1626.
2022-04-25 23:42:36 +02:00
Guillaume Ayoub
3802f8857a Fix the y position of split absolute boxes 2022-04-25 23:42:24 +02:00
Guillaume Ayoub
2a8ca143c0 Revert and test "Remove useless condition"
This reverts commit 34944e06c4.
2022-04-25 19:07:33 +02:00
Guillaume Ayoub
e5e6b88203 Reset the bottom space even when we don’t fill the columns 2022-04-25 19:07:23 +02:00
Guillaume Ayoub
964109867f Stop rendering when column content doesn’t fit in the page 2022-04-25 19:07:13 +02:00
Guillaume Ayoub
f5b970eb26 Revert and test "Remove useless condition"
This reverts commit 34944e06c4.
2022-04-25 19:05:53 +02:00
Guillaume Ayoub
e1de59af96 Reset the bottom space even when we don’t fill the columns 2022-04-25 18:30:27 +02:00
Guillaume Ayoub
6bd5a59a04 Stop rendering when column content doesn’t fit in the page 2022-04-25 18:26:04 +02:00
Guillaume Ayoub
1e4fde4ee0 Clean font management 2022-04-19 00:01:50 +02:00
Guillaume Ayoub
709255bc44 Test overconstrained relative blocks 2022-04-18 14:43:22 +02:00
Guillaume Ayoub
1b8ba2c3ab Test string(…, start) 2022-04-18 13:08:32 +02:00
Guillaume Ayoub
ee19c6af9c Test break-before: page on root boxes 2022-04-18 12:51:21 +02:00
Guillaume Ayoub
c2b2457f54 Test reset page counters 2022-04-18 12:06:36 +02:00
Guillaume Ayoub
a869831740 Add drawing tests 2022-04-18 11:48:35 +02:00
Guillaume Ayoub
aa4df152e9 Remove more and more white backgrounds 2022-04-17 09:32:15 +02:00
Guillaume Ayoub
d4f3fcfd71 Clean, fix and test backgrounds 2022-04-17 09:22:13 +02:00
Guillaume Ayoub
ae8f3b4cc8 Clean expanders tests and code 2022-04-17 07:34:03 +02:00
Guillaume Ayoub
1cb02f03b5 Add tests for CSS prefixes 2022-04-16 15:49:14 +02:00
Guillaume Ayoub
f3763b8bfa Remove useless white backgrounds from tests 2022-04-16 13:54:07 +02:00
Guillaume Ayoub
20f8924dda Test border radius 2022-04-16 13:47:14 +02:00
Guillaume Ayoub
3ccbc8f077 Add more tests for leaders 2022-04-16 12:27:57 +02:00
Guillaume Ayoub
e544398b00 Mark tests as failing because of Ghostscript
See https://bugs.ghostscript.com/show_bug.cgi?id=705225.
2022-04-15 15:47:05 +02:00
Guillaume Ayoub
2e726a3965 Don’t generate PDF with 0-scale transformation matrices for text 2022-04-15 14:53:19 +02:00
Guillaume Ayoub
d49f93fcd2 Test skew for links 2022-04-15 12:19:42 +02:00
Guillaume Ayoub
e06e829b5d Try hard to follow break-inside: avoid-column 2022-04-13 23:03:50 +02:00
Guillaume Ayoub
79f7677a43 Fix test
Even if there are many unsupported cases, this one was a real bug in the test.

Related to #1621.
2022-04-13 10:21:19 +02:00
Guillaume Ayoub
af9a495177 Improve inheritance of text-decoration-* properties
The text-decoration-* properties are not inherited anymore, they are propagated
according to specific rules.

This commit removes the inheritance, but it doesn’t follow all the rules
defined by the specification. The new behavior is not perfect, but it should be
at least better than the previous code and opens the possibility to fix this
issue correctly in the future.

Failing tests have been added.

Fix #1621.
2022-04-13 09:39:09 +02:00
Guillaume Ayoub
20c91dcef5 Fix multiple text decorations drawing
Fix #1621.
2022-04-12 14:59:13 +02:00
Guillaume Ayoub
6ba031e8c7 Fix skip stacks for columns
Fix #984, fix #1604.
2022-04-09 08:51:51 +02:00
Guillaume Ayoub
eb997d1573 Draw borders around absolute images
Fix #1093.
2022-04-05 12:37:20 +02:00
Guillaume Ayoub
56f0d4adb0 Deactivate orphans and widows for tests
The default "2" value for orphans and widows is really useful for real
documents, but it can be very disturbing for tests and introduce false
negatives and false positives.
2022-04-03 16:42:11 +02:00
Guillaume Ayoub
04b0f45e50
Merge pull request #1619 from Kozea/break-column
Initial support of column breaks
2022-04-03 15:54:18 +02:00
Guillaume Ayoub
48f784e718 Add and improve tests for breaks in columns 2022-04-03 13:41:23 +02:00
Guillaume Ayoub
9e1b1560af Add missing asserts in tests 2022-04-02 18:54:23 +02:00
Guillaume Ayoub
3f3956844a Test SVG transforms 2022-03-27 22:26:53 +02:00
Guillaume Ayoub
ea50bc578a Add one SVG marker test 2022-03-27 21:46:43 +02:00
Guillaume Ayoub
7fd7413aa2 Test (and fix) SVG markers 2022-03-27 19:57:02 +02:00
Guillaume Ayoub
fe1f3d9e98 Fix and test broken absolutes in lines 2022-03-25 21:37:44 +01:00
Guillaume Ayoub
089ffa4480 Add tests for absolutes 2022-03-25 15:27:58 +01:00
Guillaume Ayoub
f39c5ab4b0 Add an improve tests for SVG 2022-03-25 15:20:22 +01:00
Guillaume Ayoub
0792c0d3a3 Clean docstrings in modules 2022-03-25 11:47:27 +01:00
Guillaume Ayoub
2f8d4999d7
Merge pull request #1613 from Kozea/fix_1512
ltr for absolute boxes
2022-03-24 18:10:59 +01:00
Lucie Anglade
b33cb3f26d Add some tests 2022-03-23 18:26:47 +01:00
aschmitz
ad6e0d729f perf: improve column handling speed, fix infinite loops
The primary change here is that the column calculation algorithm now
attempts to render columns as if they were the full remaining height on
the page, rather than to render the entire content regardless of how
long the page is.

The worst-case behavior is effectively the same as that of the previous
algorithm (as at least one additional pass would be required to
determine how high balanced columns should be, but this applies in both
cases), but if content would not fit on the page, this can bail and set
the page immediately, rather than continuing significantly more
calculations.

As an associated benefit, this closes #1020, as we now handle multiple
column breaks (which would force a page break) correctly. A test for
this behavior is included.
2022-03-17 00:32:02 -05:00
Guillaume Ayoub
ea558e8b63
Merge pull request #1588 from aschmitz/absolutes-in-footnotes
fix: support position: absolute in footnotes
2022-03-07 16:02:27 +01:00
aschmitz
e7397c8b50 fix: support position: absolute in footnotes
Previously, this would throw an error because absolute_layout hadn't had
a chance to lay out the boxes. Now we do the block level layout for
footnotes *before* doing layout for absolute boxes (or fixed boxes) and
add any positioned boxes to positioned_boxes so they can be put onto the
page correctly.
2022-03-03 22:10:21 -06:00
Guillaume Ayoub
7034d67e07 Merge branch '54.x' 2022-03-02 21:07:31 +01:00
Guillaume Ayoub
c1178a559c Fix (and test) discarded text-align values
Fix #1586.
2022-03-02 20:57:26 +01:00
Guillaume Ayoub
a969ec1c64
Merge pull request #1570 from aschmitz/fix-repeat-unlayout
fix: more robustly handle unlayout'ing a footnote
2022-02-26 09:00:19 +01:00
aschmitz
9b0a672acd fix: handle float rounding when extending boxes over page breaks
When a box would break over the edge of a page, its height is extended
to the bottom of that page (per
https://www.w3.org/TR/css-break-3/#box-splitting , primarily to allow
backgrounds and borders to continue to the end of the page).

When this happened, sometimes the values that would be calculated for
the height of the extended element would be rounded *over* the
calculated height that remained on the page, forcing the entire
containing box to wrap to the next page.

Rather than trying to carefully manage the order of operations to try to
be safe in IEEE floats for directions, we apply a small "fudge factor":
if an element fits very nearly (within a thousandth of a pixel) into the
remaining space, it is still accepted.
2022-02-20 14:42:48 +01:00
aschmitz
1d7ddfdf38 fix: more robustly handle unlayout'ing a footnote
This fixes a bug accidentally introduced in #1566, where we would try to
unlayout a footnote that had not yet been laid out, if the algorithm
decided that there would be insufficient space on a page before laying
out a further footnote.
2022-02-14 17:51:28 -06:00
Guillaume Ayoub
cf0622128a Use the default value of decode/encode when possible 2022-02-14 10:55:47 +01:00
Guillaume Ayoub
0a6f86945b Don’t remove soft hyphens before drawing text 2022-02-14 08:55:09 +01:00
Guillaume Ayoub
c9871cf7fb Remove useless dels 2022-02-14 08:15:55 +01:00
aschmitz
f953fb8de0 fix: don't output footnotes before their call sites
If a footnote has been output but we then decide to cancel the line it
was output on, we should cancel the output of the footnote itself.

This requires a bit of extra bookkeeping, so we know which footnotes are
relevant, but otherwise largely works using the existing
remove_placeholders code.

Includes a minor refactor of footnote area management in LayoutContext,
and a new testing utility: `tree_position`.

Closes #1564.
2022-02-10 01:02:21 -06:00
Guillaume Ayoub
9003fd0490 Use utf-8 instead of utf8 2022-02-08 22:41:03 +01:00
Guillaume Ayoub
c3c5f08e91 Merge branch '54.x' 2022-02-08 12:19:41 +01:00
Guillaume Ayoub
562a2499a1 Fix line break when breaks occur between a nbsp and an inline block
This commit:

- fixes the trailing space detection, by handling all trailing spacing
  characters that could be ignored by Pango’s line break algorithm;
- tries harder to break waiting children when a line break occurs in an
  inline block that can’t be separated from the previous one.

Fix #1562.
2022-02-08 12:16:10 +01:00
aschmitz
7f8545c560 fix: handle float rounding when extending boxes over page breaks
When a box would break over the edge of a page, its height is extended
to the bottom of that page (per
https://www.w3.org/TR/css-break-3/#box-splitting , primarily to allow
backgrounds and borders to continue to the end of the page).

When this happened, sometimes the values that would be calculated for
the height of the extended element would be rounded *over* the
calculated height that remained on the page, forcing the entire
containing box to wrap to the next page.

Rather than trying to carefully manage the order of operations to try to
be safe in IEEE floats for directions, we apply a small "fudge factor":
if an element fits very nearly (within a thousandth of a pixel) into the
remaining space, it is still accepted.
2022-02-01 18:13:39 -06:00
Guillaume Ayoub
7108a16f87 Add a test about text rotation
Related to #1554.
2022-01-30 14:30:57 +01:00
Guillaume Ayoub
8d19ab4157 Merge branch '54.x' 2022-01-25 15:58:36 +01:00
Guillaume Ayoub
563ee6f98c Handle break-inside: avoid in tr
Fix #1547.
2022-01-25 15:57:58 +01:00
Guillaume Ayoub
4f434343ba Avoid infinite loops with td with break-inside: avoid
Related to #1547.
2022-01-25 12:35:59 +01:00
Guillaume Ayoub
476a8f593b Uncomment passing test 2022-01-24 21:32:33 +01:00
Guillaume Ayoub
51f8a0dc52 Merge branch '54.x' 2022-01-24 16:14:25 +01:00
Guillaume Ayoub
0ae65b8297 Layout positioned boxes in page margins
Fix #1540.
2022-01-24 16:11:18 +01:00
Guillaume Ayoub
d06ad070d5
Merge pull request #1534 from aschmitz/wrap-improvements
Fix `overflow-wrap`, support `word-break: break-all`
2022-01-16 09:31:18 +01:00
Lucie Anglade
cd8a4637aa Related to #1540.
Regression test
2022-01-14 15:26:03 +01:00
Lucie Anglade
f8c9747962 Don’t crash when running elements aren’t ParentBoxes 2022-01-14 15:19:26 +01:00
Guillaume Ayoub
72d05e319f Don’t crash with absolute flex boxes
Fix #1536.
2022-01-10 14:31:49 +01:00
Guillaume Ayoub
a10032c987 Don’t crash with absolute flex boxes
Fix #1536.
2022-01-10 14:31:09 +01:00
aschmitz
480a6ed3bf feat: support word-break: break-all
This adds support for the `break-all` value for `word-break`. The
`keep-all` and `break-word` properties are not yet supported.
2022-01-04 19:08:16 -06:00
aschmitz
439e129561 fix: don't wrap overflow-wrap: anywhere unnecessarily
Previously, if `overflow-wrap: anywhere` (or `break-word`) was set on an
inline element (like an `<a>` or `<span>`) whose first word occurred
towards the end of a line, it would have broken that word, even if doing
so wasn't necessary (and wouldn't have happened were it not for the
wrapping element).

This pipes through a `is_line_start` argument to `split_text_box` that
only allows the break on a word if it's the first word in a line.
2022-01-04 19:03:48 -06:00
Guillaume Ayoub
467748ad0e Handle text-align: inherit 2021-12-28 18:19:29 +01:00
Guillaume Ayoub
810e75b5f4 Handle flex: inherit 2021-12-28 18:09:25 +01:00
Guillaume Ayoub
d4895edae0 Handle flex-flow: inherit 2021-12-28 17:50:58 +01:00
Guillaume Ayoub
6aa5bc8dc1 Handle line-clamp: inherit 2021-12-28 17:48:17 +01:00
Guillaume Ayoub
df28018e92 Handle page-break-inside: inherit 2021-12-28 17:42:13 +01:00
Guillaume Ayoub
86176384fd Handle border-radius: inherit 2021-12-28 17:38:47 +01:00
Guillaume Ayoub
f915ca2938 Handle page-break-after/before: inherit 2021-12-28 17:20:34 +01:00
Guillaume Ayoub
385bb77819 Merge branch 'master' into inherit 2021-12-21 13:08:35 +01:00
Christoph Kepper
bc22f29cb5 #1007 Make 'inherit' value work correctly for word-wrap and overflow-wrap properties 2021-12-21 12:27:46 +01:00
Guillaume Ayoub
8d2c549a82 Update y position when table cells are broken
Fix #1523.
2021-12-20 21:03:58 +01:00
Guillaume Ayoub
ea317e5b94 Fix split tables with border collapse 2021-12-20 14:44:43 +01:00
Guillaume Ayoub
587f235647 Comment failing bug 2021-12-18 20:03:15 +01:00
Guillaume Ayoub
e61422ef72 Remove decorations at the top of broken tables 2021-12-14 15:49:42 +01:00
Guillaume Ayoub
b18b67a241 Handle 'inherit' value in text-decoration
Related to #1007.
2021-12-14 11:30:45 +01:00
Guillaume Ayoub
7a5c285c87 Don’t remove inline block’s trailing space twice
When we calculate the minimum width of an inline block, the size of the
trailing space is already removed by split_first_line. There’s no need to
remove it twice.

We should probably fix split_first_line to remove the trailing space only when
it’s been asked to. But there’s no obvious situation when we want the minimum
width to include trailing spaces, as the minimum size requires line breaks
everywhere, including after each space.

At least, this commit doesn’t remove trailing spaces twice.

Related to #1520.
2021-12-13 13:08:01 +01:00
Guillaume Ayoub
a65ca19bed Add (failing) tests about minimum width with trailing spaces
Related to #1520.
2021-12-13 12:10:48 +01:00
Guillaume Ayoub
6fb0269a36 Add overflow-wrap tests with trailing spaces 2021-12-13 11:20:39 +01:00
Guillaume Ayoub
a27aa37597 Fix overflow-wrap test 2021-12-13 11:16:43 +01:00
aschmitz
1b27388421 Support "overflow-wrap: anywhere"
This supports the `overflow-wrap` value `anywhere`: `anywhere` is like
`break-word`, but the soft breaks it allows *are* considered when
calculating min-content intrinsic sizes.
2021-12-13 02:19:50 -06:00
Guillaume Ayoub
f5d6d54cca Split absolute boxes
Fix #36.
2021-12-12 18:58:04 +01:00
Guillaume Ayoub
21484fafba Merge branch 'master' into footnotes 2021-12-11 17:05:33 +01:00
Guillaume Ayoub
3f596ce21f Fix footnotes for repaginated documents 2021-12-10 17:51:10 +01:00
Guillaume Ayoub
1800bb5ed6 Add test for footnotes margins 2021-12-09 16:40:02 +01:00
Guillaume Ayoub
8cc6b258a0 Handle footnote-policy 2021-12-09 16:20:39 +01:00
Guillaume Ayoub
f54da35dc7 Report footnotes when previous footnotes are already reported 2021-12-08 21:00:21 +01:00
Guillaume Ayoub
7126f1b804 Remove useless color from tests 2021-12-08 20:29:31 +01:00
Lucie Anglade
7c8c291d96 Add reported footnote test 2021-12-08 17:43:19 +01:00
Guillaume Ayoub
5e6b21cec8 Fix last tests for footnotes 2021-12-08 15:35:54 +01:00
Guillaume Ayoub
ed0916d55c Fix more tests for footnotes 2021-12-08 15:16:45 +01:00
Guillaume Ayoub
a702292a1a Fix inline footnotes test 2021-12-08 15:02:46 +01:00
Guillaume Ayoub
6f190a2f20 Add missing underlines and empty strings 2021-12-07 14:46:07 +01:00
Guillaume Ayoub
8ae09175eb Typo 2021-12-06 16:39:25 +01:00
Guillaume Ayoub
d0f30fcb8a Fix tests for floats 2021-12-06 16:14:55 +01:00
Guillaume Ayoub
dd14bb968b Save images in tests when there’s the wrong number of pages 2021-12-06 15:50:55 +01:00
Lucie Anglade
22efdc832b More text in normal flow for absolute/float split tests 2021-12-05 20:08:04 +01:00
Guillaume Ayoub
64797e77f4 Fix test 2021-12-05 19:57:17 +01:00
Guillaume Ayoub
c101e0c6a8 Merge branch 'master' of github.com:Kozea/WeasyPrint 2021-12-05 19:17:05 +01:00
Guillaume Ayoub
379be1e575 Include non-printable characters width during rendering
Fix #1515. Related to #1508.
2021-12-05 19:15:39 +01:00
Lucie Anglade
06fe73d54b Move length check 2021-12-04 23:48:44 +01:00
Lucie Anglade
f0384d1fcf Check if the expected result and the computed one have the same number of pixels. 2021-12-04 17:45:53 +01:00
Lucie Anglade
be71cc6e66 Add xfail on failing tests 2021-12-04 17:44:35 +01:00
Lucie Anglade
7f9503470a Fix expected pixels and add xfails 2021-12-04 17:44:10 +01:00
Lucie Anglade
c761879ade Test absolute split 2021-12-04 16:56:50 +01:00
Lucie Anglade
fcea5f02df Test floats split 2021-12-04 16:56:39 +01:00
Lucie Anglade
2c77f5f2f9 Fix indent 2021-12-04 16:53:50 +01:00