mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Servo build fixes.
This commit is contained in:
parent
c1c2b746c8
commit
7d30a7da75
18 changed files with 118 additions and 117 deletions
|
@ -47,7 +47,7 @@ pub fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
|
|||
/// For a given area and an image compute how big the
|
||||
/// image should be displayed on the background.
|
||||
fn compute_background_image_size(
|
||||
bg_size: BackgroundSize,
|
||||
bg_size: &BackgroundSize,
|
||||
bounds_size: Size2D<Au>,
|
||||
intrinsic_size: Option<Size2D<Au>>,
|
||||
) -> Size2D<Au> {
|
||||
|
@ -156,7 +156,7 @@ pub fn placement(
|
|||
let bg_position_x = get_cyclic(&bg.background_position_x.0, index);
|
||||
let bg_position_y = get_cyclic(&bg.background_position_y.0, index);
|
||||
let bg_repeat = get_cyclic(&bg.background_repeat.0, index);
|
||||
let bg_size = *get_cyclic(&bg.background_size.0, index);
|
||||
let bg_size = get_cyclic(&bg.background_size.0, index);
|
||||
|
||||
let (clip_rect, clip_radii) = clip(
|
||||
bg_clip,
|
||||
|
|
|
@ -25,7 +25,7 @@ use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder}
|
|||
///
|
||||
/// [1]: https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||
fn corner_radius(
|
||||
radius: BorderCornerRadius,
|
||||
radius: &BorderCornerRadius,
|
||||
containing_size: UntypedSize2D<Au>,
|
||||
) -> UntypedSize2D<Au> {
|
||||
let w = radius.0.width().to_used_value(containing_size.width);
|
||||
|
@ -91,13 +91,13 @@ pub fn radii(abs_bounds: Rect<Au>, border_style: &Border) -> BorderRadius {
|
|||
overlapping_radii(
|
||||
abs_bounds.size.to_layout(),
|
||||
BorderRadius {
|
||||
top_left: corner_radius(border_style.border_top_left_radius, abs_bounds.size)
|
||||
top_left: corner_radius(&border_style.border_top_left_radius, abs_bounds.size)
|
||||
.to_layout(),
|
||||
top_right: corner_radius(border_style.border_top_right_radius, abs_bounds.size)
|
||||
top_right: corner_radius(&border_style.border_top_right_radius, abs_bounds.size)
|
||||
.to_layout(),
|
||||
bottom_right: corner_radius(border_style.border_bottom_right_radius, abs_bounds.size)
|
||||
bottom_right: corner_radius(&border_style.border_bottom_right_radius, abs_bounds.size)
|
||||
.to_layout(),
|
||||
bottom_left: corner_radius(border_style.border_bottom_left_radius, abs_bounds.size)
|
||||
bottom_left: corner_radius(&border_style.border_bottom_left_radius, abs_bounds.size)
|
||||
.to_layout(),
|
||||
},
|
||||
)
|
||||
|
@ -161,7 +161,7 @@ pub fn image_outset(
|
|||
}
|
||||
|
||||
fn side_image_width(
|
||||
border_image_width: BorderImageSideWidth,
|
||||
border_image_width: &BorderImageSideWidth,
|
||||
border_width: f32,
|
||||
total_length: Au,
|
||||
) -> f32 {
|
||||
|
@ -178,10 +178,10 @@ pub fn image_width(
|
|||
border_area: UntypedSize2D<Au>,
|
||||
) -> LayoutSideOffsets {
|
||||
LayoutSideOffsets::new(
|
||||
side_image_width(width.0, border.top, border_area.height),
|
||||
side_image_width(width.1, border.right, border_area.width),
|
||||
side_image_width(width.2, border.bottom, border_area.height),
|
||||
side_image_width(width.3, border.left, border_area.width),
|
||||
side_image_width(&width.0, border.top, border_area.height),
|
||||
side_image_width(&width.1, border.right, border_area.width),
|
||||
side_image_width(&width.2, border.bottom, border_area.height),
|
||||
side_image_width(&width.3, border.left, border_area.width),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -995,7 +995,7 @@ impl Fragment {
|
|||
};
|
||||
DisplayItem::Gradient(CommonDisplayItem::with_data(base, item, stops))
|
||||
},
|
||||
GradientKind::Radial(shape, center) => {
|
||||
GradientKind::Radial(ref shape, ref center) => {
|
||||
let (gradient, stops) = gradient::radial(
|
||||
style,
|
||||
placement.tile_size,
|
||||
|
@ -1238,7 +1238,7 @@ impl Fragment {
|
|||
stops = linear_stops;
|
||||
NinePatchBorderSource::Gradient(wr_gradient)
|
||||
},
|
||||
GradientKind::Radial(shape, center) => {
|
||||
GradientKind::Radial(ref shape, ref center) => {
|
||||
let (wr_gradient, radial_stops) = gradient::radial(
|
||||
style,
|
||||
border_image_area,
|
||||
|
|
|
@ -91,9 +91,9 @@ fn convert_gradient_stops(
|
|||
color,
|
||||
position: None,
|
||||
}),
|
||||
GradientItem::ComplexColorStop { color, position } => Some(ColorStop {
|
||||
GradientItem::ComplexColorStop { color, ref position } => Some(ColorStop {
|
||||
color,
|
||||
position: Some(position),
|
||||
position: Some(position.clone()),
|
||||
}),
|
||||
_ => None,
|
||||
})
|
||||
|
@ -122,15 +122,18 @@ fn convert_gradient_stops(
|
|||
|
||||
// Step 2: Move any stops placed before earlier stops to the
|
||||
// same position as the preceding stop.
|
||||
let mut last_stop_position = stop_items.first().unwrap().position.unwrap();
|
||||
//
|
||||
// FIXME(emilio): Once we know the offsets, it seems like converting the
|
||||
// positions to absolute at once then process that would be cheaper.
|
||||
let mut last_stop_position = stop_items.first().unwrap().position.as_ref().unwrap().clone();
|
||||
for stop in stop_items.iter_mut().skip(1) {
|
||||
if let Some(pos) = stop.position {
|
||||
if position_to_offset(last_stop_position, total_length) >
|
||||
if let Some(ref pos) = stop.position {
|
||||
if position_to_offset(&last_stop_position, total_length) >
|
||||
position_to_offset(pos, total_length)
|
||||
{
|
||||
stop.position = Some(last_stop_position);
|
||||
}
|
||||
last_stop_position = stop.position.unwrap();
|
||||
last_stop_position = stop.position.as_ref().unwrap().clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +148,7 @@ fn convert_gradient_stops(
|
|||
// `unwrap()` here should never fail because this is the beginning of
|
||||
// a stop run, which is always bounded by a length or percentage.
|
||||
let start_offset =
|
||||
position_to_offset(stop_items[i - 1].position.unwrap(), total_length);
|
||||
position_to_offset(stop_items[i - 1].position.as_ref().unwrap(), total_length);
|
||||
// `unwrap()` here should never fail because this is the end of
|
||||
// a stop run, which is always bounded by a length or percentage.
|
||||
let (end_index, end_stop) = stop_items[(i + 1)..]
|
||||
|
@ -153,7 +156,7 @@ fn convert_gradient_stops(
|
|||
.enumerate()
|
||||
.find(|&(_, ref stop)| stop.position.is_some())
|
||||
.unwrap();
|
||||
let end_offset = position_to_offset(end_stop.position.unwrap(), total_length);
|
||||
let end_offset = position_to_offset(end_stop.position.as_ref().unwrap(), total_length);
|
||||
stop_run = Some(StopRun {
|
||||
start_offset,
|
||||
end_offset,
|
||||
|
@ -168,7 +171,7 @@ fn convert_gradient_stops(
|
|||
stop_run_length * (i - stop_run.start_index) as f32 /
|
||||
((2 + stop_run.stop_count) as f32)
|
||||
},
|
||||
Some(position) => {
|
||||
Some(ref position) => {
|
||||
stop_run = None;
|
||||
position_to_offset(position, total_length)
|
||||
},
|
||||
|
@ -212,7 +215,7 @@ where
|
|||
Size2D::new(cmp(left_side, right_side), cmp(top_side, bottom_side))
|
||||
}
|
||||
|
||||
fn position_to_offset(position: LengthPercentage, total_length: Au) -> f32 {
|
||||
fn position_to_offset(position: &LengthPercentage, total_length: Au) -> f32 {
|
||||
if total_length == Au(0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -289,8 +292,8 @@ pub fn radial(
|
|||
style: &ComputedValues,
|
||||
size: Size2D<Au>,
|
||||
stops: &[GradientItem],
|
||||
shape: EndingShape,
|
||||
center: Position,
|
||||
shape: &EndingShape,
|
||||
center: &Position,
|
||||
repeating: bool,
|
||||
) -> (RadialGradient, Vec<GradientStop>) {
|
||||
let center = Point2D::new(
|
||||
|
@ -299,15 +302,15 @@ pub fn radial(
|
|||
);
|
||||
let radius = match shape {
|
||||
EndingShape::Circle(Circle::Radius(length)) => {
|
||||
let length = Au::from(length);
|
||||
let length = Au::from(*length);
|
||||
Size2D::new(length, length)
|
||||
},
|
||||
EndingShape::Circle(Circle::Extent(extent)) => circle_size_keyword(extent, &size, ¢er),
|
||||
EndingShape::Circle(Circle::Extent(extent)) => circle_size_keyword(*extent, &size, ¢er),
|
||||
EndingShape::Ellipse(Ellipse::Radii(x, y)) => {
|
||||
Size2D::new(x.to_used_value(size.width), y.to_used_value(size.height))
|
||||
},
|
||||
EndingShape::Ellipse(Ellipse::Extent(extent)) => {
|
||||
ellipse_size_keyword(extent, &size, ¢er)
|
||||
ellipse_size_keyword(*extent, &size, ¢er)
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue