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 upFix linear gradient's specified form #13892
Comments
|
@AVGP Are you still working on this? You can ask here if you have any questions. |
|
Absolutely, sorry that it takes me so long, just swamped with work but Am 07.11.2016 10:04 vorm. schrieb "Nazım Can Altınova" <
|
|
@AVGP next week never came... |
|
I'd like to give this one a shot |
|
@DominoTree Sure, go ahead! Btw, the links were showing wrong lines because of code changes over time. Updated them. You can ask here if something is unclear. |
|
@canaltinova I've been hacking on this some but I'm having trouble wrapping my head around it as a whole. Could you take a look at master...DominoTree:master and see if it looks like I'm moving in the right direction or if anything jumps out at you? Right now, I'm trying to figure out the |
|
@DominoTree Looks like you're in the right path! You need to also remove AngleOrCorner from here and create an AngleOrCorner enum in computed part like this one(Sorry I forgot to mention that): pub enum AngleOrCorner {
Angle(Angle),
Corner(HorizontalDirection, VerticalDirection),
}In this way we have 2 + //TODO: do I need to worry about this?
+ AngleOrCorner::Corner(horizontal, vertical) => {
+ specified::AngleOrCorner::Corner(horizontal, vertical)
+ }This is mostly true, you need to change the line to You can open a WIP PR if you like and we can help you more. It's a bit hard to point a line in this way :) |
Fix linear gradient's specified form #13892 <!-- Please describe your changes on the following line: --> WIP for #13892 --- <!-- 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 #13892 (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/14598) <!-- Reviewable:end -->
Currently linear gradient is not preserving the current corner directions if just one corner is specified. We should fix thix. The specified form of the linear gradient should preserve the corners and it should convert to angle in ToComputedValue implementation.
To give a more details, you need to convert this enum's
HorizontalDirectionandVerticalDirectiontoOption<HorizontalDirection>andOption<HorizontalDirection>and set it here directly without converting to Angle.This corner to angle conversion should be moved to ToComputedValue implementation, to do this you should remove this line and write the implementation in
components/style/values/computed/image.rsGradientKind implemetation should give a hint to how to do it.Also you can see this part of the Property hacking guide to see how to implement a ToComputedValue conversion.
It may require some additional changes but compile errors will give you hint about that. And of course you can ask here if you have any questions.