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

stylo: store specified value of grid layout repeat() function #18206

Merged
merged 1 commit into from Sep 11, 2017

Conversation

@ferjm
Copy link
Member

ferjm commented Aug 23, 2017

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix Bug 1382369

This change is Reviewable

@highfive
Copy link

highfive commented Aug 23, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/gecko.mako.rs, components/style/values/specified/grid.rs, components/style/values/generics/grid.rs, components/style/gecko/conversions.rs, components/style/properties/shorthand/position.mako.rs
  • @canaltinova: components/style/properties/gecko.mako.rs, components/style/values/specified/grid.rs, components/style/values/generics/grid.rs, components/style/gecko/conversions.rs, components/style/properties/shorthand/position.mako.rs
  • @emilio: components/style/properties/gecko.mako.rs, components/style/values/specified/grid.rs, components/style/values/generics/grid.rs, components/style/gecko/conversions.rs, components/style/properties/shorthand/position.mako.rs
@highfive
Copy link

highfive commented Aug 23, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
Copy link
Member

emilio left a comment

Looks fine overall, sorry for the lag in getting here.

Maybe @canaltinova also wants to take a quick look?

@@ -78,6 +78,17 @@ impl Parse for TrackSize<LengthOrPercentage> {
}
}

impl HasViewportPercentage for TrackListValue<LengthOrPercentage> {

This comment has been minimized.

@emilio

emilio Aug 25, 2017

Member

You can use derive(HasViewportPercentage).

};
for (pos, names) in self.line_names.iter().enumerate() {
prev_names.extend_from_slice(&names);
if (pos >= self.values.len()) || (pos == auto_idx) {

This comment has been minimized.

@emilio

emilio Aug 25, 2017

Member

nit: no need for parentheses here.

fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
match *self {
TrackListValue::TrackSize(ref size) => TrackListValue::TrackSize(size.to_computed_value(context)),
_ => unreachable!("Should only compute track-size values"),

This comment has been minimized.

@emilio

emilio Aug 25, 2017

Member

hmm... this looks somewhat suspicious... Maybe something should be refactored here? Maybe it's worth to just make it idempotent (in which case you can use derive(ToComputedValue).

impl<L: ToCss> ToCss for TrackListValue<L> {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
TrackListValue::TrackSize(ref size) => size.to_css(dest),

This comment has been minimized.

@emilio

emilio Aug 25, 2017

Member

I'm moderately sure you can derive(ToCss) here and remove this code.

@ferjm
Copy link
Member Author

ferjm commented Aug 25, 2017

Thank you Emilio! It seems that the patch breaks some of the existing tests. I'll see if I can fix it.

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2017

The latest upstream changes (presumably #18239) made this pull request unmergeable. Please resolve the merge conflicts.

@ferjm ferjm force-pushed the ferjm:bug1382369.grid.repeat.function branch from 831bd25 to 13637ef Aug 31, 2017
@ferjm
Copy link
Member Author

ferjm commented Aug 31, 2017

No failures on try, so I think this is good to go.

r? @canaltinova and/or @emilio

Thank you!

@highfive highfive assigned canova and unassigned emilio Aug 31, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Aug 31, 2017

The latest upstream changes (presumably #18301) made this pull request unmergeable. Please resolve the merge conflicts.

@ferjm ferjm force-pushed the ferjm:bug1382369.grid.repeat.function branch from 13637ef to 23fcbc7 Sep 1, 2017
@ferjm
Copy link
Member Author

ferjm commented Sep 4, 2017

The travisCI error seems to be #18346.

Copy link
Member

wafflespeanut left a comment

Sorry, didn't look into this earlier. Overall, this looks good to me. r=me after the comment

/// Track list values. Can be <track-size> or <track-repeat>
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum TrackListValue<T> {

This comment has been minimized.

@wafflespeanut

wafflespeanut Sep 5, 2017

Member

We could use Either here - not sure whether it's particularly useful, but that's what I did on 26540df 😄

This comment has been minimized.

@ferjm

ferjm Sep 6, 2017

Author Member

TBH I would prefer to keep the current enum if you don't mind. Either syntax feels less clear than an explicit enum, specially since we need to do things like https://github.com/servo/servo/pull/18206/files#diff-ea526b2e68fb17c4d9af5ce82d3cc64eR899

let vec = mem::replace(&mut current_names, vec![]);
names.push(vec.into_boxed_slice());
if let RepeatCount::Number(num) = repeat.count {
auto_offset += (num.value() - 1) as u16;

This comment has been minimized.

@wafflespeanut

wafflespeanut Sep 5, 2017

Member

This isn't obvious. Please drop a comment about this 😄

This comment has been minimized.

@ferjm

ferjm Sep 6, 2017

Author Member

Done. I added the comment to the binding definition.

@ferjm ferjm force-pushed the ferjm:bug1382369.grid.repeat.function branch from 23fcbc7 to 8306946 Sep 6, 2017
@ferjm
Copy link
Member Author

ferjm commented Sep 11, 2017

Mochitests changes has been approved. So this is ready to merge.

@bors-servo: r=wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Sep 11, 2017

📌 Commit 8306946 has been approved by wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Sep 11, 2017

Testing commit 8306946 with merge 8129cf5...

bors-servo added a commit that referenced this pull request Sep 11, 2017
…espeanut

stylo: store specified value of grid layout repeat() function

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1382369](https://bugzilla.mozilla.org/show_bug.cgi?id=1382369)

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

bors-servo commented Sep 11, 2017

@bors-servo bors-servo merged commit 8306946 into servo:master Sep 11, 2017
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
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.

None yet

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