-
Notifications
You must be signed in to change notification settings - Fork 102
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
Replace Number type with a simpler Option<f32> #144
Conversation
Tests are failing, likely due to my tweaks to the @mockersf has promised us a regenerated set of tests and associated bug fixes; I'd like to merge this change after that is in. |
1d48d1d
to
bf85308
Compare
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.
See comments; I'm unable to spot any other changes in the code that would alter the behaviour of the algorithm.
That being said, I like this change!
c046f96
to
05f0b2a
Compare
) -> Size<Number> { | ||
Size { | ||
width: node_size.width.or_else(parent_size.width - constants.margin.horizontal_axis_sum()) | ||
- constants.padding_border.horizontal_axis_sum(), |
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.
The original implementation here was wrong; padding should only be subtracted if the node width is undefined.
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.
None of the tests seem to care either way about this change though 🙃
* Update RELEASES.md * Implement extension traits for Option<f32> * Replace usages of Number with Option<f32> * Rename module from number.rs to math.rs * Note removal of associated traits * Make behavior of maybe_sub consistent * Thanks clippy! * dead_code XD * Update math operations to be consistent with previous impl * Reduce churn in PR * Follow line length calculation spec correctly * Fix undefined math logic for MaybeMath trait
Objective
Number
is an unhelpful name, and had leaked into the public interface.This was actually just representing an
Option<f32>
, and badly obscuring this fact.Fixes #83.
Feedback wanted
I particularly want feedback on the logic in the new-ish
MaybeMath
trait. This isn't entirely consistent with the behavior of the previous implementations onNumber
, but those implementations were surprising in ways that seemed wrong.I can of course revert them to match exactly, but we should be sure we're following the spec (or at least Chrome's implementation of the spec).