Repository navigation
Move image-orientation property outside of mako - #19766
Conversation
|
Heads up! This PR modifies the following files:
|
| animation_value_type="discrete", | ||
| gecko_pref="layout.css.image-orientation.enabled", | ||
| spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \ | ||
| /// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation")} |
There was a problem hiding this comment.
I had to indent this weirdly to prevent a test-tidy error due to the line length. Alternative suggestions welcome.
There was a problem hiding this comment.
How about putting the second line as a documentation comment for type ImageOrientation?
There was a problem hiding this comment.
Yeah, this is kinda weird, but it's not worse than what there was before, so feel free to leave it.
There was a problem hiding this comment.
I'm actually not sure I understand why we need the second link at all? Could we just remove it?
emilio
left a comment
There was a problem hiding this comment.
Looks good, just some minor nits. Thanks for doing this!
| } | ||
|
|
||
| impl Orientation { | ||
| #[allow(missing_docs)] |
There was a problem hiding this comment.
Let's add docs, something like:
/// Get the actual angle that this orientation value represents.
| @@ -82,6 +84,8 @@ pub mod flex; | |||
| pub mod font; | |||
| pub mod image; | |||
| #[cfg(feature = "gecko")] | |||
There was a problem hiding this comment.
This doesn't have anything Gecko-specific, right? Let's just build it for Servo too so we have less divergence.
There was a problem hiding this comment.
Right, I think I thought that might trigger warnings, but quite possibly I thought wrong!
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| //! Specified values for inherited box | ||
| //! Only used by gecko |
| // This computation introduces rounding error. Gecko previously | ||
| // didn't handle the negative case correctly; by branching we can | ||
| // match Gecko's behavior when it was correct. | ||
| rounded_angle = rounded_angle + TWO_PI; |
There was a problem hiding this comment.
This can be rounded_angle += TWO_PI;
| use values::computed::{Context, Orientation, ToComputedValue}; | ||
| use values::specified::Angle; | ||
|
|
||
| #[allow(missing_docs)] |
There was a problem hiding this comment.
Let's add docs for this, like:
/// The specified value of the `image-orientation` property.
/// https://drafts.csswg.org/css-images/#propdef-image-orientation
| ) -> Result<Self, ParseError<'i>> { | ||
| if input.try(|input| input.expect_ident_matching("from-image")).is_ok() { | ||
| // Handle from-image | ||
| Ok(ImageOrientation { angle: None, flipped: false }) |
There was a problem hiding this comment.
I know this is just moving code around, but this could be cleaner if you early-return instead. No big deal if you don't feel like doing it of course :)
There was a problem hiding this comment.
Just curious, why do you find early-returning in this situation cleaner? Personally I marginally prefer the existing style as I feel like it gives equal "weight" to each branch, since each is equally valid/likely. I prefer to save early-returning for handling edges cases, unexpected values, etc (this is coming from a Ruby background, where we sometimes have to manually "type check" method parameters...)
Anyway, I really don't care very much either way and I'm happy to change it, just interested in your perspective!
There was a problem hiding this comment.
No worries!
I generally prefer early returning because when I read it feels a bit more natural. In this case it's not a big deal, but in other places not returning causes a lot of rightward drift in the code. Anyway, fine to not change it :)
| animation_value_type="discrete", | ||
| gecko_pref="layout.css.image-orientation.enabled", | ||
| spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \ | ||
| /// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation")} |
There was a problem hiding this comment.
Yeah, this is kinda weird, but it's not worse than what there was before, so feel free to leave it.
3b709fd to
bd55639
Compare
|
@bors-servo r+ Feel free to submit the removal of the extra link as a followup, or to here (in which case I'll re-approve :P). |
|
📌 Commit bd55639 has been approved by |
Move image-orientation property outside of mako Fixes #19765 r? emilio <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19766) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Fixes #19765
r? emilio
This change is