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 upImplement keyword values in border-width #13869
Comments
|
Please make a comment here if you intend to work on this issue. Thank you! |
|
@heycam Gecko stores the constants 1/3/5 in the pres context. Should we be storing them in the computed value context (and fetching them from Gecko in stylo mode)? For this bug I'm just hardcoding them, but we might eventually want to do something else. |
|
I would like to work on this. |
|
Great! Let us know if you have questions! |
|
Hard coding is fine for now. For Gecko, we probably should just change them to be constants defined somewhere rather than exposed through the |
|
Any bug filed on gecko for moving those |
|
There isn't AFAIK. Please feel free to file one! |
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 servo#13869.
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 -->
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 -->
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 servo#13869.
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 -->
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 -->
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 servo#13869.
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 servo#13869.
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 -->
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 -->
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 -->
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 -->
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 -->
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 -->
Please see the property hacking guide first. Familiarity with Rust required. This is not implementing a new property, just extending an existing one.
For
border-foo-width(e.g.border-top-width), we currently support length values. However, this struct supports keywords too.We currently parse it as
<length>, but the full syntax is<length> | thin | medium | thick. Now, the keyword values map to integer lengths (Firefox maps them to1px,3pxand5pxrespectively, you can useLength::Absolute(1).to_computed_value(context)to get these inAu). So you will have to change theSpecifiedValuestruct so that it can store thin/medium/thick keyword values (as well as lengths), and changeto_computed_valueso that it replaces the keyword values with the stuff specified.You should be able to test this in Servo directly, just create a div and give it different keyword borders.