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

152 Commits

Author SHA1 Message Date
Guillaume Ayoub
87133bcfce Clear cascaded styles when they're not needed anymore 2019-09-11 11:04:31 +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
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
2ee4516786 Handle the ::marker pseudo-element
Fix #700.
2019-08-07 23:01:41 +02:00
Guillaume Ayoub
9831a1ba40 Remove and fix some TODOs 2019-07-11 16:48:53 +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
5ceddcb2ca
Merge pull request #843 from Kozea/variables
Add CSS variables
2019-04-10 13:46:28 +02:00
Guillaume Ayoub
d637212e8d Handle :nth(An+B) notation 2019-04-02 16:57:45 +02:00
Guillaume Ayoub
cff70ee18a Clean the nth() parsing function 2019-04-02 16:26:57 +02:00
Guillaume Ayoub
fc7db276e5 Add page declarations on demand
With the previous system, we were listing all page types as the cartesian
product of page names and pseudo selectors. Declarations were added for all
these possible page types.

The nth() page selector makes this system impossible, as we can't make the
cartesian product with a number of pages we don't know at the beginning of the
rendering. We now add declarations before rendering each page, based on the
properties of the page.

This new way is faster when the total number of pages is lower than the
cartesian product of possible pages. For long documents, we could improve speed
by detecting CSS rules based on page index or page name, and use cached results
for all pages that don't rely on such rules.
2019-04-02 12:39:00 +02:00
Guillaume Ayoub
36fa280bdb Allow repeted page pseudo-classes, 2nd edition 2019-04-02 11:59:12 +02:00
Guillaume Ayoub
48775182e6 Set nth() selector specificity 2019-04-02 11:36:07 +02:00
Guillaume Ayoub
ce7e9dd049 Allow multiple specifications of page pseudo-classes 2019-04-02 11:35:41 +02:00
Guillaume Ayoub
ed4f00848f Use empty string as default value of named page
That's the value given in the spec, using None doesn't add anything and even
introduces bugs.
2019-04-02 11:19:48 +02:00
Guillaume Ayoub
f2e9784ee7 Add a stupid and broken support of nth page selector 2019-04-01 18:45:59 +02:00
Guillaume Ayoub
f1a6da72ac Set set_computed_styles as a StyleFor method 2019-04-01 15:24:18 +02:00
Guillaume Ayoub
84e1813c6c Merge branch 'master' into media-queries 2019-04-01 14:41:51 +02:00
Guillaume Ayoub
13fb5aba84 Merge branch 'master' into variables 2019-03-21 11:28:58 +01:00
Guillaume Ayoub
167ebce065 Please isort again 2019-03-10 19:34:16 +01:00
Guillaume Ayoub
c447add874 First simple version supporting CSS variables
Related to #546.
2019-03-06 13:51:30 +01:00
Guillaume Ayoub
b7a9fe7dcc Update copyright 2019-03-04 11:04:06 +01:00
Guillaume Ayoub
0cc5478252 Fix imports for isort 2019-03-01 11:38:03 +01:00
Guillaume Ayoub
857d889816 Merge branch 'master' into media-queries 2019-01-24 18:36:53 +01:00
Guillaume Ayoub
74f56f7102 Add a --debug option and set debug level for prefixed CSS properties 2019-01-04 01:22:49 +01:00
Guillaume Ayoub
3513e95b41 Use a separate logger for generation progress 2019-01-03 23:02:44 +01:00
Guillaume Ayoub
56904baa79 Use the same copyright line everywhere 2018-09-20 18:46:27 +02:00
Guillaume Ayoub
419d14e415 Handle middle and center values of align presentational hint
Fix #694.
2018-09-20 15:29:27 +02:00
Guillaume Ayoub
4a6153fa7d Put media queries in a separate module, create a class for style_for 2018-08-17 10:30:51 +02:00
Guillaume Ayoub
65240c6f78 Clean comments and variable names 2018-08-08 17:49:03 +02:00
Guillaume Ayoub
f960553a70 Move CSS utils file 2018-04-15 10:28:14 +02:00
Guillaume Ayoub
2be9959525 Clean many things about properties validation and computed values 2018-04-14 13:44:10 +02:00
Guillaume Ayoub
0a4f2d9ffb Split validation module 2018-03-31 22:13:08 +02:00
Guillaume Ayoub
07865f6371 Don't use a global target collector 2018-03-28 00:34:34 +02:00
Guillaume Ayoub
9e59376914 Handle @page rule grammar correctly
Fix #562.
2018-01-28 22:17:26 +01:00
Guillaume Ayoub
16e8186568 Drop Python 2 support 2018-01-14 01:48:17 +01:00
Guillaume Ayoub
ad11edfff2 Remove StyleDict objects 2018-01-13 17:41:08 +01:00
Guillaume Ayoub
724565f27a Don't allow attribute access to StyleDict objects 2018-01-13 17:05:23 +01:00
Guillaume Ayoub
359d42c641 Remove style's anonymous attribute 2018-01-13 16:34:14 +01:00
Guillaume Ayoub
572822a353 Use a set instead of a regex to detect INITIAL_NOT_COMPUTED values
That's an easy ~1% performance enhancement!
2017-10-13 09:48:57 +02:00
Václav Pokluda
05446f5eff Added support to work with bleed like padding (bleed-top/right/bottom/left) 2017-09-21 12:03:09 +02:00
Guillaume Ayoub
71d54095bd Add support of marks and bleed pages properties
Fix #471.
2017-09-05 15:44:50 +02:00
Guillaume Ayoub
9f9716df33 Remove case-sensivity for at-rules and properties 2017-08-17 07:52:18 +02:00
Guillaume Ayoub
fb649f22b3 Ignore CSS imports after other types of declarations 2017-08-17 07:47:20 +02:00
Guillaume Ayoub
dd7bf0b8a1 Put StyleDict.copy at its original place 2017-08-17 07:44:19 +02:00
Guillaume Ayoub
2ac0481cb0 Don't crash when an at-rule is empty 2017-08-14 14:11:57 +02:00
Guillaume Ayoub
9a44e2f469 Copy the style of the wrapper as it will be modified
Sould be needed where the style is inherited and modified
2017-08-14 14:10:24 +02:00
Guillaume Ayoub
b6fc234db3 Don't crash when setting compuetd style on root pseudo elements 2017-08-14 11:37:05 +02:00
Guillaume Ayoub
c0b5ba4c53 Ignore CSS rules with empty media queries 2017-08-14 11:36:35 +02:00