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

Implement radial gradients #16385

Merged
merged 9 commits into from Apr 29, 2017

Fix gradient position if background-clip is present.

  • Loading branch information
pyfisch committed Apr 27, 2017
commit c9461985c17ba4860b2e48953f722580d1ae82be
@@ -409,6 +409,7 @@ pub trait FragmentDisplayListBuilding {
state: &mut DisplayListBuildState,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip_bounds: &Rect<Au>,
clip: &ClippingRegion,
gradient: &Gradient,
style: &ServoComputedValues);
@@ -803,6 +804,7 @@ impl FragmentDisplayListBuilding for Fragment {
Some(computed::Image::Gradient(ref gradient)) => {
self.build_display_list_for_background_gradient(state,
display_list_section,
&absolute_bounds,
&bounds,
&clip,
gradient,
@@ -1132,18 +1134,19 @@ impl FragmentDisplayListBuilding for Fragment {
state: &mut DisplayListBuildState,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip_bounds: &Rect<Au>,
clip: &ClippingRegion,
gradient: &Gradient,
style: &ServoComputedValues) {
let mut clip = clip.clone();
clip.intersect_rect(absolute_bounds);
clip.intersect_rect(clip_bounds);

let border = style.logical_border_width().to_physical(style.writing_mode);
let border_padding = self.border_padding.to_physical(style.writing_mode);
let mut bounds = *absolute_bounds;
bounds.origin.x += border.left;
bounds.origin.y += border.top;
bounds.size.width -= border.horizontal();
bounds.size.height -= border.vertical();
bounds.origin.x = bounds.origin.x + border_padding.left;
bounds.origin.y = bounds.origin.y + border_padding.top;
bounds.size.width = bounds.size.width - border_padding.horizontal();
bounds.size.height = bounds.size.height - border_padding.vertical();

let base = state.create_base_display_item(&bounds,
&clip,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.