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


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #15202 (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 Apr 19, 2017

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

highfive commented Apr 19, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
@chenpighead
Copy link
Contributor Author

chenpighead commented Apr 19, 2017

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

heycam commented Apr 19, 2017

@bors-servo delegate+

@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2017

✌️ @chenpighead can now approve this pull request

@chenpighead
Copy link
Contributor Author

chenpighead commented Apr 19, 2017

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

chenpighead commented Apr 19, 2017

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

@heycam
Copy link
Member

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 chenpighead:stylo-border-reset-border-image branch from f2486b6 to 4352581 Apr 21, 2017
@chenpighead
Copy link
Contributor Author

chenpighead commented Apr 21, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Apr 21, 2017

Trying commit 4352581 with merge 087bf98...

bors-servo added 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

chenpighead commented Apr 21, 2017

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

bors-servo commented Apr 21, 2017

@heycam
Copy link
Member

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

bors-servo commented Apr 23, 2017

📌 Commit 4352581 has been approved by heycam

@bors-servo
Copy link
Contributor

bors-servo commented Apr 23, 2017

Testing commit 4352581 with merge 940fb5c...

bors-servo added 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

bors-servo commented Apr 23, 2017

💔 Test failed - mac-rel-wpt1

@chenpighead
Copy link
Contributor Author

chenpighead commented Apr 23, 2017

@bors-servo: retry

@bors-servo
Copy link
Contributor

bors-servo commented Apr 23, 2017

Testing commit 4352581 with merge 33c6abb...

bors-servo added 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

bors-servo commented Apr 23, 2017

💔 Test failed - linux-rel-wpt

@chenpighead
Copy link
Contributor Author

chenpighead commented Apr 23, 2017

@bors-servo: retry
:-(

@bors-servo
Copy link
Contributor

bors-servo commented Apr 23, 2017

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

bors-servo commented Apr 23, 2017

☀️ 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
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
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.

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