You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Layout 2020 is vulnerable to floating point precision issues #29819
While debugging floating point test failures, I noticed that large layout values (f32) start to introduce pretty terrible floating point precision errors. This was addressed in Layout 2013 by the use of app_unit, I believe and WebKit uses LayoutUnit. We should explore a similar solution for Layout 2020.
Related to this the Ladybird browser engine from the SerenityOS project jsut did a status of engine video and the developer talks about this issue. They temporarily mitigate some issues by using 64 bit floating numbers but apperently the absolute solution is to use fixed point decimals for these kind of values. We might temporarily mititage part of this issue by using f64. Youtube link with a timestamp https://youtu.be/h72mpiYgFtA
2019-11-19T22:39:10 #servo <nox> pcwalton: Can you give me a 2 minutes master class on why Au exists, btw?
2019-11-19T22:39:37 #servo <pcwalton> nox: IIRC the app_units crate has a big comment with a history explainer
2019-11-19T22:39:45 #servo <nox> Oh, should have looked at it first.
2019-11-19T22:39:59 #servo <pcwalton> I'm kind of lukewarm on app units these days; floats may be better
2019-11-19T22:40:20 #servo <nox> pcwalton: Oh?
2019-11-19T22:40:27 #servo <pcwalton> nox: https://bugzilla.mozilla.org/show_bug.cgi?id=177805 apparently
2019-11-19T22:40:29 #servo <firebot> Bug 177805 — FIXED, sharparrow1⊙yc — Fix the use of units in Gecko
2019-11-19T22:40:56 #servo <pcwalton> nox: yeah, mainly because people do things like make SVGs that are 1 unit by 1 unit and then scale them up with a transform
2019-11-19T22:41:26 #servo <pcwalton> like if your SVG uses an internal coordinate system from 0.0..1.0, which is a perfectly reasonable thing to do
2019-11-19T22:41:47 #servo <pcwalton> then use a transform to scale them to the proper pixel size
2019-11-19T22:41:49 #servo <pcwalton> this breaks with app units
2019-11-19T22:42:00 #servo <pcwalton> because 1/60 of a unit is not precise enough in most cases
2019-11-19T22:42:11 #servo <nox> pcwalton: So we should make no effort whatsoever to keep Au values in layout 2020, right?
2019-11-19T22:42:30 #servo <pcwalton> on the other hand, using floats is kind of a radical change with unknown consequences for web compat
2019-11-19T22:42:31 #servo <pcwalton> so...
2019-11-19T22:42:33 #servo <pcwalton> I'm torn!
2019-11-19T22:42:34 #servo <nox> Asking because gfx uses them, but layout 2020 just uses CSSPixelLength.
2019-11-19T22:42:48 #servo <pcwalton> I don't have a solid answer here
2019-11-19T22:43:29 #servo <pcwalton> I might be inclined to go with floats?
2019-11-19T22:43:29 #servo <nox> Ok, and we have an entire herd of yaks to shave, so I'll just keep converting those app units.
2019-11-19T22:43:44 #servo <pcwalton> but we might have to backtrack on that decision
2019-11-19T22:43:45 #servo <pcwalton> dunno
2019-11-19T22:47:02 #servo <SimonSapin> nox: let’s make a new layout_2020::geom::Length struct that contains a f32 for now, but we can change it later?
2019-11-19T22:47:32 #servo <nox> SimonSapin: Good idea.
2019-11-19T22:47:49 #servo -BitBot- [GitHub] (saltfs) [PR] Darkspirit closed #974 by Darkspirit: Improve TLS config - https://git.io/fj9Rq
2019-11-19T22:48:08 #servo <nox> SimonSapin: That lets us write whatever From implementations we want, too.
2019-11-19T22:48:17 #servo <SimonSapin> nox: in the mean time it’ll require conversion code in even more places, but oh well
2019-11-19T22:48:20 #servo -BitBot- [GitHub] (servo) [issue] bors-servo closed #24650: Appveyor builds not working - https://git.io/Je2u6
2019-11-19T22:48:24 #servo -BitBot- [GitHub] (servo) [PR] bors-servo merged #24651 by jdm into master: Remove appveyor CI badge. - https://git.io/Je2u9
2019-11-19T22:48:52 #servo <SimonSapin> (calls to those From impls)
2019-11-19T22:49:44 #servo <pcwalton> SimonSapin: that sounds like the best solution to me
Activity
dvtkrlbs commentedon Jun 1, 2023
Related to this the Ladybird browser engine from the SerenityOS project jsut did a status of engine video and the developer talks about this issue. They temporarily mitigate some issues by using 64 bit floating numbers but apperently the absolute solution is to use fixed point decimals for these kind of values. We might temporarily mititage part of this issue by using f64. Youtube link with a timestamp https://youtu.be/h72mpiYgFtA
stshine commentedon Jun 1, 2023
What is the reasoning of Layout 2020 using floating point instead of Au?
stshine commentedon Jun 5, 2023
Found this in IRC log.