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

Supports border-style: double. #329

Merged
merged 1 commit into from Aug 15, 2016
Merged

Conversation

@mephisto41
Copy link
Contributor

mephisto41 commented Aug 5, 2016

Add support for border-style: double.


This change is Reviewable

@glennw
Copy link
Member

glennw commented Aug 5, 2016

@mephisto41 Thanks! Could you take a look over this please @changm ?

// The idea here is, offset pos by (1/3 * len) then mod it by len.
// And if this value is lesser than (2/3 * len) then we're in
// blank part. Thus, we can use only 1 check instead of 2.
float compared_pos = mod(pos + one_third_len, len);

This comment has been minimized.

@changm

changm Aug 8, 2016

Contributor

How does this work? Let's say I have a length of 100 and I want to see of pos 50 is in the blank part.

So 0- 33 - Filled
33 - 66 - Blank
66 - 100 filled

(1/3) * len = 33 here

So offset 50 would be:
50 + 33 = 83
83 % 100 = 83

This doesn't match the comment, but it does match the code. In the code you're checking that compared_pos is greater than 2/3, which if true, means its in the blank part. Please fix the comment. I think should be "greater than (2/3 * len).

nit: I'd rather do the most obvious thing here and just do two checks.

Also, I should fix the other borders too, but please do the calculations in local space rather than device space. Thanks!

This comment has been minimized.

@mephisto41

mephisto41 Aug 9, 2016

Author Contributor

I change my implementation so it is easier to understand. And also calculations in local space. Would you check it again? Thanks very much.

@mephisto41 mephisto41 force-pushed the mephisto41:border-style-double branch from 566f0f3 to f194279 Aug 9, 2016
return draw_double_edge_with_radius();
}

bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? vF < 0 : vF >= 0;

This comment has been minimized.

@changm

changm Aug 9, 2016

Contributor

Thanks for the other fixes!

How does this work for the bottom left corner? Seems like the vertical case shouldn't work here?

This comment has been minimized.

@mephisto41

mephisto41 Aug 10, 2016

Author Contributor

The vF calculation is quiet confuse now. For the vertical case, only the vF on top left corner is lesser than 0. All other 3 corners are greater than 0. I just tweak the vF calculation to make it more consistent. After my tweak, the vF stand for vertical edge if vF > 0 and for horizontal edge if vF < 0 for all corners, without exception. So this is_vertical check would be more clear.

@mephisto41 mephisto41 force-pushed the mephisto41:border-style-double branch from f194279 to ec96584 Aug 10, 2016
@@ -863,8 +863,8 @@ impl Primitive {
details.tl_inner.x,
details.tl_inner.y),
},
vertical_color: details.top_color,

This comment has been minimized.

@changm

changm Aug 10, 2016

Contributor

This will break inset borders. Let's just revert the colors back and keep the top left as is. Sorry for reverting the change. The previous commit works fine. Thanks again!

@mephisto41 mephisto41 force-pushed the mephisto41:border-style-double branch from ec96584 to 76f20bc Aug 12, 2016
@mephisto41
Copy link
Contributor Author

mephisto41 commented Aug 12, 2016

I have reverted to previous commit. Thanks!

@changm
Copy link
Contributor

changm commented Aug 12, 2016

LGTM! Thanks

@glennw care to take a look or merge if you think it's good. Thanks!

@glennw
Copy link
Member

glennw commented Aug 15, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Aug 15, 2016

📌 Commit 76f20bc has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Aug 15, 2016

Testing commit 76f20bc with merge a705a4e...

bors-servo added a commit that referenced this pull request Aug 15, 2016
Supports border-style: double.

Add support for border-style: double.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/329)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 15, 2016

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 76f20bc into servo:master Aug 15, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
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.

None yet

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