Live data from Hacker News

Show HN: Stretch – A high-performance cross-platform layout engine in Rust

vislyhq.github.io

51–59 of 59 posts

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#51
post #8

> Stretch is tested against Chrome to ensure 100% web compatibility Erm, no. That’s testing Chrome compatibility (though it’s probably the only one easy enough to test). Chrome is often rushing ahead to implement features that are either not standardized yet, or will not be standardized, or break exisiting standards and compatibility.

Never-the-less, Chrome is pretty spec-compliant as far as flexbox goes.

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#52
Layout is a subject that feels a little bit like a mystic art. There are really no books or accessible material about it, that I know off.

No, the TeX book doesn't count. Looking at the source of Chrome or Firefox doesn't count. Stretch source doesn't count. W3C CSS specs definitely do not count :-p.

I know that there are some papers floating (pun not intended) but I wish somebody wrote a serious book about layout algorithms! Even splitting the words of a paragraph into an optimal shape is something that is surprisingly more complicated and rich topic than one would imagine [1].

Do you know of any resources/docs/papers/implementation-notes that you would recommend?

1: https://xxyxyz.org/line-breaking/

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#53

Layout is a subject that feels a little bit like a mystic art. There are really no books or accessible material about it, that I know off. No, the TeX book doesn't count. Looking at the source of Chrome or Firefox doesn't count. Stretch source doesn't count. W3C CSS specs definitely do not count :-p. I know that there are some papers floating (pun not intended) but I wish somebody wrote a serious book about layout al…

Hey! I'm actually in the process of writing up a high level overview of Flexbox and how it works. Won't cover all aspects but would make it easier to understand hopefully. Can't promise when I'll post it but hopefully soon at medium.com/visly.

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#54
post #3

This looks great! I've been using Yoga in my Rust UI framework via the yoga-rs bindings, and this looks like a nice pure-rust alternative to try using instead.

As the author of the bindings, I'm happy for Stretch to exist :)

All I wanted was a flexbox engine in Rust, and it's great to now have a pure Rust solution!

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#55
post #48

I wonder what it would look like to put this in wasm and draw it to a full screen canvas, circumventing the dom entirely. I wonder if there would be any benefits.

I wouldn't recommend it, you'd destroy accessibility and countless other built-in browser features.

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#56

Earlier quoted context omitted.

First, quirks mode wasn't for websites "designed for IE". IE6 already had a quirks mode and a standards mode. Quirks mode was for websites designed for Netscape 3 or so. For the rest, I work on Gecko (the rendering engine in Firefox). We get a fair number of bug reports about sites that work in Chrome but break in Firefox because Firefox is following the spec and Chrome is not. Chrome is definitely closer to the stan…

Could you share the specifics of your example with the Chrome team refusing to implement already existing standards?

The discussion in https://github.com/heycam/webidl/pull/357 is one example (the Web IDL spec defined the behavior of all the non-Chrome browsers as the spec behavior, then Chrome introduced a third behavior that they want to implement and is trying to get the spec changed to match it).

There were several things in the flexbox spec where Chrome refused to implement what everyone else was doing and the spec ended up getting changed, but I don't have links offhand, sorry. It would take me some hours of digging through bug reports and mailing lists to find them. In general, there have been a lot of things like this in the CSS world that I see peripherally, but I'm not as involved in that personally, so don't have them at the tips of my fingers.

A recent thing that came up is that the behavior of the `disabled` property on `HTMLLinkElement` in Chrome does not match the (very long-standing; literally decades) spec, and it looks like at this point we're going to need to change the spec to match Chrome because sites are writing code to the Chrome implementation, not to the spec, and it's causing compat problems for Firefox (which does implement the spec).

Now don't get me wrong: there are lots of cases in which Chrome _does_ fix longstanding spec-compliance issues. But that's not the only dynamic happening here.

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#57
I'm not a UI guy, and I'm definitely not seasoned or have even had the chance to personally test this assertion.... but..

I thought a lot of people disliked Flexbox and preferred CSSGrid? I watched a talk a while back that made it seem like CSSGrid was better in many ways. Primarily being far more inline with peoples natural mental patterns (ie, what they expect). That talk basically had me thinking that the next frontend I write I'm not touching flex box and instead writing it in CSS Grids.

So am I mistaken? Why would people base a framework around Flexbox? Thoughts?

Re: Show HN: Stretch – A high-performance cross-platform layout engine in Rust

#58

Layout is a subject that feels a little bit like a mystic art. There are really no books or accessible material about it, that I know off. No, the TeX book doesn't count. Looking at the source of Chrome or Firefox doesn't count. Stretch source doesn't count. W3C CSS specs definitely do not count :-p. I know that there are some papers floating (pun not intended) but I wish somebody wrote a serious book about layout al…

Hey! I'm actually in the process of writing up a high level overview of Flexbox and how it works. Won't cover all aspects but would make it easier to understand hopefully. Can't promise when I'll post it but hopefully soon at medium.com/visly.

cool! I look forward your write up :-)
Post reply on HN