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

Use enum BorderWidth as SpecifiedValue #13908

Merged
merged 1 commit into from Oct 30, 2016

Conversation

@aethanyc
Copy link
Contributor

aethanyc commented Oct 24, 2016

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in specified module.

Fixed #13869.


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

This change is Reviewable

@highfive
Copy link

highfive commented Oct 24, 2016

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

@highfive
Copy link

highfive commented Oct 24, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/specified/mod.rs, components/style/properties/shorthand/border.mako.rs, components/style/properties/longhand/border.mako.rs
  • @KiChjang: components/script/dom/element.rs
  • @fitzgen: components/script/dom/element.rs
  • @emilio: components/style/values/specified/mod.rs, components/style/properties/shorthand/border.mako.rs, components/style/properties/longhand/border.mako.rs
@aethanyc
Copy link
Contributor Author

aethanyc commented Oct 24, 2016

@aethanyc
Copy link
Contributor Author

aethanyc commented Oct 24, 2016

This change only adds keyword support to the specified value. The type of computed value remains as Au. I'm not sure whether I need to take care of the computed value in this issue or not. Because the keyword value turns into Au in to_computed_value, but we don't store other information to turn it back to specified value in from_computed_value.

Also I'm not sure about the test coverage of the serialization of keyword values. Anyway, this is my first servo patch so I feel I'd better post my patch to get feedback as soon as it compiles :)


Review status: 0 of 6 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@emilio
Copy link
Member

emilio commented Oct 24, 2016

This looks pretty good to me!

Because the keyword value turns into Au in to_computed_value, but we don't store other information to turn it back to specified value in from_computed_value.

That's fine, it doesn't need to be a symmetrical operation. The from_computed_value is only going used to put a computed value into the cascade from animations.

The only requisite is that to_computed_value(from_computed_value(computed)) == computed, which holds in this case, but not that from_computed_value(to_computed_value(specified)) == specified.

About serialization, we might have WPT tests in place, or otherwise we have a few files with tests around (see, for example, #13886). I'll trigger a try run so you don't have to do work that is already done by someone else.

@bors-servo: try

@bors-servo
Copy link
Contributor

bors-servo commented Oct 24, 2016

Trying commit ce2ff3e with merge 8ab8cf2...

bors-servo added a commit that referenced this pull request Oct 24, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [x] These changes fix #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/13908)
<!-- Reviewable:end -->
#[inline]
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
match *self {
BorderWidth::Thin => Length::from_px(1.).to_computed_value(context),

This comment has been minimized.

@Manishearth

Manishearth Oct 24, 2016

Member

We should perhaps leave a comment here linking to both the spec and the gecko constants for this

@Manishearth
Copy link
Member

Manishearth commented Oct 24, 2016

but we don't store other information to turn it back to specified value in from_computed_value.

from_computed_value does not need to recover the original specified value. It must only satisfy the property that to_computed_value(from_computed_value(..)) is idempotent.

@Manishearth
Copy link
Member

Manishearth commented Oct 24, 2016

r? @emilio

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

💥 Test timed out

@Manishearth
Copy link
Member

Manishearth commented Oct 25, 2016

@bors-servo retry try

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit ce2ff3e with merge 7567333...

bors-servo added a commit that referenced this pull request Oct 25, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [x] These changes fix #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Oct 25, 2016

💔 Test failed - linux-rel-wpt

@aethanyc aethanyc force-pushed the aethanyc:add-border-width-keyword branch from ce2ff3e to 3f59a0b Oct 25, 2016
@aethanyc
Copy link
Contributor Author

aethanyc commented Oct 25, 2016

@emilio @Manishearth: Thank you for the review and clarify the invariant of from_computed_value.

@bors-servo retry try


Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion.


components/style/values/specified/mod.rs, line 1360 at r1 (raw file):

Previously, Manishearth (Manish Goregaokar) wrote…

We should perhaps leave a comment here linking to both the spec and the gecko constants for this

Done.

Comments from Reviewable

@aethanyc
Copy link
Contributor Author

aethanyc commented Oct 25, 2016

@bors-servo retry try

@emilio
Copy link
Member

emilio commented Oct 25, 2016

@bors-servo: try

@aethanyc: homu only listens to a group of people that have try access (see servo/saltfs). Feel free to make a PR adding yourself to the try list if you want :)

Edit: see servo/saltfs@ba6ee27 for example.

It seems there are no tests passing due to this change, could you write one? Thanks!

@Manishearth
Copy link
Member

Manishearth commented Oct 25, 2016

@bors-servo retry try

bors-servo added a commit that referenced this pull request Oct 25, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [x] These changes fix #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Oct 25, 2016

Trying commit 3f59a0b with merge b3aa782...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit 3f59a0b with merge 1623034...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 27, 2016

💔 Test failed - linux-rel-wpt

@jdm
Copy link
Member

jdm commented Oct 29, 2016

@bors-servo: retry

@bors-servo
Copy link
Contributor

bors-servo commented Oct 29, 2016

Testing commit 0fc38f7 with merge 7fbbbb2...

bors-servo added a commit that referenced this pull request Oct 29, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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 #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Oct 29, 2016

💔 Test failed - linux-rel-wpt

@emilio
Copy link
Member

emilio commented Oct 29, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 29, 2016

Testing commit 0fc38f7 with merge 39958ff...

bors-servo added a commit that referenced this pull request Oct 29, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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 #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Oct 30, 2016

💔 Test failed - linux-rel-wpt

@emilio
Copy link
Member

emilio commented Oct 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 30, 2016

Testing commit 0fc38f7 with merge 357e746...

bors-servo added a commit that referenced this pull request Oct 30, 2016
Use enum BorderWidth as SpecifiedValue

Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.

---
<!-- 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 #13869 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Oct 30, 2016

@bors-servo bors-servo merged commit 0fc38f7 into servo:master Oct 30, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@aethanyc aethanyc deleted the aethanyc:add-border-width-keyword branch Mar 21, 2017
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.

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