-
-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't copy styles only to change margins, borders and paddings #497
Comments
In this wonderful blog entry, the solution I was thinking of is given in the chapter called "A sidenote: style struct sharing". |
Style dicts are now standard dicts, with better performance and less memory consumption. Styles are not copied when possible and replaced by ChainMaps. This breaks Python2 compatibility. Related to #497.
See #948 (comment) for more information about where to remove style edition. #950 removed the worse parts, but it’s not finished yet. Having frozen styles with computed values is the way to go. |
Of course. But grepping for modifications of What I don't like is the fact that the pagination stores used values (and other properties related to layout) as attributes in the root_box tree and its children. AFAIK it doesn't hurt, not sure whether it's required, but it definitely feels wrong. A 'style struct sharing' would be great. At the moment each box of the formatted root_box tree has its own complete style dictionary -- style sharing only happens between the formatted box and its paginated counterpart(s). |
Many situations force to override (often remove) margins, borders and paddings, including:
Depending on the situation, the style is copied and modified, or the computed values are applied to the box (
box.padding_right
and its friends). There's no perfect solution, as the first one greatly increases memory usage, and the second one breaksmin/max-width
calculation and box copy.We have to find a solution to:
box.style['margin_left']
andbox.margin_left
(as it's done inmix/max-width
calculation on boxes after dimensions are already set on the box),__getitem__
method that's over-optimized, see 9abc034).The text was updated successfully, but these errors were encountered: