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 upConvert column-width to use Either #14394
Conversation
highfive
commented
Nov 28, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon. |
highfive
commented
Nov 28, 2016
|
Heads up! This PR modifies the following files:
|
879b5ee
to
2b759bc
|
I just rebased, and it looks like some method signatures changed. I'll give this another look soon. |
3f03cde
to
d2f26f5
|
I had a little trouble with the gecko glue, but I figured it out. I was originally referencing |
d2f26f5
to
92d2f05
|
Just a few changes before we land :) |
| "Either::Second(Auto)", | ||
| parse_method="parse_non_negative_length", | ||
| products="gecko servo", | ||
| gecko_ffi_name="mColumnWidth", |
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Nov 29, 2016
Member
We won't be needing products and gecko_ffi_name. The Mako helper will generate this.
| @@ -953,6 +953,18 @@ impl Parse for LengthOrPercentageOrNone { | |||
|
|
|||
| pub type LengthOrNone = Either<Length, None_>; | |||
|
|
|||
| pub type LengthOrAuto = Either<Length, Auto>; | |||
|
|
|||
| impl LengthOrAuto { | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Nov 29, 2016
Member
This impl won't be necessary, I think, since we're going for the generic parse_non_negative_length introduced lately?
| @@ -104,6 +104,19 @@ pub enum Either<A, B> { | |||
| Second(B), | |||
| } | |||
|
|
|||
| impl<A, B> Either<A, B> { | |||
| pub fn is_first(&self) -> bool { | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Nov 29, 2016
Member
We had these methods earlier, but ended up removing them, because they give vague/no information about the underlying type (which is the important downside of Either). Instead, we could just use if let patterns wherever possible to remind ourselves about Either type. Anyway, please remove this impl
| @@ -1145,7 +1145,7 @@ impl ComputedValues { | |||
| #[inline] | |||
| pub fn is_multicol(&self) -> bool { | |||
| let style = self.get_column(); | |||
| style.column_count.0.is_some() || style.column_width.0.is_some() | |||
| style.column_count.0.is_some() || style.column_width.is_first() | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Nov 29, 2016
Member
We should do something like,
match (style.column_count, style.column_width) {
(Some(ref _count), Either::First(ref _length)) => true,
_ => false,
}... so that it'll be self-explanatory :)
This comment has been minimized.
This comment has been minimized.
jcdyer
Nov 29, 2016
Author
Contributor
I think your version is the equivalent of &&, not ||. But I get the idea. Will do.
This comment has been minimized.
This comment has been minimized.
abbca03
to
b7e1173
|
That failure seems unrelated to my work. Any suggestions? |
|
Yep, it's unrelated :) |
|
Squash the commits, and we'll be good to go :) |
b7e1173
to
7c22143
|
Appveyor failed again. https://ci.appveyor.com/project/servo/servo/build/1.0.11157/job/8ye06qtvjnak6i1p Different crate (angle this time). The previous build was fontsan. |
|
@bors-servo r=Wafflespeanut |
|
|
|
@emilio I'm re-enabling the test (it passes for me locally) @bors-servo r+ |
|
|
…anut Convert column-width to use Either <!-- Please describe your changes on the following line: --> * Converted column-width to use `Either<Length, Auto>` * Added gecko glue code * Cleaned up old column-width glue code --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #14350 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because tests already surround the refactored code. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14394) <!-- Reviewable:end -->
e6c22ec
to
5821ff7
|
@bors-servo r+ |
|
|
|
|
…anut Convert column-width to use Either <!-- Please describe your changes on the following line: --> * Converted column-width to use `Either<Length, Auto>` * Added gecko glue code * Cleaned up old column-width glue code --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #14350 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because tests already surround the refactored code. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14394) <!-- Reviewable:end -->
|
|
|
@bors-servo retry #14437 #14438 |
|
|
…anut Convert column-width to use Either <!-- Please describe your changes on the following line: --> * Converted column-width to use `Either<Length, Auto>` * Added gecko glue code * Cleaned up old column-width glue code --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #14350 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because tests already surround the refactored code. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14394) <!-- Reviewable:end -->
|
|
jcdyer commentedNov 28, 2016
•
edited
Either<Length, Auto>./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is