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

Reset longhands of border-image to their initial value while parsing border shorthand #16522

Merged

Conversation

chenpighead
Copy link
Contributor

@chenpighead chenpighead commented Apr 19, 2017

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands


  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/shorthand/border.mako.rs
  • @emilio: components/style/properties/shorthand/border.mako.rs

@highfive
Copy link

warning Warning warning

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

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 19, 2017
@chenpighead
Copy link
Contributor Author

r? @heycam

Set reviewer first, although stylo try is not done yet...
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b60ef8e6024d2134891d090d37647dcb8ff72755

@highfive highfive assigned heycam and unassigned pcwalton Apr 19, 2017
@heycam
Copy link
Contributor

heycam commented Apr 19, 2017

@bors-servo delegate+

@bors-servo
Copy link
Contributor

✌️ @chenpighead can now approve this pull request

@chenpighead
Copy link
Contributor Author

Hmmm... I'm a bit confused about the two test failures. @heycam, does that means we'd like to see

border-top: 4px solid; border-right: 4px solid; border-bottom: 4px solid; border-left: 4px solid;

to be serialized to

border: 4px solid;

?

@chenpighead
Copy link
Contributor Author

I guess we might need a special case to handle border::LonghandsToSerialize... :(

@heycam
Copy link
Contributor

heycam commented Apr 19, 2017

In general, CSS declarations are serialized using the shortest longhand possible that can be used to account for properties in the declaration. In this case, none of border-{top,right,bottom,left} set the border-image-* properties, but the border shorthand does, so it means we shouldn't serialize to border: 4px solid. (We would if the declaration was border-top: 4px solid; border-right: 4px solid; border-bottom: 4px solid; border-left: 4px solid; border-image: none;.)

Although it looks like Gecko will serialize that to border-width: 4px; border-style: solid; border-color: currentcolor;, so maybe there is a bug in Declaration::ToString. @Xidorn, do you know?

…parsing border shorthand.

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them. This could fix couple stylo test failures.
See Gecko Bug 1357350 for the test update patches.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

Note that two unit tests have been fixed as well:

1. border_should_serialize_correctly
To verify the correctness of serialization of 'border' shorthand, we need
to reset 'border-image' as well.

2. same_longhands_should_serialize_correctly
Due to the same reason as above, since the 'border-image' is not reset,
the test expectation should be fixed.
@chenpighead chenpighead force-pushed the stylo-border-reset-border-image branch from f2486b6 to 4352581 Compare April 21, 2017 11:07
@chenpighead
Copy link
Contributor Author

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 4352581 with merge 087bf98...

bors-servo pushed a commit that referenced this pull request Apr 21, 2017
…=<try>

Reset longhands of border-image to their initial value while parsing border shorthand

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

<!-- Please describe your changes on the following line: -->

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

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16522)
<!-- Reviewable:end -->
@chenpighead
Copy link
Contributor Author

I've fixed the failures by patching the two failed unit tests.

  1. border_should_serialize_correctly
    To verify the correctness of serialization of 'border' shorthand, we need to reset 'border-image' as well. This fix also makes the test to be agreed with the example listed in the spec.

  2. same_longhands_should_serialize_correctly
    Due to the same reason as above, since the 'border-image' is not reset, the test expectation should be fixed now.

@heycam, could you review the test fix?

@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
State: approved= try=True

@heycam
Copy link
Contributor

heycam commented Apr 23, 2017

Those test changes look good to me, thanks!

@jdm
Copy link
Member

jdm commented Apr 23, 2017

@bors-servo: r=heycam

@bors-servo
Copy link
Contributor

📌 Commit 4352581 has been approved by heycam

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Apr 23, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 4352581 with merge 940fb5c...

bors-servo pushed a commit that referenced this pull request Apr 23, 2017
…=heycam

Reset longhands of border-image to their initial value while parsing border shorthand

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

<!-- Please describe your changes on the following line: -->

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

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

💔 Test failed - mac-rel-wpt1

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Apr 23, 2017
@chenpighead
Copy link
Contributor Author

@bors-servo: retry

@bors-servo
Copy link
Contributor

⌛ Testing commit 4352581 with merge 33c6abb...

bors-servo pushed a commit that referenced this pull request Apr 23, 2017
…=heycam

Reset longhands of border-image to their initial value while parsing border shorthand

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

<!-- Please describe your changes on the following line: -->

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

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16522)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 23, 2017
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Apr 23, 2017
@chenpighead
Copy link
Contributor Author

@bors-servo: retry
:-(

@bors-servo
Copy link
Contributor

⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-wpt1, windows-msvc-dev are reusable. Rebuilding only linux-rel-wpt, mac-rel-css, mac-rel-wpt2...

@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: heycam
Pushing 33c6abb to master...

@bors-servo bors-servo merged commit 4352581 into servo:master Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-tests-failed The changes caused existing tests to fail.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting border and border-[side] shorthands should reset longhands of border-image to their initial value
6 participants