Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstylo: store specified value of grid layout repeat() function #18206
Conversation
highfive
commented
Aug 23, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Aug 23, 2017
|
Waiting for a try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=ce7e06023cd900772347d9977cfa8c65fd294b3a |
|
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.
This comment has been minimized.
| }; | ||
| 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.
This comment has been minimized.
| 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.
This comment has been minimized.
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.
This comment has been minimized.
|
Thank you Emilio! It seems that the patch breaks some of the existing tests. I'll see if I can fix it. |
|
|
|
New try build with some fixes: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b3ad97987b5b37a2f5cd769e3208981ea87f3976&selectedJob=126798800 |
831bd25
to
13637ef
|
No failures on try, so I think this is good to go. r? @canaltinova and/or @emilio Thank you! |
|
|
13637ef
to
23fcbc7
|
The travisCI error seems to be #18346. |
|
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
23fcbc7
to
8306946
|
Mochitests changes has been approved. So this is ready to merge. @bors-servo: r=wafflespeanut |
|
|
…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 -->
|
|
ferjm commentedAug 23, 2017
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is