Skip to content
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

style: Move border-image-repeat outside of mako. #19668

Closed
wants to merge 2 commits into from

Conversation

@collares
Copy link
Contributor

collares commented Jan 1, 2018

Part of #19015.

r? emilio


  • ./mach build -d does not report any errors
  • ./mach build-geckolib does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #19021
  • These changes do not require tests

This change is Reviewable

@highfive
Copy link

highfive commented Jan 1, 2018

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @emilio (or someone else) soon.

@highfive
Copy link

highfive commented Jan 1, 2018

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/gecko.mako.rs, components/style/values/specified/border.rs, components/style/values/specified/mod.rs, components/style/values/computed/border.rs, components/style/values/computed/mod.rs and 1 more
  • @canaltinova: components/style/properties/gecko.mako.rs, components/style/values/specified/border.rs, components/style/values/specified/mod.rs, components/style/values/computed/border.rs, components/style/values/computed/mod.rs and 1 more
  • @emilio: components/layout/display_list_builder.rs, components/style/properties/gecko.mako.rs, components/style/values/specified/border.rs, components/style/values/specified/mod.rs, components/style/values/computed/border.rs and 2 more
@highfive
Copy link

highfive commented Jan 1, 2018

warning Warning warning

  • These commits modify style and layout code, but no tests are modified. Please consider adding a test!
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
SpecifiedBorderImageRepeat(computed.0, Some(computed.1))
}
}

This comment has been minimized.

Copy link
@CYBAI

CYBAI Jan 1, 2018

Collaborator

I think you can impl ToComputedValue for BorderImageRepeat inside specified module like BorderSideWidth in specified/border.rs.

This comment has been minimized.

Copy link
@collares

collares Jan 1, 2018

Author Contributor

Oh yeah, it should have been in specified/border.rs. Thanks for catching that :)

This comment has been minimized.

Copy link
@collares

collares Jan 1, 2018

Author Contributor

Now that I think about it, I believe the reason BorderSideWidth can be in specified/border.rs is that its computed value is particularly simple (computed::NonNegativeLength). I don't think making specified/border.rs depend on computed/border.rs (for its ComputedValue) would be a good idea. If you think the cyclic dependency is not a problem, though, I can move it.

This comment has been minimized.

Copy link
@CYBAI

CYBAI Jan 1, 2018

Collaborator

I think it's okay to make it depend on computed/border.rs.

You can also check specified/font.rs.
It import font as computed

use values::computed::{font as computed, Context, Length, NonNegativeLength, ToComputedValue};

and use in the specified module.

Ex.

impl ToComputedValue for FontVariantEastAsian {
type ComputedValue = computed::FontVariantEastAsian;
fn to_computed_value(&self, _context: &Context) -> computed::FontVariantEastAsian {
match *self {
FontVariantEastAsian::Value(ref v) => v.clone(),
FontVariantEastAsian::System(_) => {
#[cfg(feature = "gecko")] {
_context.cached_system_font.as_ref().unwrap().font_variant_east_asian.clone()
}
#[cfg(feature = "servo")] {
unreachable!()
}
}
}
}
fn from_computed_value(other: &computed::FontVariantEastAsian) -> Self {
FontVariantEastAsian::Value(other.clone())
}
}

This comment has been minimized.

Copy link
@collares

collares Jan 1, 2018

Author Contributor

I see, that is good to know!

I don't mean to be difficult, but I wanted to understand why one way is better than the other, as they look mostly the same to me. I grepped for "impl ToComputedValue" and specified/ has 33 impls (12 of them in font.rs), while computed/ has 15 impls (including background-repeat, on which I based this). I understand you have been working on this a lot, so a completely valid reason would be something like "Consistency is good and I prefer us to standardise on this" :)

This comment has been minimized.

Copy link
@emilio

emilio Jan 1, 2018

Member

We're not consistent at this at all, I filed #19670. IIRC @nox had a stronger opinion than me at this regarding dependencies from computed to specified and vice-versa, so if it's not very urgent we could wait for different arguments to come in there and then make a decision and move all of them :)

@emilio
emilio approved these changes Jan 1, 2018
Copy link
Member

emilio left a comment

This looks great, thanks @mauricioc!

}
}

impl ToComputedValue for SpecifiedBorderImageRepeat {

This comment has been minimized.

Copy link
@emilio

emilio Jan 1, 2018

Member

I think it's fine to keep this consistent with BackgroundRepeat for now.

///
/// https://drafts.csswg.org/css-backgrounds/#propdef-border-image-repeat
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct BorderImageRepeat(pub RepeatKeyword, pub RepeatKeyword);

This comment has been minimized.

Copy link
@emilio

emilio Jan 1, 2018

Member

We already have a RepeatKeyword in the background module, maybe rename that one as BackgroundRepeatKeyword, and this as BorderImageRepeatKeyword as a followup?

This comment has been minimized.

Copy link
@collares

collares Jan 1, 2018

Author Contributor

(Background)RepeatKeyword appeared in gecko.mako.rs in two places before my changes. The first one is clearly rename-able, but the second one is in fn to_servo(repeat: StyleImageLayerRepeat) -> RepeatKeyword. Is RepeatKeyword being used here in the background sense, or is it being reused for some other purpose? Does this affect the renaming decision? Either way, I've renamed the RepeatKeyword I just added to BorderImageRepeatKeyword.

This comment has been minimized.

Copy link
@emilio

emilio Jan 1, 2018

Member

ImageLayerRepeat is definitely related to backgrounds in Gecko terminology, so I think it's fine to rename both.

@emilio
Copy link
Member

emilio commented Jan 1, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2018

📌 Commit 9695d49 has been approved by emilio

@emilio
Copy link
Member

emilio commented Jan 1, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2018

📌 Commit 9a58fd7 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2018

Testing commit 9a58fd7 with merge 8dacd16...

bors-servo added a commit that referenced this pull request Jan 1, 2018
style: Move border-image-repeat outside of mako.

Part of #19015.

r? emilio

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19021
- [X] These changes do not require tests

<!-- 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/19668)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2018

💔 Test failed - mac-dev-unit

@collares
Copy link
Contributor Author

collares commented Jan 1, 2018

Due to some miscommunication, there is a parallel PR for the same issue (I noticed this by coincidence while checking bors' queue). Since I believe this is a great first bug, since I forgot about this one for a long time, and since the other PR has been in the works for a while, I am giving it priority and closing this one. I will do #19671 instead :)

@emilio
Copy link
Member

emilio commented Jan 1, 2018

For the record, the other PR is #19210, sorry I didn't caught that before :(

bors-servo added a commit that referenced this pull request Feb 1, 2018
style: Move border-image-repeat outside of mako.

This is a rebased / nitpick-addressed / bug-fixed version of #19021, and with a commit from #19668 renaming the two `RepeatKeyword`s to different names.

<!-- 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/19924)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Feb 1, 2018
style: Move border-image-repeat outside of mako.

This is a rebased / nitpick-addressed / bug-fixed version of #19021, and with a commit from #19668 renaming the two `RepeatKeyword`s to different names.

<!-- 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/19924)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Feb 1, 2018
style: Move border-image-repeat outside of mako.

This is a rebased / nitpick-addressed / bug-fixed version of #19021, and with a commit from #19668 renaming the two `RepeatKeyword`s to different names.

<!-- 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/19924)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.