1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00
Commit Graph

2608 Commits

Author SHA1 Message Date
Guillaume Ayoub
58599d325e Don’t crash when trying to display images 2020-05-18 01:29:59 +02:00
Guillaume Ayoub
c422c1b77e Disable antialiasing by default 2020-05-18 01:29:37 +02:00
Guillaume Ayoub
0ecb246501 Use less code to compare PNG files in tests 2020-05-18 00:49:21 +02:00
Guillaume Ayoub
57fd7f3f0c Don’t return useless document in html_to_pixels 2020-05-17 23:54:25 +02:00
Guillaume Ayoub
e2700082fc Don’t write GhostScript renderings on disk 2020-05-17 23:48:41 +02:00
Guillaume Ayoub
15035f8c97 Mark some tests are failing
These tests were failing with Cairo too, but the rendering was OK because Cairo
was lucky
2020-05-17 23:37:35 +02:00
Guillaume Ayoub
7686fbd4ae Always end path when clipping 2020-05-17 23:11:19 +02:00
Guillaume Ayoub
fee0f91c56 Save layout max width to avoid calling unavailable clip_extents 2020-05-17 22:48:38 +02:00
Guillaume Ayoub
23dccecc3a Set some optional arguments as needed as they are always given 2020-05-17 22:47:52 +02:00
Guillaume Ayoub
38dae61b23 Fix box drawing tests 2020-05-17 20:11:22 +02:00
Guillaume Ayoub
c85d58a86e Linting 2020-05-17 20:01:49 +02:00
Guillaume Ayoub
b8749863d1 Fix all PDF tests not relying on images 2020-05-17 18:59:31 +02:00
Guillaume Ayoub
d1dcea7b1c Fix anchors 2020-05-17 17:12:23 +02:00
Guillaume Ayoub
7e9f80e7a2 Add comment for outlines 2020-05-17 17:12:16 +02:00
Guillaume Ayoub
f7ce6a6db0 Don’t use references for states and xobjects dicts 2020-05-17 17:04:45 +02:00
Guillaume Ayoub
e1e3974d00 Fix typo 2020-05-17 16:59:58 +02:00
Guillaume Ayoub
522b240474 Don’t set links on lineboxes 2020-05-17 15:54:02 +02:00
Guillaume Ayoub
b0da0290ba Disable antialiasing for tests 2020-05-17 15:06:45 +02:00
Guillaume Ayoub
e711363490 Add an option to enable antialiasing for PNG generation 2020-05-17 15:06:17 +02:00
Guillaume Ayoub
3de277ce0e Handle opacity 2020-05-17 14:46:41 +02:00
Guillaume Ayoub
bf3c7324cb Fix many tests 2020-05-16 17:06:30 +02:00
Guillaume Ayoub
8d2ea802f0 Add various dictionaries only when needed 2020-05-16 17:05:48 +02:00
Guillaume Ayoub
07ac9e855f Fix attachments name discovery 2020-05-16 17:05:11 +02:00
Guillaume Ayoub
5f2107fde8 Remove embedded files dictionary when empty 2020-05-16 16:25:06 +02:00
Guillaume Ayoub
9e486a345a Fix outlines 2020-05-16 16:19:28 +02:00
Guillaume Ayoub
0c9312167e Don’t remove seconds when timezone is set 2020-05-16 15:23:20 +02:00
Guillaume Ayoub
b2797dafe1 Fix lint 2020-05-16 14:27:03 +02:00
Guillaume Ayoub
ae2f6ed3b8 Remove @requires decorator 2020-05-16 00:25:11 +02:00
Guillaume Ayoub
feb25b479d Remove pango_cairo_* definitions 2020-05-16 00:20:31 +02:00
Guillaume Ayoub
efd231ea15 Remove useless cairo import 2020-05-16 00:19:41 +02:00
Guillaume Ayoub
70e195f464 Use transform instead of scale and translate 2020-05-16 00:19:25 +02:00
Guillaume Ayoub
47b8f80695 Don’t use Cairo for tests 2020-05-16 00:04:18 +02:00
Guillaume Ayoub
1383592243 Fix multi-page PNG generation 2020-05-16 00:04:09 +02:00
Guillaume Ayoub
9733cb1718 Handle WOFF fonts 2020-05-15 16:12:45 +02:00
Guillaume Ayoub
dc443ab30d Remove naughty comma
Fix #1114.
2020-05-15 11:54:00 +02:00
Guillaume Ayoub
5b4bbb22e7 Fix many tests 2020-05-13 01:02:43 +02:00
Guillaume Ayoub
cad749b93e Lint 2020-05-12 23:54:42 +02:00
Guillaume Ayoub
e4aab188f9 Use a reference for ToUnicode 2020-05-12 23:47:22 +02:00
Guillaume Ayoub
b3fb006184 Improve readibility 2020-05-12 23:06:18 +02:00
Guillaume Ayoub
90843ac4a1 Fix cmap letters for multiple runs 2020-05-12 22:37:40 +02:00
Guillaume Ayoub
00110952bb Merge branch 'pydyf' of gitlab.com:courtbouillon/weasyprint into pydyf 2020-05-12 21:54:07 +02:00
Guillaume Ayoub
cd5f178409 Fix outlines 2020-05-12 21:53:54 +02:00
Lucie Anglade
12272f50e4 Cmaps into font 2020-05-12 18:38:12 +02:00
Guillaume Ayoub
c42bbf1fae Fix embedded OpenType fonts 2020-05-12 13:11:52 +02:00
Guillaume Ayoub
21226efbe1 Fix zlib compression 2020-05-12 02:03:39 +02:00
Guillaume Ayoub
099347ce94 Fix arrays in char widths 2020-05-12 02:00:07 +02:00
Lucie Anglade
c4fb5324b5 Use pydyf text methods 2020-05-12 00:24:20 +02:00
Guillaume Ayoub
c7acb05b63 Improve readability 2020-05-10 18:22:13 +02:00
Guillaume Ayoub
53caa99a50 Use a smaller array for characters widths 2020-05-10 18:09:06 +02:00
Guillaume Ayoub
36cc7c6f68 Fix insconsistent kerning and font metrics values 2020-05-10 17:51:37 +02:00
Guillaume Ayoub
e1b458e174 Handle TTF and OTF font files with dedicated PDF syntaxes 2020-05-10 00:14:56 +02:00
Guillaume Ayoub
24c81ad99e Simplify kerning and font size management 2020-05-09 22:23:33 +02:00
Guillaume Ayoub
d25527351b Always store 1pt fonts to get metrics 2020-05-09 18:06:20 +02:00
Guillaume Ayoub
e9122c989e Fix units used for characters widths and kerning 2020-05-09 15:52:43 +02:00
Guillaume Ayoub
aa7c9e3aa8 Add kerning values 2020-05-09 01:35:43 +02:00
Guillaume Ayoub
46a1524af6 Fix text size and position 2020-05-09 00:00:07 +02:00
Guillaume Ayoub
d53b86053d Use font codepoints instead of Unicode codepoints 2020-05-08 17:14:45 +02:00
Lucie Anglade
6e3214eea8 Fix widths 2020-05-08 15:14:10 +02:00
Lucie Anglade
a6ff868094 First and last characters, and widths 2020-05-08 15:07:51 +02:00
Guillaume Ayoub
d4b7f242c3 Remove useless variable 2020-05-08 02:13:44 +02:00
Guillaume Ayoub
8f640237e5 Remove useless font name prefix 2020-05-08 01:58:43 +02:00
Guillaume Ayoub
954dcc03b4 Fix font name 2020-05-08 01:55:50 +02:00
Guillaume Ayoub
aa2030d737 Change some font attributes names 2020-05-08 01:50:41 +02:00
Guillaume Ayoub
05bc5eed17 Don’t use the 3/4 ratio, as Pango and PDF both use points 2020-05-08 01:39:42 +02:00
Guillaume Ayoub
3342386a28 Fix font bounding box 2020-05-08 01:30:07 +02:00
Lucie Anglade
36ed176a36 Use computed values 2020-05-08 00:40:01 +02:00
Guillaume Ayoub
c1f95ab8f7 Remove useless parenthesis 2020-05-08 00:31:50 +02:00
Guillaume Ayoub
6f44d18b81 Merge branch 'pydyf' of gitlab.com:courtbouillon/weasyprint into pydyf 2020-05-08 00:31:00 +02:00
Guillaume Ayoub
0dcddc7a4e Display some text 2020-05-08 00:29:46 +02:00
Lucie Anglade
a8eb334f9d Release memory 2020-05-08 00:28:30 +02:00
Lucie Anglade
088e06da0e Use the saved pango_font 2020-05-08 00:24:30 +02:00
Lucie Anglade
0a412542d9 Fix parameters 2020-05-08 00:23:13 +02:00
Lucie Anglade
18e10631f9 Set flags always to 4, symbolic 2020-05-08 00:19:07 +02:00
Lucie Anglade
f306418cfd Get FontBBox and CapHeight 2020-05-08 00:11:19 +02:00
Guillaume Ayoub
590c0c57ce Fully describe PangoGlyphInfo 2020-05-07 23:39:21 +02:00
Lucie Anglade
7dab88c3ad Font name, and save glyphs 2020-05-07 23:27:43 +02:00
Guillaume Ayoub
1129f82cea Don’t import pango twice 2020-05-07 22:37:11 +02:00
Lucie Anglade
e64e98a56a Move getting font informations from text to document 2020-05-07 19:33:54 +02:00
Lucie Anglade
aab07099a9 Start retrieving font descriptor info 2020-05-06 20:10:18 +02:00
Guillaume Ayoub
5ed840fc7d Include font streams 2020-05-06 07:42:45 +02:00
Konstantin Alekseev
1571528da3 dlopen shared library symlink using major version name.
cffi.dlopen should use .so.N symlinks instead of .so to
make sure we load ABI compatible version of the library and
the same library used by the rest of the system.

cffi uses `ctypes.util.find_library` to search for libraries
and the docs for `find_library` states that
"The exact functionality is system dependent."
so different system may expect different names for the same library.

To overcome that problem we try to load several names until success
among these names exact file name with `.so` suffix
eg. `libcairo.so` but .so symlink is not always safe to use.

Shared library usually consist of two of three files:
- libcairo.so.N.M - N.M exact version number
- libcairo.so.N - symlink to library.so.N.M with major ABI version
- libcairo.so - symlink to library.so.N

When -lcairo flag is used linker search for libcairo.so,
but when the programm loaded it loads libcairo.so.N where N
is the version that it was linked with.

Some downsides of .so usage:
- .so may point to the wrong ABI version, e.g. we expect libcairo
  version 2 but libcairo.so points at libcairo.so.1
- usually .so files are shipped with development packages `-dev`
  in debian and `-devel` in centos and they are just symlinks
  to the .so.N files. So it safer to search for .so.N files they
  will exist even if dev package is not installed.
- hard symlink .so -> .so.N not always preserved, eg. if we zip
  them we get two copies of the library and while the rest of the
  system will use .so.N file we will load .so files that may lead
  to crash
2020-05-03 22:01:41 +03:00
Guillaume Ayoub
67b104d8ab Get fonts data 2020-04-26 00:48:38 +02:00
Guillaume Ayoub
bbc1355df6 Force FontConfig use 2020-04-26 00:48:32 +02:00
Guillaume Ayoub
7de2e45f55 Fix crash when there’s no outline 2020-04-21 23:07:35 +02:00
Guillaume Ayoub
44c21b7f31 Go through PDF pages only once during generation 2020-04-21 22:47:55 +02:00
Guillaume Ayoub
d02bc1bde1 Add inline attachments 2020-04-21 22:30:38 +02:00
Guillaume Ayoub
3bee463e83 Remove resolve_links from Document class 2020-04-19 18:26:49 +02:00
Guillaume Ayoub
9752142959 Merge document and pdf modules 2020-04-19 16:49:37 +02:00
Guillaume Ayoub
cbf010952d Fix transformation matrix with bleed box 2020-04-19 14:40:30 +02:00
Guillaume Ayoub
f353a16cf5 Call finisher 2020-04-19 10:01:27 +02:00
Guillaume Ayoub
c94423a700 Handle bleed box 2020-04-19 09:55:39 +02:00
Guillaume Ayoub
a06322d432 Remove some references to Cairo 2020-04-19 08:09:22 +02:00
Guillaume Ayoub
5cd62f4d31 Fix border style 2020-04-19 07:52:32 +02:00
Guillaume Ayoub
98570cc095 Handle hyperlinks and anchors 2020-04-19 00:47:19 +02:00
Guillaume Ayoub
b3baac3694 Handle bookmark state 2020-04-18 22:41:23 +02:00
Guillaume Ayoub
ece3025fd6 Handle transforms and bookmarks 2020-04-18 22:12:25 +02:00
Guillaume Ayoub
bf2b21b6e0 First steps to replace cairo with pydyf 2020-04-18 00:19:35 +02:00
Guillaume Ayoub
29309aa673 Don’t display template tags
Fix #1080.
2020-04-13 11:44:37 +02:00
Guillaume Ayoub
fda14c0ff4 Fix typo 2020-04-10 14:07:12 +02:00
Guillaume Ayoub
b1b5e3ee98 Simplify renderer’s argparse code
Related to #1099.
2020-04-10 13:50:33 +02:00
Thomas J. Lampoltshammer
61b4865bec
added function for port specification
Added a new function which allows the user to select a specific port. If no port is specified, port 5000 is used as default port.
2020-04-10 10:53:52 +02:00
Guillaume Ayoub
ee316cdb78
Merge pull request #1096 from hejsan/signature-support
Digital signature support
2020-04-09 09:49:10 +02:00
Bjarni Þórisson
74d5c4faf1 remove trailing whitespace 2020-04-09 00:51:15 +00:00
Bjarni Þórisson
fb867f9b4e Support for post-processing by passing a finisher function to write_pdf 2020-04-08 23:46:11 +00:00
Guillaume Ayoub
ba1abecc31 Fix column background position for rtl tables
Related to #1097.
2020-04-08 15:31:24 +02:00
Guillaume Ayoub
c22fcb1b36 Add failing test 2020-04-08 14:28:57 +02:00
Guillaume Ayoub
15e0314405 Fix names and comments for table tests 2020-04-08 13:40:23 +02:00
Mohammed Y. Alnajdi
0d55bd9307 cover more rtl tests 2020-04-07 12:36:29 +03:00
Guillaume Ayoub
2e7031fe71 Merge branch 'master' into rtl_tables 2020-04-06 18:13:12 +02:00
Bjarni Þórisson
9575595b55 Added hooks to support Digital Signatures and allowed for writing multiple trailers.
Upped version number
2020-04-06 15:15:25 +00:00
Guillaume Ayoub
f50feef83f Fix positions of rtl rows, row groups and colspan cells 2020-04-06 14:11:06 +02:00
Guillaume Ayoub
079f21251d Revert "Try not to use DejaVu fonts for Windows tests"
This reverts commit 9ae77aff62.
2020-04-05 23:10:14 +02:00
Guillaume Ayoub
9ae77aff62 Try not to use DejaVu fonts for Windows tests 2020-04-05 23:00:41 +02:00
Guillaume Ayoub
6ad3bae86a Fix some flex tests 2020-04-05 22:56:40 +02:00
Guillaume Ayoub
bac3d8c064 Remove workaround for tests on macOS
The bug related to fonts separated by commas is now fixed in Pango for macOS.
2020-04-05 14:47:40 +02:00
Guillaume Ayoub
b33a8d11d4 Fix the footer repetition on split tables
Fix #1027.

Footers of split tables have a wrong position: they keep their position before
splitting the table. This commit is an improvement (it doesn’t crash anymore,
data are OK on each page) but it’s far from perfect.

We also have to take care of absolute and fixed elements in footers. It’s
probably already broken (see related #138), so…

TODOs have been added where things have to be improved.
2020-04-03 21:44:27 +02:00
Guillaume Ayoub
21b534ea0b Fix complex table break test 2020-04-03 19:24:07 +02:00
Guillaume Ayoub
cbf31172cd Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-04-02 16:50:55 +02:00
Guillaume Ayoub
da146c639a Don’t try to break tables after the header or before the footer
Related to #1027.
2020-04-02 16:49:48 +02:00
Bart Broere
9e90c91535
Try fixing a bug encountered when using weasyprint in Pyinstaller context 2020-03-25 18:43:05 +01:00
Guillaume Ayoub
ab47de3a27 Remove useless assert
Related to #1083.
2020-03-22 11:18:27 +01:00
Felix Schwarz
dd48b5004c HTML: prevent FutureWarning from xml.etree.ElementTree.Element
__bool__()/__nonzero__() is deprecated and raises a FutureWarning. This warning
is usually not visible with CPython. However it is highly irritating with
pypy3 (v7.1.1).
2020-03-22 08:31:25 +01:00
Guillaume Ayoub
aeb00c576b Only apply text-indent to lineboxes
Fix #1000.
2020-03-16 23:55:39 +01:00
Guillaume Ayoub
736639dfcb Fix condition avoiding line recalculation
At the end of a linebox layout, we have to check that the new linebox has the
same position as the originally calculated one. If the position is different,
it means that a floating element needs to push the linebox to a lower position.

With ltr lines, the box horizontal position is calculated related to the left
border of the box. It’s different with rtl lines, because the left border has
to be translated to the left each time the linebox width changes. We thus need
to rely on the right border for rtl lines.
2020-03-15 01:06:59 +01:00
Guillaume Ayoub
6d9b9aa7fa Use start/end instead of left/right to define text alignment offset
As the rtl lineboxes are now right aligned (just like any other block-level
box), we don’t have to take care about direction when calculating offset.

Text is now translated when text-align is different from start. It’s translated
to the right with ltr and to the left with rtl.
2020-03-15 01:06:54 +01:00
Guillaume Ayoub
1419e9433d Fix borders for rtl tables 2020-03-14 23:09:23 +01:00
Guillaume Ayoub
97c0ebf14e Fix tests for rtl tables
When tables are in rtl direction, their columns are mirrored.
2020-03-14 23:08:51 +01:00
Guillaume Ayoub
8d3e3d485b Handle rtl when drawing tables 2020-03-14 19:25:07 +01:00
Guillaume Ayoub
b06406d4d3 Handle rtl when avoiding floats 2020-03-14 19:24:31 +01:00
Guillaume Ayoub
ba4079d9a3 Fix and test position of columns in rtl tables 2020-03-14 18:27:41 +01:00
Guillaume Ayoub
1b6a41b6ed Set rtl on body to test rtl tables
This setup moves the table to the right, we’re thus able to test real-life rtl
tables in rtl documents.
2020-03-14 18:26:35 +01:00
Guillaume Ayoub
4e7ced8c04 Merge branch 'mohdnajdy-rtl-table-borders' into rtl_tables 2020-03-14 17:02:05 +01:00
Guillaume Ayoub
c44a9a7459 Merge branch 'rtl-table-borders' of https://github.com/mohdnajdy/WeasyPrint into mohdnajdy-rtl-table-borders 2020-03-14 17:01:03 +01:00
Guillaume Ayoub
86fb08c0f3 Merge branch 'rtl-table-direction' of https://github.com/mohdnajdy/WeasyPrint into mohdnajdy-rtl-table-direction 2020-03-14 17:00:27 +01:00
Guillaume Ayoub
a756ea121f Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-03-14 16:53:57 +01:00
Guillaume Ayoub
42d802da4f Use high-level functions to create temprorary files
Using low-level functions forces us to handle low-level file descriptors and
encodings, while we could safely rely on Python for that.

Related to #1074.
2020-03-14 16:51:41 +01:00
Guillaume Ayoub
a430b30322 Use filesystem encoding instead of ASCII for fonts config files
This is needed when temporary filenames are generated with non-ASCII
characters.

Close #1074.
2020-03-14 16:50:01 +01:00
Guillaume Ayoub
2b7ec23c5e
Merge pull request #1072 from gentooboontoo/drop-extraneous-font-config
Drop extraneous font matching
2020-03-14 16:19:21 +01:00
Guillaume Ayoub
fe7fd1c179 Don’t crash on absolute SVG files with no intrinsic size
Fix #1050.
2020-03-14 15:00:25 +01:00
Julien Sanchez
3a91c50636
Drop extraneous font matching 2020-02-26 11:56:13 +01:00
Mohammed Y. Alnajdi
652086df49 rtl: 2 failing test for tables collapsed borders 2020-02-26 01:21:49 +03:00
Mohammed Y. Alnajdi
af560c626b RTL: render table correctly when direction is rtl 2020-02-26 01:01:10 +03:00
Guillaume Ayoub
a4511d0093 Fix comments and typos 2020-02-24 10:33:09 +01:00
Guillaume Ayoub
25a0ebdd36 Merge branch 'master' into clean 2020-01-29 23:21:00 +01:00
Guillaume Ayoub
684170699b Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-01-25 22:40:15 +01:00
Guillaume Ayoub
e4421653a4 Fix background size on page canvas
Fix https://print-css.rocks/lesson/lesson-background-repeated.

Related to #1026.
2020-01-25 22:40:10 +01:00
Guillaume Ayoub
5c5e5eaa47 Replace one-letter variable 2020-01-25 18:19:56 +01:00
saddy001
05ebf39061
Fix when frozen with cx_freeze
Fixes

    from weasyprint import HTML
  File "/usr/local/lib/python3.7/dist-packages/weasyprint/__init__.py", line 41, in <module>
    VERSION = __version__ = (ROOT / 'VERSION').read_text().strip()
TypeError: unsupported operand type(s) for /: 'str' and 'str'
2020-01-14 18:24:18 +01:00
Guillaume Ayoub
529bb439c6 Merge branch 'master' into clean 2020-01-13 23:53:05 +01:00
Guillaume Ayoub
d2278aee69 Don’t insert the same layout attributes multiple times
Using pango_attr_list_change is slower, but it prevents spacing attributes to
be set twice, breaking the line-splitting algorithm for some reason.

I don’t know if it is possible to add a simple test for that.

Fix #1025.
2020-01-13 23:48:51 +01:00
Guillaume Ayoub
449e15a9b6 Remove breakpoint 2020-01-13 21:50:13 +01:00
Guillaume Ayoub
e8f5d774c7 Improve urls.py coverage 2020-01-13 21:26:56 +01:00
Guillaume Ayoub
10a7863332 Fully test __main__
Related to #1023.
2020-01-11 18:33:59 +01:00
Guillaume Ayoub
620b17a9b3 Coverage 2020-01-09 23:33:07 +01:00
Guillaume Ayoub
ceea084f42 Remove print 2020-01-09 22:53:55 +01:00
Guillaume Ayoub
9015eb8e96 Don’t cover failing tests 2020-01-08 23:40:34 +01:00
Guillaume Ayoub
bc58e25eb7 Test z-index 2020-01-07 23:55:39 +01:00
Guillaume Ayoub
35884dc6de Improve coverage for tools 2020-01-07 23:00:39 +01:00
Guillaume Ayoub
34ad3b5050 Merge branch 'master' into clean 2020-01-07 22:36:38 +01:00
Guillaume Ayoub
cb610e88f0 Support counter-set
Code was sleeping commented since December 2011 and could have been working in
WeasyPrint 0.3. Easiest feature ever thanks to @SimonSapin.

Fix #1019.
2020-01-06 22:45:37 +01:00
Guillaume Ayoub
822fb6808d Ignore some lines for coverage 2020-01-06 17:06:26 +01:00
Guillaume Ayoub
22e07ba931 Add box-sizing tests 2020-01-06 17:06:04 +01:00
Guillaume Ayoub
ae21c822bf 100% test coverage for expanders validation 2020-01-02 23:25:33 +01:00
Guillaume Ayoub
787deaf873 Test border-radius validation 2020-01-02 19:20:48 +01:00
Guillaume Ayoub
b40ad461be Remove repeated copyright assignments in files
Everything is replaced by a more explicit message in the COPYRIGHT file.

Inspired by rust-lang/rust#43498 and rust-lang/rust#57108.
2020-01-02 14:10:09 +01:00
Guillaume Ayoub
647af0b228 Minor fixes 2020-01-02 13:27:11 +01:00
Guillaume Ayoub
47ec97bcaf Remove useless explicit object inheritance 2020-01-02 12:06:58 +01:00
Guillaume Ayoub
5f28f83f36 Fix and clean some tests 2020-01-02 00:43:06 +01:00
Guillaume Ayoub
56ab08a455 Remove useless import 2020-01-02 00:03:43 +01:00
Guillaume Ayoub
6e3b35af2a Remove useless parse_email function 2020-01-01 23:56:56 +01:00
Guillaume Ayoub
79f2935917 Add more tests and warning messages 2019-12-30 23:37:58 +01:00
Guillaume Ayoub
eff6bf51b0 Fix tests 2019-12-30 22:46:13 +01:00
Guillaume Ayoub
a0526ceb1c Minor fixes about counters 2019-12-30 22:33:29 +01:00
Guillaume Ayoub
6bc6c21fd9 Ingore wrong values for negative descriptor 2019-12-30 21:41:29 +01:00
Guillaume Ayoub
aed8b09543 Fix extended counters 2019-12-30 18:04:23 +01:00
Guillaume Ayoub
e3c03ab70b Fix unknown counter 2019-12-30 13:05:03 +01:00
Guillaume Ayoub
473443c5eb Support string for list-style-type 2019-12-30 13:03:04 +01:00
Guillaume Ayoub
3aecd0d500 Test counters 2019-12-30 10:28:34 +01:00
Guillaume Ayoub
64b34a77ac Add failing test 2019-12-30 01:01:58 +01:00
Guillaume Ayoub
a8c67e52cf Support symbols() notation for list-style-position 2019-12-30 00:45:34 +01:00
Guillaume Ayoub
e362be6513 Fix symbolic counters 2019-12-30 00:43:06 +01:00
Guillaume Ayoub
bb4b2d45e6 Update documentation for counters 2019-12-27 15:26:15 +01:00
Guillaume Ayoub
4ecc0f8310 Prevent circular fallbacks for counters 2019-12-27 14:55:50 +01:00
Guillaume Ayoub
c245c29bfe Discard additive-symbol rules with non strictly descending weights 2019-12-27 14:45:05 +01:00
Guillaume Ayoub
96bfd5c38a Fix operator 2019-12-27 14:38:06 +01:00
Guillaume Ayoub
fe3cbffacc Fix value attribute for li tags 2019-12-27 14:37:02 +01:00
Guillaume Ayoub
429f979438 Fix tests 2019-12-27 14:14:47 +01:00
Guillaume Ayoub
2e49be962d Fix various tests data 2019-12-27 11:53:29 +01:00
Guillaume Ayoub
a46ac53f08 Move counter tests to a dedicated file 2019-12-27 11:53:10 +01:00
Guillaume Ayoub
89b31be485 Use a CounterStyle type for UA counter styles 2019-12-27 11:52:44 +01:00
Guillaume Ayoub
65a5cb6e11 Reject "none" as counter name 2019-12-27 11:52:24 +01:00
Guillaume Ayoub
932a75ec6e Implement copy for counter styles 2019-12-27 11:52:07 +01:00
Guillaume Ayoub
a7e46d937d Fix counter padding 2019-12-27 11:51:54 +01:00
Guillaume Ayoub
ce55b50802 Lint 2019-12-27 02:22:59 +01:00
Guillaume Ayoub
c35b7070a9 Fix font-face’s src descriptor 2019-12-27 02:22:21 +01:00
Guillaume Ayoub
0a65f0d40b Handle most of the counter-style use cases 2019-12-27 02:14:24 +01:00
Guillaume Ayoub
c8f041f32c Handle more counter types 2019-12-24 16:42:12 +01:00
Guillaume Ayoub
2da6ff3909 Add default counter class 2019-12-24 15:56:24 +01:00
Guillaume Ayoub
a036fe8f4b Remove counters.py 2019-12-24 15:18:10 +01:00
Guillaume Ayoub
73244891f4 Add base code for @counter-style rules 2019-12-24 14:39:40 +01:00
Guillaume Ayoub
d08c8b4a27 Add test for box margin after repagination
Related to #943.
2019-12-24 11:54:46 +01:00
Guillaume Ayoub
c02e5c2f78 Remove underscore from _remove_decoration 2019-12-23 23:13:05 +01:00
Guillaume Ayoub
5a8c81eea2 Merge branch 'master' into fix_943 2019-12-23 22:01:58 +01:00
Guillaume Ayoub
2d9a91ad38 Version 51 2019-12-23 17:41:50 +01:00
Guillaume Ayoub
94c5cf9f75 Fix box creation for first-letter selectors
Related to 3d4f18b
2019-12-23 15:49:08 +01:00
Guillaume Ayoub
4865b97a22 Remove useless super() arguments 2019-12-23 15:34:49 +01:00
Guillaume Ayoub
b556091271 Add test for running elements with different display values 2019-12-22 22:29:25 +01:00
Guillaume Ayoub
da9a5648d5 Don’t test start value for running elements 2019-12-22 22:20:24 +01:00
Guillaume Ayoub
df4bc64981 Add tests for running elements 2019-12-22 19:03:24 +01:00
Guillaume Ayoub
14a8a2bb9e Fix first-except value for element() and string()
On pages where the string was defined, the returned value was the entry value
instead of being the empty string. It doesn’t change anything on pages where
the value is defined for the first time, but it was different otherwise.
2019-12-22 17:45:25 +01:00
Guillaume Ayoub
916e34f637 Handle the second argument of element() 2019-12-22 15:52:48 +01:00
Guillaume Ayoub
0fe6981c04 Fix corner cases for running elements
Fix #967.
2019-12-22 15:15:42 +01:00
Guillaume Ayoub
3ff431c543 Add warning when running element is unknown 2019-12-22 14:42:21 +01:00
Guillaume Ayoub
02d4c0032a Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-12-22 00:13:01 +01:00
Guillaume Ayoub
570451dae7 Remove print 2019-12-22 00:12:44 +01:00
Guillaume Ayoub
3f74dd98b9 Don’t call page_values twice when it’s not needed
Fix #1013.
2019-12-22 00:11:34 +01:00
Guillaume Ayoub
ad7e57b3ff
Merge pull request #1012 from Kozea/fix_129
Fix rendering for header and footer on empty tables
2019-12-20 14:43:48 +01:00
Lucie Anglade
7e95a1321c Display header and footer on the next page if it does not fit on the current one. 2019-12-20 12:09:06 +01:00
Lucie Anglade
9adda8940a Add tests for empty tables 2019-12-20 11:30:04 +01:00
Guillaume Ayoub
eca2a6b4fa Remove useless u'…' in comments 2019-12-19 15:21:55 +01:00
Guillaume Ayoub
23a93a8cd0 Allow a second agrument for element() 2019-12-19 15:15:59 +01:00
Guillaume Ayoub
97b47ee14f Add missing docstring 2019-12-19 10:49:31 +01:00
Guillaume Ayoub
c21028e12e Don’t raise InvalidValues in the transform validator
Validators return None when value is incorrect, let’s use the same behaviour
for transform.

Related to #974, #977.
2019-12-19 10:26:30 +01:00
Guillaume Ayoub
aab6217d1e Use parametric test for variable fallbacks
It creates a lot of (too many?) really small tests, but it’s much better to
know which properties crash.
2019-12-19 10:15:41 +01:00
Tontyna
d863cb13c3 Add test 2019-12-19 10:11:55 +01:00
Guillaume Ayoub
a1df1de2a3 Don’t crash when improper values are given in var()
When the resolved value of var() is not allowed by the property, we have to get
the parent value (or the initial value if the property is not
inherited). Parent value (and some of the initial values) is already computed,
so we don’t have to call the computer function in this case.

Calling the computer function with already computed values can crash.

Fix #974.
2019-12-18 16:00:15 +01:00
Guillaume Ayoub
e7f6a32325 Simplify table skip condition 2019-12-18 00:18:58 +01:00
Lucie Anglade
4855551be5 Check new_table_children is empty when the table (except header and footer) is empty too 2019-12-18 00:14:04 +01:00
Lucie Anglade
368607e2f4 Keep the header when the page is empty and there is nothing else to display 2019-12-17 23:24:46 +01:00
Guillaume Ayoub
f0c4b4345a Don't set default values for zero-width presentational hints borders
The previous selectors were setting borders, even when the value for "border"
is "0". There was a comment about this in the PH stylesheet … and that's now
fixed!

Fix #1005.
2019-12-15 22:34:57 +01:00
Guillaume Ayoub
b717065d02 Remove useless comment 2019-12-15 16:33:56 +01:00
Guillaume Ayoub
7eacb711a7 Merge branch 'master' into fix_943 2019-12-15 15:26:00 +01:00
Guillaume Ayoub
74e1e0d154 Fix comment about memory leak 2019-12-15 15:07:50 +01:00
Guillermo Bonvehí
839031f8a5 When changing Layout's attribute in set_text, do not override them 2019-11-26 12:39:13 -03:00
Guillaume Ayoub
05a9513af7
Merge pull request #972 from Tontyna/box-element
Add html element to Box class
2019-11-08 15:58:20 +01:00
Guillaume Ayoub
4677318ec1
Merge pull request #975 from Tontyna/string-set-crash
Return appropriate tuple for string-set:none
2019-11-07 15:21:29 +01:00
Guillaume Ayoub
cebc1ba505 Fix typo in row height definition
Using last cell's position works too, but it's much cleaner to use row's
position.

Fix #983.
2019-11-07 11:44:26 +01:00
Tontyna
8861cf69e6 Return appropriate tuple for string-set:none 2019-10-23 01:29:35 +02:00
Tontyna
3d4f18b916 Add html element to Box class
Unless the Box is a PageBox or a MarginBox the new attribute `element` points
to the html element (xml.etree.ElementTree.Element) where the Box stems from.
This enables e.g. post-processing that depends on Element attributes, like
'class' or 'id'.

Caution: Elements with no subelements will test as False! Test the element's
existence with `if box.element is not None:`.

Related to #434, #970.
2019-10-17 23:41:36 +02:00
Lucie Anglade
0fe6960d45 Remove useless position_y check 2019-10-05 11:07:04 +02:00
Tontyna
f2553d8be2 Fix line-height in regression test 2019-10-04 22:28:28 +02:00
Tontyna
184346431b Fix line breaking tests 2019-10-04 21:35:33 +02:00
grewn0uille
4974ac3682 Add regression tests on line breaking.
Related to https://github.com/Kozea/WeasyPrint/pull/956.
2019-10-04 17:14:52 +02:00
Tontyna
ecbacef14f Sanitize simplified line breaking
The special case that an already broken child must be split again confronts
us with two skip stacks: The initial (absolute) and the adjusted (partial)
stack. Often the new stack is a relative one and (carefully) adding both
stacks is ok. But the following must be observed:

- The first number of the combined stack has to be the index of the child
  we broke twice.
- A child index bigger than the starting index of the initial stack denotes
  that the new skip stack is an absolute stack. Don't add nothing.

Should fix #953
2019-10-03 18:18:36 +02:00
Guillaume Ayoub
0a403d9d16 Remove RunningPlaceholder 2019-09-27 11:53:30 +02:00
Guillaume Ayoub
d9432a72f5 Remove the Running class 2019-09-27 11:34:36 +02:00
Guillaume Ayoub
6b3ce39c5c Add the deepcopy method to all boxes 2019-09-27 11:18:22 +02:00
Guillaume Ayoub
fd70058c93
Merge pull request #882 from hbrunn/master-running
[ADD] position: running(); content: element();
2019-09-27 11:01:16 +02:00
Guillaume Ayoub
5cb24e2cbc Explicitely remove box decorations when needed 2019-09-24 18:42:25 +02:00
Guillaume Ayoub
20f1dc3fe9 Remove useless TODO
This has been fixed by 8e267c90.
2019-09-24 16:16:32 +02:00
Guillaume Ayoub
b4ff03c7a8 Don't modify style for border-radius when splitting boxes
Related to #943, #948
2019-09-24 14:30:37 +02:00
Guillaume Ayoub
7e8424178e Remove style copy for broken inline boxes 2019-09-23 16:52:53 +02:00
Guillaume Ayoub
ca0fd0239f Don't edit style when splitting boxes
Fix #943.
2019-09-23 12:09:07 +02:00
Holger Brunn
b30ffb1694
[ADD] position: running(); content: element(); 2019-09-22 23:21:31 +02:00
Guillaume Ayoub
c33ca0893d Remove useless empty line 2019-09-20 17:24:21 +02:00
Guillaume Ayoub
1d144683d8 Use else instead of extra comparison in for loop 2019-09-20 11:15:48 +02:00
Guillaume Ayoub
7a4d6f821d Support larger and smaller values for font-size 2019-09-20 11:12:12 +02:00
Guillaume Ayoub
a0ccc8d2e6 Version 50 2019-09-19 13:34:22 +02:00
Guillaume Ayoub
3af0d73be2 Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-09-18 15:08:44 +02:00
Guillaume Ayoub
8abc39d209 Don't display absolutes when their parents have no other children
If a parent box can only display absolute boxes at the bottom of the page, but
has other children that have to be drawn on the next page, keep the absolute
boxes for the next page too. It's at least very useful for markers.

Fix #945.
2019-09-18 15:03:43 +02:00
Guillaume Ayoub
fbf3467240 Fix position of marker box
The marker box is generated by the ::marker pseudo-element of a list item as
the list item’s first child […].

The old behavior was done because of the fuzzy "[With list-style-position:
outside], If the list item is a block container: the marker box is outside the
principal block box […]". Outside here probably means that the box is drawn
outside, not that it's not a child of the list item box.

Related to #945.
2019-09-18 14:57:25 +02:00
grewn0uille
8e267c90df Make blocks with 'overflow' different from 'visible' grow to include floating children.
Fix #661.
2019-09-16 16:33:13 +02:00
Guillaume Ayoub
5f7a104c62 Ignore margins on flex containers
Fix #831.
2019-09-13 14:25:03 +02:00
Guillaume Ayoub
51558a873a Fix skip stack with reversed children
Fix #896.
2019-09-13 14:05:05 +02:00
Guillaume Ayoub
f1b1d140e2 Simplify line breaking
When we break an inline child twice, we have to add the initial (absolute) skip
stack and the new (relative) skip stack. The old code needed to check that the
children were the same before adding the stacks, but this detection was buggy
and complicated. The new implementation works even if the broken children are
not the same, removing the need to detect the previously broken child.

Fix #923.
2019-09-13 13:28:07 +02:00
Guillaume Ayoub
396ec71967 Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-09-13 10:11:42 +02:00
Guillaume Ayoub
c43a2188d5 Add CLI argument printing system information 2019-09-13 10:01:45 +02:00
grewn0uille
958140734b Fix same_broken_child
The old code assumed that both skip stacks were absolute, but for the second
one previous children have already been skipped. We now check that we're in
the first child at each level, meaning that we're still breaking the same
child.

Related to #923.
2019-09-12 18:26:19 +02:00
grewn0uille
83d9efce86 Merge remote-tracking branch 'origin/master' into page_break_table 2019-09-11 17:17:45 +02:00
Guillaume Ayoub
24dfe8093b Version 49 2019-09-11 17:09:45 +02:00
Guillaume Ayoub
87133bcfce Clear cascaded styles when they're not needed anymore 2019-09-11 11:04:31 +02:00
grewn0uille
c0fa009655 Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-09-10 17:29:10 +02:00
grewn0uille
f297bd3d94 Ignore position property on first-letter boxes to avoid layout troubles 2019-09-10 17:29:06 +02:00
Guillaume Ayoub
d63eac3181 Don't crash with object-fit: non images with no intrinsic size 2019-09-10 15:26:53 +02:00
Guillaume Ayoub
c790ff2094 Don't crash when properties needing base URL use var functions 2019-09-10 15:18:44 +02:00
Guillaume Ayoub
f66df067a1 Don't crash when using ex units in word-spacing in letter-spacing 2019-09-10 14:52:46 +02:00
Guillaume Ayoub
fb0887cfd7 Fix crash when using currentColor in gradients 2019-09-10 14:17:05 +02:00
Guillaume Ayoub
e7c452ce80 Fix collapsing margins for columns 2019-09-10 12:31:42 +02:00
Guillaume Ayoub
0c7a77f3ae Fix next in flow child detection during column layout 2019-09-10 12:31:20 +02:00
grewn0uille
48d8632eaa Avoid not in flow children to compute box height 2019-09-10 12:09:42 +02:00
grewn0uille
03edd011d2 Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-09-09 18:24:39 +02:00
grewn0uille
e9ff909d80 Avoid crash when before and after have display: list-item 2019-09-09 17:58:54 +02:00
grewn0uille
871d69ab10 Remove useless style from cascaded_styles dictionnary 2019-09-09 17:04:24 +02:00
Guillaume Ayoub
4cb6045784 Fix typo introduced in previous commit 2019-09-06 17:12:18 +02:00
Guillaume Ayoub
615e298ade Don't include floating elements each time we try to render a column 2019-09-06 16:40:17 +02:00
Guillaume Ayoub
789b80e684 Only use in flow children to set columns height 2019-09-06 11:31:03 +02:00
Guillaume Ayoub
87d9e84f28 Avoid infinite loops when rendering columns 2019-09-05 15:45:17 +02:00
Guillaume Ayoub
cf7bff7af1 Fix test indentation 2019-09-05 15:28:23 +02:00
Guillaume Ayoub
d0c9a75e53 Fix table rendering with empty lines and rowspans
Fix #937.
2019-09-05 15:27:40 +02:00
Guillaume Ayoub
b06a3a9a6f Always set tabulation width
Not setting it makes Pango use a slightly different value of tabulation width,
breaking a test.
2019-09-05 13:46:01 +02:00
Guillaume Ayoub
29fcb45f0e Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-09-04 16:21:39 +02:00
Guillaume Ayoub
4dc0b119f6 Don't crash when small columns are wrapped in absolute blocks
Fix #897.
2019-09-04 16:20:07 +02:00
Guillaume Ayoub
074d147611
Merge pull request #922 from Kozea/perf
Improve performance
2019-09-03 12:29:48 +02:00
Guillaume Ayoub
fb62571f86 Fix gradient test
Use colors with even hexadecimal components for gradients to have a
deterministic result when colors are mixed.

Fix #913.
2019-09-03 12:24:39 +02:00
grewn0uille
9b6bd0f192 Merge branch 'master' into page_break_table 2019-08-30 11:46:41 +02:00
grewn0uille
d01f941ca6 Add tests for page breaks between tbodys 2019-08-30 11:45:47 +02:00
Tontyna
8277462bee Dont use deprecated Logger.warn 2019-08-26 10:16:31 +02:00
grewn0uille
23e2ba1ec6 Break pages avoid between groups 2019-08-23 18:00:52 +02:00
grewn0uille
26a0ee5963 Merge perf 2019-08-23 15:10:47 +02:00
grewn0uille
6dc59b8dd8 break pages avoid between tr 2019-08-21 19:00:55 +02:00
grewn0uille
fcda627731 Break before footer 2019-08-20 18:38:37 +02:00
grewn0uille
af6673d2f7 Fix tests 2019-08-20 18:35:05 +02:00
grewn0uille
dd779d1598 Support break-before in table. Related to #209 2019-08-20 18:20:15 +02:00
grewn0uille
4b396d5f58 Support break-after in table. Related to #209 2019-08-20 17:33:35 +02:00
Guillaume Ayoub
8ac7afe4ca Remove add_declaration
We can now get style in the parent loop, avoiding a large number of calls to
setdefault.
2019-08-19 18:23:17 +02:00
Guillaume Ayoub
feae58052c Merge branch 'master' into perf 2019-08-17 11:06:29 +02:00
Guillaume Ayoub
b8c19a2878 Heal my psychotic desorders 2019-08-17 11:04:57 +02:00
Tontyna
b5a4cb739c fix erroneous document title 2019-08-16 22:01:46 +02:00
Guillaume Ayoub
359536e6e3 Merge branch 'master' into perf 2019-08-14 18:34:51 +02:00
Guillaume Ayoub
cd925bc76c Revert "Fix tests for Pango 1.44"
This reverts commit d6da699f91.
2019-08-14 18:34:42 +02:00
Guillaume Ayoub
aab0fa5b9d Fix line height with Pango > 1.44
Pango > 1.44 returns a wrong baseline when no text is set on the layout. We
now have to set text when calculating metrics for strut layouts.

Fix #917.
2019-08-14 18:32:44 +02:00
Guillaume Ayoub
440070b8da Fix padding and margin management for column flex boxes
Nothing more than a stupid typo. Fix #919.
2019-08-14 16:29:45 +02:00
Guillaume Ayoub
554225b4f7 Fix typo in comment 2019-08-14 14:50:06 +02:00
Guillaume Ayoub
91d8c0fbec Don't remove repeated headers when line groups avoid breaks
When no table content is small enough to fit in one page, we remove repeated
headers and footers to give table content more space. This is a good idea for
complicated situations, but not adapted when line groups avoid page breaks
inside.

This commit keeps headers and footers when the next line group avoids page
breaks, by forcing to render at least one line of the table, like if the page
was empty.
2019-08-14 14:37:49 +02:00
Guillaume Ayoub
d6da699f91 Fix tests for Pango 1.44
Fix #917.

One test fails with current 1.44.3 version, because of bug 397 [1] fixed
in 1.44.4 (not released yet).

[1] https://gitlab.gnome.org/GNOME/pango/issues/397
2019-08-08 16:47:05 +02:00
Guillaume Ayoub
2ee4516786 Handle the ::marker pseudo-element
Fix #700.
2019-08-07 23:01:41 +02:00
Guillaume Ayoub
fb90a736d1 Add test about inline images with no size
Related to #901.
2019-07-25 10:51:25 +02:00
Guillaume Ayoub
7efd1e135f Fix width of replaced boxes with no intrinsic width
Fix #901.
2019-07-24 15:18:38 +02:00
Guillaume Ayoub
ba2b4542e8 Merge branch 'master' into perf 2019-07-24 10:54:20 +02:00
Guillaume Ayoub
8d10c011d9 Don't respect table cell width when content doesn't fit
Fix #906.
2019-07-24 10:47:55 +02:00
Guillaume Ayoub
620e0754f4 Fix lint 2019-07-23 18:07:14 +02:00
Guillaume Ayoub
328de5e67e
Merge pull request #907 from makeleaps/nowrap
Refactor LayoutContext building
2019-07-23 18:01:56 +02:00
Raphael Gaschignard
afc7dabc1b Refactor LayoutContext building
this will provide a simpler API for testing context-using functions inside tests
2019-07-23 14:12:08 +09:00
grewn0uille
a86627943f Fix margin collapsing between caption and table wrapper. 2019-07-19 18:31:17 +02:00
Guillaume Ayoub
abcd386e2f Remove useless TODO
This TODO has been fixed with #771.
2019-07-18 16:40:42 +02:00
Guillaume Ayoub
0142689fd9 Merge branch 'master' into perf 2019-07-18 16:33:22 +02:00
grewn0uille
135dc06c9a Handle recto/verso on page break. 2019-07-18 14:34:45 +02:00
Guillaume Ayoub
b328b5766c Remove useless TODO
FakeHTML actually reads data from a file.
2019-07-18 11:54:03 +02:00
Guillaume Ayoub
97a5aaea07 Remove work done twice when splitting lines between characters
There used to be a problem with WRAP_CHAR method of Pango, but it's fixed. As
nothing is said in Pango's Changelog, the probem may have been in our heads,
and that wouldn't be surprising at all.
2019-07-18 11:39:35 +02:00
Guillaume Ayoub
997882514e Fix the way display is set when no box is generated from tree
Add related tests too.
2019-07-18 11:22:07 +02:00
Guillaume Ayoub
d24211d82a Refuse too many "normal" values in font expander 2019-07-17 15:00:20 +02:00
Guillaume Ayoub
8b2b25f702 Fix tests relying on a modified CSS parsing rule
In the 2014 version of CSS Syntax Module Level 3 [1], meeting an EOF character
before the end of a string would just return the string token. In the 2019
candidate recommendation [2], this behavior must raise a parse error.

This commit fixes a test that was relying on the older behavior.

TinyCSS2 will follow the new specification from version 1.1.0.

[1] https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/#consume-a-string-token
[2] https://www.w3.org/TR/2019/CR-css-syntax-3-20190716/#consume-string-token
2019-07-17 11:22:38 +02:00
Stani
67f031b8e7
Add state to bookmark tree documentation.
There is a breaking change in make_bookmark_tree, which was not documented.
2019-07-15 15:15:34 +02:00
Guillaume Ayoub
7071e36ce4 Remove device_size parameter everywhere
The device_size parameter was passed to many layout features, but it was only
used to set default size of replaced boxes with no implicit or explicit size
set. As this case is really rare for printed documents, and as it's also rare
to have printed supports that small, we can remove this "feature".

Moreover, in CSS3-images, another definition called "default object size" is
used to set replaced box size when no size is defined. This size doesn't seem
to be defined for images.
2019-07-11 17:17:28 +02:00
Guillaume Ayoub
8a64fd40db Remove TODO 2019-07-11 17:01:53 +02:00
Guillaume Ayoub
9831a1ba40 Remove and fix some TODOs 2019-07-11 16:48:53 +02:00
Guillaume Ayoub
ad8ab62280 Same optimization as previous commit for inline level boxes 2019-07-11 15:03:40 +02:00
Guillaume Ayoub
005d9a3c9f Don't copy style when removing decorations if there's no need to
It saves a lot of memory for very long paragraphs with no decoration style.
2019-07-11 14:48:58 +02:00
Guillaume Ayoub
76c3a47607 Fix comment and remove useless attribute setting when copying boxes 2019-07-10 18:32:00 +02:00
Guillaume Ayoub
4e80f4cccf Remove enumerate_skip
It used to be really slow, at least on large inline containers.
2019-07-09 17:58:20 +02:00
Guillaume Ayoub
a5671524ef Fix text set on layout
This partially reverts a27146c.
2019-07-09 17:25:43 +02:00
Guillaume Ayoub
2497d605ee Remove useless line break 2019-07-09 17:16:09 +02:00
Guillaume Ayoub
a27146c9a7 Don't reset layout text when there's no soft hyphens in text
Setting text is slow and should be avoided when possible. We should probably
avoid get_first_line too and keep the original one here.
2019-07-09 16:57:40 +02:00
Guillaume Ayoub
7d5347f081 Merge branch 'master' into perf 2019-07-09 16:13:28 +02:00
Guillaume Ayoub
66958573e5 Use only one del statement when possible 2019-07-09 16:09:23 +02:00
Szmen
008a5b3742 Docs: Fixed wrong nested list comprehension example 2019-07-09 00:06:19 +02:00
Guillaume Ayoub
32be33d37d Avoid loop and text formatting in anonymous styles loop
As this loop is called for each anonymous box, avoiding a text formatting makes
a significant difference.
2019-07-08 18:20:41 +02:00
Guillaume Ayoub
3b38911222 Set both computed and specified values when setting CSS variables
Going through the whole specified properties dict can be long, and calling
"startswith" on each name is even longer. Setting both computed and specified
values at the same times avoids an extra loop in compute.
2019-07-08 18:02:44 +02:00
Guillaume Ayoub
b57b2c13c1 Use a dict instead of a dummy function to store computers
As attributes of this object is accessed many times per element, it improves
the overall speed in a significant way. We save between 1 and 2 percents with
html5 sample for example.
2019-07-08 17:51:20 +02:00
Guillaume Ayoub
7bda29b95b Clean Layout code 2019-07-08 16:34:58 +02:00
Guillaume Ayoub
2ab52a7c8c Deactivate layout created for justified text 2019-07-08 16:34:44 +02:00
Guillaume Ayoub
8db46ff25d Merge branch 'master' into perf 2019-07-08 14:42:14 +02:00
Guillaume Ayoub
80c5a82871 Version 48 2019-07-08 13:51:38 +02:00
Guillaume Ayoub
f5d4ee2824
Merge pull request #891 from Kozea/text-overflow
Support text-overflow
2019-07-08 13:27:13 +02:00
Guillaume Ayoub
31c29cdb1f Just create a layout when justification is needed
Spliting the line again is useless here.
2019-07-05 17:57:23 +02:00
Guillaume Ayoub
1be85621a5 Don't calculate linebox width and height when not needed
Float clearance requires to calculate the line minimum width and height before
setting the linebox position. When there are no floating boxes in the context,
there's no need to calculate these sizes.

We thus avoid a call to inline_min_content_width per text line. This call
required a lot of time as it needed to go through the whole line breaking
algorithm to render the first word.

We save 15% of the rendering time when generating our Odyssey sample.
2019-07-05 17:33:30 +02:00
Guillaume Ayoub
6dcc17f151 Take care of text-overflow to set ellipsis
Fix #874.
2019-07-04 12:00:03 +02:00
Guillaume Ayoub
e88190fc14 Use Pango's set_ellipsize 2019-07-03 16:20:58 +02:00
Guillaume Ayoub
c813d45d61 First naive version of text-overflow support 2019-07-03 15:37:29 +02:00
Guillaume Ayoub
adb521643c Support column-span
Fix #719.

We also used the real rendering stack to find the columns heights, fix #696.
2019-06-28 17:33:35 +02:00
Guillaume Ayoub
a2ec8567a1 Merge branch 'master' into column-span 2019-06-28 15:04:28 +02:00
Guillaume Ayoub
57f216cb91 Clean some code in draw module 2019-06-25 16:13:11 +02:00
Gabriel Corona
ef5c99a360 Implement text-decoration: wavy 2019-06-24 21:02:25 +02:00
Guillaume Ayoub
668ca840c7 Minor style fixes 2019-06-22 21:49:28 +02:00
Guillaume Ayoub
ae43048a49
Merge pull request #869 from randomstuff/text-decoration
Fix broken dash/dotted pattern in text-decoration with inline elements
2019-06-22 21:46:41 +02:00
Guillaume Ayoub
923e45b717 Add test for #885. 2019-06-22 21:43:08 +02:00
Guillaume Ayoub
5e0f6d494f Actually use the content box to resolve flex items percentages
Fix #885.
2019-06-22 21:37:27 +02:00
grewn0uille
d5b702ef32 WIP test column-span 2019-06-06 13:54:35 +02:00
grewn0uille
497a0b54dd Add partial support for column-span property.
Related to #719.
2019-06-04 18:03:32 +02:00
Guillaume Ayoub
8499379dd1 Don't repeat background images when it's not needed
For now, we only avoid the repetition when we have no-repeat for x and y
axes. We could do this when the painting area is smaller than the image and
when the position doesn't require a repetition. But… Who cares?

Fix #238.

There was also a bug in the size of the surface needed to draw images that are
not repeated. Before this commit, the repeat size was the painting size * 2 to
avoid glitches at the boundaries. But we have to be sure to draw at least the
whole image, as the image may be translated before being drawn. The
multiplication is not needed as we don't repeat the image anymore.

Related to #669.
2019-06-02 23:03:19 +02:00
Guillaume Ayoub
9f442be640 Move percentage function into percentages module 2019-06-02 18:06:25 +02:00
Guillaume Ayoub
846515b109 Merge branch 'master' of github.com:Kozea/WeasyPrint 2019-06-02 17:55:51 +02:00
Guillaume Ayoub
ef74806c8d
Merge pull request #875 from mbarkhau/feature_object_fit_and_pos
Feature object-fit and object-position
2019-06-02 17:55:05 +02:00
Guillaume Ayoub
dd6572b999 Simplify parse_pixels 2019-06-02 17:50:38 +02:00
Manuel Barkhau
f48fbf0923 lint fix 2019-06-02 16:18:56 +02:00
Manuel Barkhau
ce8ab0f4f0 use object-position for layout of images 2019-06-02 16:16:51 +02:00
Manuel Barkhau
d687c12ff7 refactor: add and use parse_pixels in tests 2019-06-02 12:40:45 +02:00
Manuel Barkhau
601b20864c add css parsing for object-position 2019-06-01 01:44:30 +02:00
Manuel Barkhau
20afa51175 refactor: factor out "precentage" function 2019-06-01 01:39:40 +02:00
Manuel Barkhau
9f61cd688b Add object-fit parsing and layout 2019-06-01 01:39:40 +02:00
Guillaume Ayoub
ec4504d23f Set a minimum height for empty list elements with outside marker
The spec says that we can do what we want to improve the rendering in such
cases. Adding a line would probably give exactly the same rendering as if there
were text, but the difference is so small that there's no need to hack the
formatting structure and keep the fix in 3 small lines during the layout.

Fix #873.
2019-05-31 16:56:52 +02:00
Guillaume Ayoub
9b2cbb8943 Remove testing code 2019-05-31 07:19:43 +02:00
Guillaume Ayoub
d753b301a1 Always set outside_list_marker property on boxes 2019-05-31 07:18:25 +02:00
Guillaume Ayoub
a23d4658fc Set marker layout only when needed 2019-05-31 06:36:41 +02:00
Guillaume Ayoub
2ce03092f1 Small code and style improvements around bookmark-state
Related to #870.
2019-05-23 23:55:56 +02:00
Guillaume Ayoub
e881b66859
Merge pull request #870 from randomstuff/bookmark-state
Implement bookmark-state support
2019-05-23 23:15:37 +02:00
Guillaume Ayoub
37e788e8c3 Force SVG size
Related to #867.
2019-05-20 12:31:30 +02:00
Gabriel Corona
34127350b6 Implement bookmark-state support 2019-05-19 19:31:32 +02:00
Gabriel Corona
e704b8f8e2 Fix broken dashed/dotted pattern in text-decoration with inline elements
Example:

~~~html
<style>
p {
  text-decoration: underline green dotted;
}
span {
  color: red;
  text-decoration: underline red dotted;
}
</style>

<p> Lorem <span>ipsum</span> dolor sit amet, <span>consectetur</span>
  adipiscing elit, sed do eiusmod tempor <span>incididunt</span> ut
  labore et dolore <span>magna aliqua</span>. Ut enim ad minim veniam,
  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
  commodo consequat. Duis aute irure dolor in reprehenderit in
  voluptate velit esse cillum dolore eu fugiat nulla
  pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
  culpa qui officia deserunt mollit anim id est laborum.</p>
~~~
2019-05-18 00:17:38 +02:00
Guillaume Ayoub
76479de01f Don't align lines larger than their parents
Related to #867.
2019-05-17 16:19:42 +02:00
Guillaume Ayoub
9012888df2 Set inline table baseline
"The baseline of an 'inline-table' is the baseline of the first row of the
table."

Related to #867.
2019-05-17 15:49:13 +02:00
Guillaume Ayoub
58770563be Set row baseline when no cells are baseline-aligned
"If a row has no cell box aligned to its baseline, the baseline of that row is
the bottom content edge of the lowest cell in the row."

Related to #867.
2019-05-17 13:03:02 +02:00
Guillaume Ayoub
99f85beac6 Don't use translations to align flex items
As the children's layout has not been done yet, their own children are not yet
positioned and thus can't be translated. We have to change the child position
instead and let the child layout move its own children.

Fix #811.
2019-05-16 11:06:28 +02:00
Guillaume Ayoub
36630ab532 Don't change position of block children to avoid rounded float error
To fix #860 and #851, we decided to move block children a little bit to keep
them in the page. It's a bad idea, because children position is altered (and it
breaks many tests, by the way).

Increasing the allowed max_position_y is a better workaround as it doesn't
move blocks.
2019-05-15 13:39:05 +02:00
Guillaume Ayoub
75cf2b61eb Don't cut pages when content overflows a very little bit
Here's another floating point rounding error we have to deal with. The original
issue comes from flex layout, but there are probably plenty of rounding
problems in other flows, so it's safe to put the workaround here.

Fix #851.
2019-05-15 12:02:04 +02:00
Guillaume Ayoub
b88cf3654b Add documentation for text decoration 2019-05-14 23:45:53 +02:00
Guillaume Ayoub
b5cdddfb3f Minor code style changes 2019-05-14 23:35:26 +02:00
Guillaume Ayoub
9fcfdfc24c Ignore wavy value for text-decoration-style
Ignoring values can help to use stylesheets with fallbacks, and it's better to
log these values than to silently ignore them.
2019-05-14 23:33:50 +02:00
Guillaume Ayoub
ed2f4f384a Allow blink as a text-decoration value
It will only be ignored while drawing, but it doesn't harm to keep the value
and makes code and tests more readable.

Also use a set instead of a frozenset to store text-decoration-line, bringing
more readability even if it may be a little, little, little bit slower.
2019-05-14 23:31:27 +02:00
Guillaume Ayoub
f5373db74e
Merge pull request #855 from randomstuff/text-decoration
Add support for full CSS3 text-decoration [RFC]
2019-05-14 18:11:43 +02:00