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

Add groove and ridge border support. #2465

Merged
merged 6 commits into from
May 22, 2014

Conversation

bjwbell
Copy link
Contributor

@bjwbell bjwbell commented May 20, 2014

Matches Chrome's rendering behavior for groove and ridge borders (I can attach comparison images, if wanted).

@hoppipolla-critic-bot
Copy link

Critic review: https://critic.hoppipolla.co.uk/r/1597

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

fn get_scaled_bounds(&self,
bounds : &Rect<Au>,
border : SideOffsets2D<f32>,
shrink_factor : f32) -> (Point2D<f32>, Point2D<f32>, Point2D<f32>, Point2D<f32>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: style in this file is to not line up the colons.

@pcwalton
Copy link
Contributor

This is excellent, probably the cleanest implementation of border drawing I've ever seen in a browser engine. :)

Is it possible to add a reftest, perhaps using an image as the reference? (See acid1.html as an example.) This is the kind of thing that could regress easily without someone noticing.

@bjwbell
Copy link
Contributor Author

bjwbell commented May 20, 2014

Thanks for the review Pat!
I'll make the style changes and add a reftest.

Don't line up :'s in render_context.rs (style)
@bjwbell
Copy link
Contributor Author

bjwbell commented May 21, 2014

Added ref test and style changes.
Solid borders are not in the ref test due to differences between CPU & GPU rendering (not sure why).
Commit: bjwbell@afe0c0b

…port

Significant cleanup of border support, adds inset & outset border code. Border rendering matches
Chrome's border rendering.
@bjwbell
Copy link
Contributor Author

bjwbell commented May 21, 2014

Sry I must have been on something when adding the groove and ridge borders! The square & short end structures + code weren't needed.

I've cleaned up the code + added inset/outset support @ bjwbell@2bb5c8b

Include in this pull request or do a new one?

Cleanup whitespace + move functions for easier reading.
@bjwbell
Copy link
Contributor Author

bjwbell commented May 21, 2014

Added double border support (with ref test)
bjwbell@13bfaeb
With that commit border support should be complete.

@pcwalton
Copy link
Contributor

You can include it in this PR.

fn get_scaled_bounds(&self,
bounds: &Rect<Au>,
border: SideOffsets2D<f32>,
shrink_factor: f32) -> (Point2D<f32>, Point2D<f32>, Point2D<f32>, Point2D<f32>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you return a Rect<f32> here instead? At the least this 4-tuple should be turned into a struct so that the fields are self-documenting.

@pcwalton
Copy link
Contributor

Looks pretty good modulo a few style nits, thanks!

border: SideOffsets2D<f32>,
color: Color,
fn draw_border_path(&self,
bounds: (Point2D<f32>, Point2D<f32>, Point2D<f32>, Point2D<f32>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this a Rect or at least a struct? Four tuple elements aren't that self documenting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make it a Rect, my excuse for not already doing it is lazyness.

@pcwalton
Copy link
Contributor

Looks good modulo nits. 🤘

Also includes other minor code cleanup.
@bjwbell
Copy link
Contributor Author

bjwbell commented May 22, 2014

Added in the review comments. Hopefully no more nits ;)

bors-servo pushed a commit that referenced this pull request May 22, 2014
Matches Chrome's rendering behavior for groove and ridge borders (I can attach comparison images, if wanted).
@bors-servo bors-servo closed this May 22, 2014
@bors-servo bors-servo merged commit 172c3b8 into servo:master May 22, 2014
@bjwbell bjwbell deleted the groove-ridge-borders branch May 27, 2014 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants