mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Layout 2013: Don't make gradient display items for zero-sized gradients (#30321)
Before WebRender would ignore these, but newer version of WebRender have issues with them. This change simply prevents legacy layout from creating display items for these types of gradients. This is already the behavior of non-legacy layout.
This commit is contained in:
parent
711dbbd4af
commit
56976efaa2
2 changed files with 22 additions and 7 deletions
|
@ -138,8 +138,10 @@ pub fn clip(
|
||||||
|
|
||||||
/// Determines where to place an element background image or gradient.
|
/// Determines where to place an element background image or gradient.
|
||||||
///
|
///
|
||||||
/// Photos have their resolution as intrinsic size while gradients have
|
/// Images have their resolution as intrinsic size while gradients have
|
||||||
/// no intrinsic size.
|
/// no intrinsic size.
|
||||||
|
///
|
||||||
|
/// Return `None` if the background size is zero, otherwise a [`BackgroundPlacement`].
|
||||||
pub fn placement(
|
pub fn placement(
|
||||||
bg: &Background,
|
bg: &Background,
|
||||||
viewport_size: Size2D<Au>,
|
viewport_size: Size2D<Au>,
|
||||||
|
@ -149,7 +151,7 @@ pub fn placement(
|
||||||
border_padding: SideOffsets2D<Au>,
|
border_padding: SideOffsets2D<Au>,
|
||||||
border_radii: BorderRadius,
|
border_radii: BorderRadius,
|
||||||
index: usize,
|
index: usize,
|
||||||
) -> BackgroundPlacement {
|
) -> Option<BackgroundPlacement> {
|
||||||
let bg_attachment = *get_cyclic(&bg.background_attachment.0, index);
|
let bg_attachment = *get_cyclic(&bg.background_attachment.0, index);
|
||||||
let bg_clip = *get_cyclic(&bg.background_clip.0, index);
|
let bg_clip = *get_cyclic(&bg.background_clip.0, index);
|
||||||
let bg_origin = *get_cyclic(&bg.background_origin.0, index);
|
let bg_origin = *get_cyclic(&bg.background_origin.0, index);
|
||||||
|
@ -180,6 +182,9 @@ pub fn placement(
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut tile_size = compute_background_image_size(bg_size, bounds.size, intrinsic_size);
|
let mut tile_size = compute_background_image_size(bg_size, bounds.size, intrinsic_size);
|
||||||
|
if tile_size.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let mut tile_spacing = Size2D::zero();
|
let mut tile_spacing = Size2D::zero();
|
||||||
let own_position = bounds.size - tile_size;
|
let own_position = bounds.size - tile_size;
|
||||||
|
@ -206,14 +211,18 @@ pub fn placement(
|
||||||
clip_rect.size.height,
|
clip_rect.size.height,
|
||||||
);
|
);
|
||||||
|
|
||||||
BackgroundPlacement {
|
if tile_size.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(BackgroundPlacement {
|
||||||
bounds,
|
bounds,
|
||||||
tile_size,
|
tile_size,
|
||||||
tile_spacing,
|
tile_spacing,
|
||||||
clip_rect,
|
clip_rect,
|
||||||
clip_radii,
|
clip_radii,
|
||||||
fixed,
|
fixed,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tile_image_round(
|
fn tile_image_round(
|
||||||
|
|
|
@ -831,9 +831,10 @@ impl Fragment {
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
|
|
||||||
if placement.tile_size.is_empty() {
|
let placement = match placement {
|
||||||
return;
|
Some(placement) => placement,
|
||||||
}
|
None => return,
|
||||||
|
};
|
||||||
|
|
||||||
state.clipping_and_scrolling_scope(|state| {
|
state.clipping_and_scrolling_scope(|state| {
|
||||||
if !placement.clip_radii.is_zero() {
|
if !placement.clip_radii.is_zero() {
|
||||||
|
@ -953,6 +954,11 @@ impl Fragment {
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let placement = match placement {
|
||||||
|
Some(placement) => placement,
|
||||||
|
None => return,
|
||||||
|
};
|
||||||
|
|
||||||
state.clipping_and_scrolling_scope(|state| {
|
state.clipping_and_scrolling_scope(|state| {
|
||||||
if !placement.clip_radii.is_zero() {
|
if !placement.clip_radii.is_zero() {
|
||||||
let clip_id =
|
let clip_id =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue