mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Changes needed for rebase.
This commit is contained in:
parent
ce3e1406ca
commit
d48c1222ca
1 changed files with 18 additions and 15 deletions
|
@ -58,9 +58,10 @@ use style::properties::longhands::border_image_repeat::computed_value::RepeatKey
|
||||||
use style::properties::style_structs;
|
use style::properties::style_structs;
|
||||||
use style::servo::restyle_damage::REPAINT;
|
use style::servo::restyle_damage::REPAINT;
|
||||||
use style::values::{Either, RGBA, computed};
|
use style::values::{Either, RGBA, computed};
|
||||||
use style::values::computed::{AngleOrCorner, Gradient, GradientKind, LengthOrPercentage, LengthOrPercentageOrAuto};
|
use style::values::computed::{AngleOrCorner, Gradient, GradientItem, GradientKind, LengthOrPercentage};
|
||||||
use style::values::computed::{LengthOrKeyword, LengthOrPercentageOrKeyword, NumberOrPercentage, Position};
|
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrKeyword, LengthOrPercentageOrKeyword};
|
||||||
use style::values::computed::image::{ColorStop, EndingShape, SizeKeyword};
|
use style::values::computed::{NumberOrPercentage, Position};
|
||||||
|
use style::values::computed::image::{EndingShape, SizeKeyword};
|
||||||
use style::values::specified::{HorizontalDirection, VerticalDirection};
|
use style::values::specified::{HorizontalDirection, VerticalDirection};
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
|
@ -388,7 +389,7 @@ pub trait FragmentDisplayListBuilding {
|
||||||
|
|
||||||
fn convert_linear_gradient(&self,
|
fn convert_linear_gradient(&self,
|
||||||
bounds: &Rect<Au>,
|
bounds: &Rect<Au>,
|
||||||
stops: &[ColorStop],
|
stops: &[GradientItem],
|
||||||
angle_or_corner: &AngleOrCorner,
|
angle_or_corner: &AngleOrCorner,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
style: &ServoComputedValues)
|
style: &ServoComputedValues)
|
||||||
|
@ -396,7 +397,7 @@ pub trait FragmentDisplayListBuilding {
|
||||||
|
|
||||||
fn convert_radial_gradient(&self,
|
fn convert_radial_gradient(&self,
|
||||||
bounds: &Rect<Au>,
|
bounds: &Rect<Au>,
|
||||||
stops: &[ColorStop],
|
stops: &[GradientItem],
|
||||||
shape: &EndingShape,
|
shape: &EndingShape,
|
||||||
center: &Position,
|
center: &Position,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
|
@ -601,13 +602,13 @@ fn build_border_radius_for_inner_rect(outer_rect: &Rect<Au>,
|
||||||
radii
|
radii
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_gradient_stops(gradient_stops: &[ColorStop],
|
fn convert_gradient_stops(gradient_items: &[GradientItem],
|
||||||
length: Au,
|
length: Au,
|
||||||
style: &ServoComputedValues) -> Vec<GradientStop> {
|
style: &ServoComputedValues) -> Vec<GradientStop> {
|
||||||
// Determine the position of each stop per CSS-IMAGES § 3.4.
|
// Determine the position of each stop per CSS-IMAGES § 3.4.
|
||||||
//
|
//
|
||||||
// FIXME(#3908, pcwalton): Make sure later stops can't be behind earlier stops.
|
// FIXME(#3908, pcwalton): Make sure later stops can't be behind earlier stops.
|
||||||
let stop_items = gradient.items.iter().filter_map(|item| {
|
let stop_items = gradient_items.iter().filter_map(|item| {
|
||||||
match *item {
|
match *item {
|
||||||
GradientItem::ColorStop(ref stop) => Some(stop),
|
GradientItem::ColorStop(ref stop) => Some(stop),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -720,6 +721,7 @@ fn convert_circle_size_keyword(keyword: SizeKeyword,
|
||||||
ClosestCorner => get_distance_to_corner(size, center, ::std::cmp::min),
|
ClosestCorner => get_distance_to_corner(size, center, ::std::cmp::min),
|
||||||
FarthestCorner => get_distance_to_corner(size, center, ::std::cmp::max),
|
FarthestCorner => get_distance_to_corner(size, center, ::std::cmp::max),
|
||||||
_ => {
|
_ => {
|
||||||
|
// TODO(#16542)
|
||||||
println!("TODO: implement size keyword {:?} for circles", keyword);
|
println!("TODO: implement size keyword {:?} for circles", keyword);
|
||||||
Au::new(0)
|
Au::new(0)
|
||||||
}
|
}
|
||||||
|
@ -739,6 +741,7 @@ fn convert_ellipse_size_keyword(keyword: SizeKeyword,
|
||||||
ClosestCorner => get_ellipse_radius(size, center, ::std::cmp::min),
|
ClosestCorner => get_ellipse_radius(size, center, ::std::cmp::min),
|
||||||
FarthestCorner => get_ellipse_radius(size, center, ::std::cmp::max),
|
FarthestCorner => get_ellipse_radius(size, center, ::std::cmp::max),
|
||||||
_ => {
|
_ => {
|
||||||
|
// TODO(#16542)
|
||||||
println!("TODO: implement size keyword {:?} for ellipses", keyword);
|
println!("TODO: implement size keyword {:?} for ellipses", keyword);
|
||||||
Size2D::new(Au::new(0), Au::new(0))
|
Size2D::new(Au::new(0), Au::new(0))
|
||||||
}
|
}
|
||||||
|
@ -1050,7 +1053,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
fn convert_linear_gradient(&self,
|
fn convert_linear_gradient(&self,
|
||||||
bounds: &Rect<Au>,
|
bounds: &Rect<Au>,
|
||||||
stops: &[ColorStop],
|
stops: &[GradientItem],
|
||||||
angle_or_corner: &AngleOrCorner,
|
angle_or_corner: &AngleOrCorner,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
style: &ServoComputedValues)
|
style: &ServoComputedValues)
|
||||||
|
@ -1108,14 +1111,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
fn convert_radial_gradient(&self,
|
fn convert_radial_gradient(&self,
|
||||||
bounds: &Rect<Au>,
|
bounds: &Rect<Au>,
|
||||||
stops: &[ColorStop],
|
stops: &[GradientItem],
|
||||||
shape: &EndingShape,
|
shape: &EndingShape,
|
||||||
center: &Position,
|
center: &Position,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
style: &ServoComputedValues)
|
style: &ServoComputedValues)
|
||||||
-> display_list::RadialGradient {
|
-> display_list::RadialGradient {
|
||||||
let center = Point2D::new(specified(center.horizontal, bounds.size.width),
|
let center = Point2D::new(specified(center.horizontal.0, bounds.size.width),
|
||||||
specified(center.vertical, bounds.size.height));
|
specified(center.vertical.0, bounds.size.height));
|
||||||
let radius = match *shape {
|
let radius = match *shape {
|
||||||
EndingShape::Circle(LengthOrKeyword::Length(length))
|
EndingShape::Circle(LengthOrKeyword::Length(length))
|
||||||
=> Size2D::new(length, length),
|
=> Size2D::new(length, length),
|
||||||
|
@ -1165,7 +1168,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
let display_item = match gradient.gradient_kind {
|
let display_item = match gradient.gradient_kind {
|
||||||
GradientKind::Linear(ref angle_or_corner) => {
|
GradientKind::Linear(ref angle_or_corner) => {
|
||||||
let gradient = self.convert_linear_gradient(&bounds,
|
let gradient = self.convert_linear_gradient(&bounds,
|
||||||
&gradient.stops[..],
|
&gradient.items[..],
|
||||||
angle_or_corner,
|
angle_or_corner,
|
||||||
gradient.repeating,
|
gradient.repeating,
|
||||||
style);
|
style);
|
||||||
|
@ -1176,7 +1179,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
GradientKind::Radial(ref shape, ref center) => {
|
GradientKind::Radial(ref shape, ref center) => {
|
||||||
let gradient = self.convert_radial_gradient(&bounds,
|
let gradient = self.convert_radial_gradient(&bounds,
|
||||||
&gradient.stops[..],
|
&gradient.items[..],
|
||||||
shape,
|
shape,
|
||||||
center,
|
center,
|
||||||
gradient.repeating,
|
gradient.repeating,
|
||||||
|
@ -1302,7 +1305,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
match gradient.gradient_kind {
|
match gradient.gradient_kind {
|
||||||
GradientKind::Linear(angle_or_corner) => {
|
GradientKind::Linear(angle_or_corner) => {
|
||||||
let grad = self.convert_linear_gradient(&bounds,
|
let grad = self.convert_linear_gradient(&bounds,
|
||||||
&gradient.stops[..],
|
&gradient.items[..],
|
||||||
&angle_or_corner,
|
&angle_or_corner,
|
||||||
gradient.repeating,
|
gradient.repeating,
|
||||||
style);
|
style);
|
||||||
|
@ -1319,7 +1322,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
GradientKind::Radial(_, _) => {
|
GradientKind::Radial(_, _) => {
|
||||||
// TODO(gw): Handle border-image with radial gradient.
|
// TODO(#16638): Handle border-image with radial gradient.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue