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

Convert column-width to use Either #14394

Merged
merged 1 commit into from Dec 2, 2016

Conversation

@jcdyer
Copy link
Contributor

jcdyer commented Nov 28, 2016

  • Converted column-width to use Either<Length, Auto>
  • Added gecko glue code
  • Cleaned up old column-width glue code

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14350 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because tests already surround the refactored code.

This change is Reviewable

@highfive
Copy link

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
Copy link

highfive commented Nov 28, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/gecko.mako.rs, components/style/values/mod.rs, components/style/values/computed/length.rs, components/style/properties/longhand/column.mako.rs, components/style/values/specified/length.rs, components/style/properties/properties.mako.rs, components/style/gecko/values.rs
  • @emilio: components/style/properties/gecko.mako.rs, components/style/values/mod.rs, components/style/values/computed/length.rs, components/style/properties/longhand/column.mako.rs, components/style/values/specified/length.rs, components/style/properties/properties.mako.rs, components/style/gecko/values.rs, components/layout/multicol.rs
@jcdyer jcdyer force-pushed the jcdyer:jcdyer/either-column-width branch from 879b5ee to 2b759bc Nov 28, 2016
@jcdyer
Copy link
Contributor Author

jcdyer commented Nov 28, 2016

I just rebased, and it looks like some method signatures changed. I'll give this another look soon.

@jcdyer jcdyer force-pushed the jcdyer:jcdyer/either-column-width branch 2 times, most recently from 3f03cde to d2f26f5 Nov 28, 2016
@jcdyer
Copy link
Contributor Author

jcdyer commented Nov 29, 2016

I had a little trouble with the gecko glue, but I figured it out. I was originally referencing "LengthOrAuto" in the predefined types in the gecko.mako.rs template, but it should have been "length::LengthOrAuto".

@jcdyer jcdyer force-pushed the jcdyer:jcdyer/either-column-width branch from d2f26f5 to 92d2f05 Nov 29, 2016
Copy link
Member

wafflespeanut left a comment

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.

Copy link
@wafflespeanut

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.

Copy link
@wafflespeanut

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.

Copy link
@wafflespeanut

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.

Copy link
@wafflespeanut

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.

Copy link
@jcdyer

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.

Copy link
@wafflespeanut

wafflespeanut Nov 29, 2016

Member

Oops. 😅

@jcdyer jcdyer force-pushed the jcdyer:jcdyer/either-column-width branch from abbca03 to b7e1173 Nov 29, 2016
@jcdyer
Copy link
Contributor Author

jcdyer commented Nov 29, 2016

That failure seems unrelated to my work. Any suggestions?

@wafflespeanut
Copy link
Member

wafflespeanut commented Nov 29, 2016

Yep, it's unrelated :)

@wafflespeanut
Copy link
Member

wafflespeanut commented Nov 29, 2016

Squash the commits, and we'll be good to go :)

@jcdyer jcdyer force-pushed the jcdyer:jcdyer/either-column-width branch from b7e1173 to 7c22143 Nov 29, 2016
@jcdyer
Copy link
Contributor Author

jcdyer commented Nov 29, 2016

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.

@KiChjang
Copy link
Member

KiChjang commented Nov 29, 2016

@bors-servo r=Wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Nov 29, 2016

📌 Commit 7c22143 has been approved by Wafflespeanut

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 1, 2016

@emilio I'm re-enabling the test (it passes for me locally)

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

📌 Commit e6c22ec has been approved by Wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

Testing commit e6c22ec with merge 4f9a66a...

bors-servo added a commit that referenced this pull request Dec 1, 2016
…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 -->
Fixes #14350
@wafflespeanut wafflespeanut force-pushed the jcdyer:jcdyer/either-column-width branch from e6c22ec to 5821ff7 Dec 1, 2016
@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

📌 Commit 5821ff7 has been approved by Wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

Testing commit 5821ff7 with merge 5a6cf40...

bors-servo added a commit that referenced this pull request Dec 1, 2016
…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
Copy link
Contributor

bors-servo commented Dec 1, 2016

💔 Test failed - linux-rel-wpt

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 2, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 2, 2016

Testing commit 5821ff7 with merge a913815...

bors-servo added a commit that referenced this pull request Dec 2, 2016
…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
Copy link
Contributor

bors-servo commented Dec 2, 2016

@bors-servo bors-servo merged commit 5821ff7 into servo:master Dec 2, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
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.

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