-
Notifications
You must be signed in to change notification settings - Fork 28
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
Tree style builder #76
Conversation
29e7775
to
afa76cd
Compare
This one is nearly ready, but needs a bit of cleanup in the tree builder code. |
e6983e8
to
09c1768
Compare
Implements CSS style line height computation. This is now directly on top of main and #76 builds on top of this.
ce76ca8
to
bcfd6a3
Compare
parley/src/builder.rs
Outdated
// dbg!(&lcx.inline_boxes); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// dbg!(&lcx.inline_boxes); |
@dfrg @xorgy Pinging you on this one as it's been a couple of months, I can see that other work on parley is starting to happen, and I am keen to get this merged before it starts to generate conflicts. I'm also keen to do some api documentation / re-export work on Parley and then get a 0.2.0 crates.io release out, which I consider this to be blocking. I do understand that you're busy and that this may not be top priority though. If it helps: This PR is actually much smaller and simpler than #84. I have also updated the PR description with a high-level description of the changes which may help with reviewing. I could also split the changes out into separate commits if that would help? If I were to self-review I suspect I might point out:
|
Thanks for the ping. After some thought, and given that you’ve been actively using this code in Blitz, I’m leaning toward landing as is with the caveat that much of this is likely to be superseded with work I’ve been doing on refactoring the text analysis code. The downside is more churn in the future on your end but the upside is support for span margins/borders/padding and a new pull style API for styles so you have more control. Hopefully that’s compelling. With that in mind, I’d recommend not investing a lot of effort into improving documentation as things are likely to change soon. |
That would be great!
I am excited to see what you come up with, and definitely keen for changes that lead to a more complete implementation of the web model (and I'm guessing structural improvements to the code too). API churn isn't really a big deal for us: I'm familiar enough with the code at this point that I'm confident in being able to adapt to any changes. Regression in terms of feature set would be more problematic (if there was no longer a way to do something that was previously possible and that we are relying on) .
The doc changes I have in mind are pretty basic:
I feel like a couple of hours spent on those kind of changes would put us in pretty good shape for a 0.2 release, and would bring us much more in line with cosmic-text in terms of first impressions and ease of getting started. Beyond that, there are also a few features that I might be interested in working on soon:
My feeling is that the first two (and perhaps even floats) probably wouldn't clash too much with your changes as they deal primarily with the layout code? But if you think it would be better to hold off then I will (I don't suppose you have any kind of estimated timeline for these changes landing / being published?) |
d2c5b8a
to
d04c1a5
Compare
d04c1a5
to
2244f53
Compare
I've rebased on latest
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and I think I get it now.
The one caveat being I'd prefer this patch not introduce commented-out printf debugging code.
Changes made
Entire unresolved style struct
TextStyle
) tostyle/mod.rs
TreeBuilder
allows you to directly pass an entire style struct (rather than just "changed styles" relative to a previous node in the tree) as this is easier for integrating with Stylo which already resolves inherited styles. So I have added an "unresolved" version of the style struct to allow this API to still plug into the other parts of Parley's style resolution functionality.resolve_entire_style_set
method toLayoutContext
to convertTextStyle
intoResolvedStyle
.Moved code
RangedBuilder
fromcontext.rs
to a newbuilder.rs
module (as there are now two builders, justifying a separate module).RangedBuilder::build_into
into a standalonebuild_into_layout
function (builder.rs
) that can be shared between the ranged and tree builders.RangedStyle
andRangedProperty
types fromresolve/range.rs
toresolve/mod.rs
. These types are shared between theRangedBuilder
and theTreeBuilder
.Tree builder
TreeBuilder
(also tobuilder.rs
). This mostly delegates toTreeStyleBuilder
TreeStyleBuilder
(resolve/tree.rs
). This is the vast majority of the new codeTreeStyleBuilder
implements HTML-style whitespace collapsing (opt-in). This probably ought to become a style rather than being a flag on the style builder.