mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Some servo build fixes.
This commit is contained in:
parent
f76acc84c6
commit
848a6203de
13 changed files with 198 additions and 188 deletions
|
@ -60,10 +60,10 @@ use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect};
|
||||||
use style::properties::{style_structs, ComputedValues};
|
use style::properties::{style_structs, ComputedValues};
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::effects::SimpleShadow;
|
use style::values::computed::effects::SimpleShadow;
|
||||||
use style::values::computed::image::{Image, ImageLayer};
|
use style::values::computed::image::Image;
|
||||||
use style::values::computed::{ClipRectOrAuto, Gradient, LengthOrAuto};
|
use style::values::computed::{ClipRectOrAuto, Gradient, LengthOrAuto};
|
||||||
use style::values::generics::background::BackgroundSize;
|
use style::values::generics::background::BackgroundSize;
|
||||||
use style::values::generics::image::{GradientKind, PaintWorklet};
|
use style::values::generics::image::PaintWorklet;
|
||||||
use style::values::specified::ui::CursorKind;
|
use style::values::specified::ui::CursorKind;
|
||||||
use style::values::RGBA;
|
use style::values::RGBA;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
@ -732,12 +732,8 @@ impl Fragment {
|
||||||
// http://www.w3.org/TR/CSS21/colors.html#background
|
// http://www.w3.org/TR/CSS21/colors.html#background
|
||||||
let background = style.get_background();
|
let background = style.get_background();
|
||||||
for (i, background_image) in background.background_image.0.iter().enumerate().rev() {
|
for (i, background_image) in background.background_image.0.iter().enumerate().rev() {
|
||||||
let background_image = match *background_image {
|
|
||||||
ImageLayer::None => continue,
|
|
||||||
ImageLayer::Image(ref image) => image,
|
|
||||||
};
|
|
||||||
|
|
||||||
match *background_image {
|
match *background_image {
|
||||||
|
Image::None => {},
|
||||||
Image::Gradient(ref gradient) => {
|
Image::Gradient(ref gradient) => {
|
||||||
self.build_display_list_for_background_gradient(
|
self.build_display_list_for_background_gradient(
|
||||||
state,
|
state,
|
||||||
|
@ -975,15 +971,15 @@ impl Fragment {
|
||||||
display_list_section,
|
display_list_section,
|
||||||
);
|
);
|
||||||
|
|
||||||
let display_item = match gradient.kind {
|
let display_item = match gradient {
|
||||||
GradientKind::Linear(angle_or_corner) => {
|
Gradient::Linear {
|
||||||
let (gradient, stops) = gradient::linear(
|
ref direction,
|
||||||
style,
|
ref items,
|
||||||
placement.tile_size,
|
ref repeating,
|
||||||
&gradient.items[..],
|
compat_mode: _,
|
||||||
angle_or_corner,
|
} => {
|
||||||
gradient.repeating,
|
let (gradient, stops) =
|
||||||
);
|
gradient::linear(style, placement.tile_size, items, *direction, *repeating);
|
||||||
let item = webrender_api::GradientDisplayItem {
|
let item = webrender_api::GradientDisplayItem {
|
||||||
gradient,
|
gradient,
|
||||||
bounds: placement.bounds.to_f32_px(),
|
bounds: placement.bounds.to_f32_px(),
|
||||||
|
@ -993,14 +989,20 @@ impl Fragment {
|
||||||
};
|
};
|
||||||
DisplayItem::Gradient(CommonDisplayItem::with_data(base, item, stops))
|
DisplayItem::Gradient(CommonDisplayItem::with_data(base, item, stops))
|
||||||
},
|
},
|
||||||
GradientKind::Radial(ref shape, ref center) => {
|
Gradient::Radial {
|
||||||
|
ref shape,
|
||||||
|
ref position,
|
||||||
|
ref items,
|
||||||
|
ref repeating,
|
||||||
|
compat_mode: _,
|
||||||
|
} => {
|
||||||
let (gradient, stops) = gradient::radial(
|
let (gradient, stops) = gradient::radial(
|
||||||
style,
|
style,
|
||||||
placement.tile_size,
|
placement.tile_size,
|
||||||
&gradient.items[..],
|
items,
|
||||||
shape,
|
shape,
|
||||||
center,
|
position,
|
||||||
gradient.repeating,
|
*repeating,
|
||||||
);
|
);
|
||||||
let item = webrender_api::RadialGradientDisplayItem {
|
let item = webrender_api::RadialGradientDisplayItem {
|
||||||
gradient,
|
gradient,
|
||||||
|
@ -1011,6 +1013,7 @@ impl Fragment {
|
||||||
};
|
};
|
||||||
DisplayItem::RadialGradient(CommonDisplayItem::with_data(base, item, stops))
|
DisplayItem::RadialGradient(CommonDisplayItem::with_data(base, item, stops))
|
||||||
},
|
},
|
||||||
|
Gradient::Conic { .. } => unimplemented!(),
|
||||||
};
|
};
|
||||||
state.add_display_item(display_item);
|
state.add_display_item(display_item);
|
||||||
});
|
});
|
||||||
|
@ -1122,22 +1125,20 @@ impl Fragment {
|
||||||
let border_radius = border::radii(bounds, border_style_struct);
|
let border_radius = border::radii(bounds, border_style_struct);
|
||||||
let border_widths = border.to_physical(style.writing_mode);
|
let border_widths = border.to_physical(style.writing_mode);
|
||||||
|
|
||||||
if let ImageLayer::Image(ref image) = border_style_struct.border_image_source {
|
if self
|
||||||
if self
|
.build_display_list_for_border_image(
|
||||||
.build_display_list_for_border_image(
|
state,
|
||||||
state,
|
style,
|
||||||
style,
|
base.clone(),
|
||||||
base.clone(),
|
bounds,
|
||||||
bounds,
|
&border_style_struct.border_image_source,
|
||||||
image,
|
border_widths,
|
||||||
border_widths,
|
)
|
||||||
)
|
.is_some()
|
||||||
.is_some()
|
{
|
||||||
{
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Fallback to rendering a solid border.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if border_widths == SideOffsets2D::zero() {
|
if border_widths == SideOffsets2D::zero() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1224,30 +1225,37 @@ impl Fragment {
|
||||||
height = image.height;
|
height = image.height;
|
||||||
NinePatchBorderSource::Image(image.key?)
|
NinePatchBorderSource::Image(image.key?)
|
||||||
},
|
},
|
||||||
Image::Gradient(ref gradient) => match gradient.kind {
|
Image::Gradient(ref gradient) => match **gradient {
|
||||||
GradientKind::Linear(angle_or_corner) => {
|
Gradient::Linear {
|
||||||
let (wr_gradient, linear_stops) = gradient::linear(
|
ref direction,
|
||||||
style,
|
ref items,
|
||||||
border_image_area,
|
ref repeating,
|
||||||
&gradient.items[..],
|
compat_mode: _,
|
||||||
angle_or_corner,
|
} => {
|
||||||
gradient.repeating,
|
let (wr_gradient, linear_stops) =
|
||||||
);
|
gradient::linear(style, border_image_area, items, *direction, *repeating);
|
||||||
stops = linear_stops;
|
stops = linear_stops;
|
||||||
NinePatchBorderSource::Gradient(wr_gradient)
|
NinePatchBorderSource::Gradient(wr_gradient)
|
||||||
},
|
},
|
||||||
GradientKind::Radial(ref shape, ref center) => {
|
Gradient::Radial {
|
||||||
|
ref shape,
|
||||||
|
ref position,
|
||||||
|
ref items,
|
||||||
|
ref repeating,
|
||||||
|
compat_mode: _,
|
||||||
|
} => {
|
||||||
let (wr_gradient, radial_stops) = gradient::radial(
|
let (wr_gradient, radial_stops) = gradient::radial(
|
||||||
style,
|
style,
|
||||||
border_image_area,
|
border_image_area,
|
||||||
&gradient.items[..],
|
items,
|
||||||
shape,
|
shape,
|
||||||
center,
|
position,
|
||||||
gradient.repeating,
|
*repeating,
|
||||||
);
|
);
|
||||||
stops = radial_stops;
|
stops = radial_stops;
|
||||||
NinePatchBorderSource::RadialGradient(wr_gradient)
|
NinePatchBorderSource::RadialGradient(wr_gradient)
|
||||||
},
|
},
|
||||||
|
Gradient::Conic { .. } => unimplemented!(),
|
||||||
},
|
},
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,8 +7,8 @@ use app_units::Au;
|
||||||
use euclid::default::{Point2D, Size2D, Vector2D};
|
use euclid::default::{Point2D, Size2D, Vector2D};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::image::{EndingShape, LineDirection};
|
use style::values::computed::image::{EndingShape, LineDirection};
|
||||||
use style::values::computed::{Angle, GradientItem, LengthPercentage, Percentage, Position};
|
use style::values::computed::{Angle, Color, LengthPercentage, Percentage, Position};
|
||||||
use style::values::generics::image::{Circle, ColorStop, Ellipse, ShapeExtent};
|
use style::values::generics::image::{Circle, ColorStop, Ellipse, GradientItem, ShapeExtent};
|
||||||
use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient};
|
use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient};
|
||||||
|
|
||||||
/// A helper data structure for gradients.
|
/// A helper data structure for gradients.
|
||||||
|
@ -78,7 +78,7 @@ fn ellipse_size_keyword(
|
||||||
|
|
||||||
fn convert_gradient_stops(
|
fn convert_gradient_stops(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
gradient_items: &[GradientItem],
|
gradient_items: &[GradientItem<Color, LengthPercentage>],
|
||||||
total_length: Au,
|
total_length: Au,
|
||||||
) -> GradientBuilder {
|
) -> GradientBuilder {
|
||||||
// Determine the position of each stop per CSS-IMAGES § 3.4.
|
// Determine the position of each stop per CSS-IMAGES § 3.4.
|
||||||
|
@ -237,7 +237,7 @@ fn position_to_offset(position: &LengthPercentage, total_length: Au) -> f32 {
|
||||||
pub fn linear(
|
pub fn linear(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
size: Size2D<Au>,
|
size: Size2D<Au>,
|
||||||
stops: &[GradientItem],
|
stops: &[GradientItem<Color, LengthPercentage>],
|
||||||
direction: LineDirection,
|
direction: LineDirection,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
) -> (Gradient, Vec<GradientStop>) {
|
) -> (Gradient, Vec<GradientStop>) {
|
||||||
|
@ -303,7 +303,7 @@ pub fn linear(
|
||||||
pub fn radial(
|
pub fn radial(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
size: Size2D<Au>,
|
size: Size2D<Au>,
|
||||||
stops: &[GradientItem],
|
stops: &[GradientItem<Color, LengthPercentage>],
|
||||||
shape: &EndingShape,
|
shape: &EndingShape,
|
||||||
center: &Position,
|
center: &Position,
|
||||||
repeating: bool,
|
repeating: bool,
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
|
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::image::{EndingShape, Gradient, LineDirection};
|
use style::values::computed::image::{EndingShape, Gradient, LineDirection};
|
||||||
use style::values::computed::{GradientItem, Length, Position};
|
use style::values::computed::{Color, Length, LengthPercentage, Position};
|
||||||
use style::values::generics::image::GenericGradientKind as Kind;
|
use style::values::generics::image::{Circle, ColorStop, Ellipse, GradientItem, ShapeExtent};
|
||||||
use style::values::generics::image::{Circle, ColorStop, Ellipse, ShapeExtent};
|
|
||||||
use webrender_api::{self as wr, units};
|
use webrender_api::{self as wr, units};
|
||||||
|
|
||||||
pub(super) fn build(
|
pub(super) fn build(
|
||||||
|
@ -15,36 +14,51 @@ pub(super) fn build(
|
||||||
layer: &super::background::BackgroundLayer,
|
layer: &super::background::BackgroundLayer,
|
||||||
builder: &mut super::DisplayListBuilder,
|
builder: &mut super::DisplayListBuilder,
|
||||||
) {
|
) {
|
||||||
let extend_mode = if gradient.repeating {
|
match gradient {
|
||||||
wr::ExtendMode::Repeat
|
Gradient::Linear {
|
||||||
} else {
|
ref items,
|
||||||
wr::ExtendMode::Clamp
|
ref direction,
|
||||||
};
|
ref repeating,
|
||||||
match &gradient.kind {
|
compat_mode: _,
|
||||||
Kind::Linear(line_direction) => build_linear(
|
} => build_linear(
|
||||||
style,
|
style,
|
||||||
&gradient.items,
|
items,
|
||||||
line_direction,
|
direction,
|
||||||
extend_mode,
|
if *repeating {
|
||||||
|
wr::ExtendMode::Repeat
|
||||||
|
} else {
|
||||||
|
wr::ExtendMode::Clamp
|
||||||
|
},
|
||||||
&layer,
|
&layer,
|
||||||
builder,
|
builder,
|
||||||
),
|
),
|
||||||
Kind::Radial(ending_shape, center) => build_radial(
|
Gradient::Radial {
|
||||||
|
ref shape,
|
||||||
|
ref position,
|
||||||
|
ref items,
|
||||||
|
ref repeating,
|
||||||
|
compat_mode: _,
|
||||||
|
} => build_radial(
|
||||||
style,
|
style,
|
||||||
&gradient.items,
|
items,
|
||||||
ending_shape,
|
shape,
|
||||||
center,
|
position,
|
||||||
extend_mode,
|
if *repeating {
|
||||||
|
wr::ExtendMode::Repeat
|
||||||
|
} else {
|
||||||
|
wr::ExtendMode::Clamp
|
||||||
|
},
|
||||||
&layer,
|
&layer,
|
||||||
builder,
|
builder,
|
||||||
),
|
),
|
||||||
|
Gradient::Conic { .. } => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-images-3/#linear-gradients
|
/// https://drafts.csswg.org/css-images-3/#linear-gradients
|
||||||
pub(super) fn build_linear(
|
pub(super) fn build_linear(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
items: &[GradientItem],
|
items: &[GradientItem<Color, LengthPercentage>],
|
||||||
line_direction: &LineDirection,
|
line_direction: &LineDirection,
|
||||||
extend_mode: wr::ExtendMode,
|
extend_mode: wr::ExtendMode,
|
||||||
layer: &super::background::BackgroundLayer,
|
layer: &super::background::BackgroundLayer,
|
||||||
|
@ -144,7 +158,7 @@ pub(super) fn build_linear(
|
||||||
/// https://drafts.csswg.org/css-images-3/#radial-gradients
|
/// https://drafts.csswg.org/css-images-3/#radial-gradients
|
||||||
pub(super) fn build_radial(
|
pub(super) fn build_radial(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
items: &[GradientItem],
|
items: &[GradientItem<Color, LengthPercentage>],
|
||||||
shape: &EndingShape,
|
shape: &EndingShape,
|
||||||
center: &Position,
|
center: &Position,
|
||||||
extend_mode: wr::ExtendMode,
|
extend_mode: wr::ExtendMode,
|
||||||
|
@ -244,7 +258,7 @@ pub(super) fn build_radial(
|
||||||
/// https://drafts.csswg.org/css-images-4/#color-stop-fixup
|
/// https://drafts.csswg.org/css-images-4/#color-stop-fixup
|
||||||
fn fixup_stops(
|
fn fixup_stops(
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
items: &[GradientItem],
|
items: &[GradientItem<Color, LengthPercentage>],
|
||||||
gradient_line_length: Length,
|
gradient_line_length: Length,
|
||||||
) -> Vec<wr::GradientStop> {
|
) -> Vec<wr::GradientStop> {
|
||||||
// Remove color transititon hints, which are not supported yet.
|
// Remove color transititon hints, which are not supported yet.
|
||||||
|
|
|
@ -333,7 +333,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_background(&mut self, builder: &mut DisplayListBuilder) {
|
fn build_background(&mut self, builder: &mut DisplayListBuilder) {
|
||||||
use style::values::computed::image::{Image, ImageLayer};
|
use style::values::computed::image::Image;
|
||||||
let b = self.fragment.style.get_background();
|
let b = self.fragment.style.get_background();
|
||||||
let background_color = self.fragment.style.resolve_color(b.background_color);
|
let background_color = self.fragment.style.resolve_color(b.background_color);
|
||||||
if background_color.alpha > 0 {
|
if background_color.alpha > 0 {
|
||||||
|
@ -345,85 +345,80 @@ impl<'a> BuilderForBoxFragment<'a> {
|
||||||
builder.wr.push_rect(&common, rgba(background_color))
|
builder.wr.push_rect(&common, rgba(background_color))
|
||||||
}
|
}
|
||||||
// Reverse because the property is top layer first, we want to paint bottom layer first.
|
// Reverse because the property is top layer first, we want to paint bottom layer first.
|
||||||
for (index, layer) in b.background_image.0.iter().enumerate().rev() {
|
for (index, image) in b.background_image.0.iter().enumerate().rev() {
|
||||||
match layer {
|
match image {
|
||||||
ImageLayer::None => {},
|
Image::None => {},
|
||||||
ImageLayer::Image(image) => match image {
|
Image::Gradient(ref gradient) => {
|
||||||
Image::Gradient(gradient) => {
|
let intrinsic = IntrinsicSizes {
|
||||||
let intrinsic = IntrinsicSizes {
|
width: None,
|
||||||
width: None,
|
height: None,
|
||||||
height: None,
|
ratio: None,
|
||||||
ratio: None,
|
};
|
||||||
};
|
if let Some(layer) = &background::layout_layer(self, builder, index, intrinsic)
|
||||||
if let Some(layer) =
|
{
|
||||||
&background::layout_layer(self, builder, index, intrinsic)
|
gradient::build(&self.fragment.style, &gradient, layer, builder)
|
||||||
{
|
}
|
||||||
gradient::build(&self.fragment.style, gradient, layer, builder)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Image::Url(image_url) => {
|
|
||||||
// FIXME: images won’t always have in intrinsic width or height
|
|
||||||
// when support for SVG is added.
|
|
||||||
// Or a WebRender `ImageKey`, for that matter.
|
|
||||||
let (width, height, key) = match image_url.url() {
|
|
||||||
Some(url) => {
|
|
||||||
match builder.context.get_webrender_image_for_url(
|
|
||||||
self.fragment.tag,
|
|
||||||
url.clone(),
|
|
||||||
UsePlaceholder::No,
|
|
||||||
) {
|
|
||||||
Some(WebRenderImageInfo {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
key: Some(key),
|
|
||||||
}) => (width, height, key),
|
|
||||||
_ => continue,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
None => continue,
|
|
||||||
};
|
|
||||||
|
|
||||||
// FIXME: https://drafts.csswg.org/css-images-4/#the-image-resolution
|
|
||||||
let dppx = 1.0;
|
|
||||||
|
|
||||||
let intrinsic = IntrinsicSizes {
|
|
||||||
width: Some(Length::new(width as f32 / dppx)),
|
|
||||||
height: Some(Length::new(height as f32 / dppx)),
|
|
||||||
// FIXME https://github.com/w3c/csswg-drafts/issues/4572
|
|
||||||
ratio: Some(width as f32 / height as f32),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(layer) =
|
|
||||||
background::layout_layer(self, builder, index, intrinsic)
|
|
||||||
{
|
|
||||||
let image_rendering =
|
|
||||||
image_rendering(self.fragment.style.clone_image_rendering());
|
|
||||||
if layer.repeat {
|
|
||||||
builder.wr.push_repeating_image(
|
|
||||||
&layer.common,
|
|
||||||
layer.bounds,
|
|
||||||
layer.tile_size,
|
|
||||||
layer.tile_spacing,
|
|
||||||
image_rendering,
|
|
||||||
wr::AlphaType::PremultipliedAlpha,
|
|
||||||
key,
|
|
||||||
wr::ColorF::WHITE,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
builder.wr.push_image(
|
|
||||||
&layer.common,
|
|
||||||
layer.bounds,
|
|
||||||
image_rendering,
|
|
||||||
wr::AlphaType::PremultipliedAlpha,
|
|
||||||
key,
|
|
||||||
wr::ColorF::WHITE,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Gecko-only value, represented as a (boxed) empty enum on non-Gecko.
|
|
||||||
Image::Rect(rect) => match **rect {},
|
|
||||||
},
|
},
|
||||||
|
Image::Url(ref image_url) => {
|
||||||
|
// FIXME: images won’t always have in intrinsic width or height
|
||||||
|
// when support for SVG is added.
|
||||||
|
// Or a WebRender `ImageKey`, for that matter.
|
||||||
|
let (width, height, key) = match image_url.url() {
|
||||||
|
Some(url) => {
|
||||||
|
match builder.context.get_webrender_image_for_url(
|
||||||
|
self.fragment.tag,
|
||||||
|
url.clone(),
|
||||||
|
UsePlaceholder::No,
|
||||||
|
) {
|
||||||
|
Some(WebRenderImageInfo {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
key: Some(key),
|
||||||
|
}) => (width, height, key),
|
||||||
|
_ => continue,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME: https://drafts.csswg.org/css-images-4/#the-image-resolution
|
||||||
|
let dppx = 1.0;
|
||||||
|
|
||||||
|
let intrinsic = IntrinsicSizes {
|
||||||
|
width: Some(Length::new(width as f32 / dppx)),
|
||||||
|
height: Some(Length::new(height as f32 / dppx)),
|
||||||
|
// FIXME https://github.com/w3c/csswg-drafts/issues/4572
|
||||||
|
ratio: Some(width as f32 / height as f32),
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(layer) = background::layout_layer(self, builder, index, intrinsic) {
|
||||||
|
let image_rendering =
|
||||||
|
image_rendering(self.fragment.style.clone_image_rendering());
|
||||||
|
if layer.repeat {
|
||||||
|
builder.wr.push_repeating_image(
|
||||||
|
&layer.common,
|
||||||
|
layer.bounds,
|
||||||
|
layer.tile_size,
|
||||||
|
layer.tile_spacing,
|
||||||
|
image_rendering,
|
||||||
|
wr::AlphaType::PremultipliedAlpha,
|
||||||
|
key,
|
||||||
|
wr::ColorF::WHITE,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
builder.wr.push_image(
|
||||||
|
&layer.common,
|
||||||
|
layer.bounds,
|
||||||
|
image_rendering,
|
||||||
|
wr::AlphaType::PremultipliedAlpha,
|
||||||
|
key,
|
||||||
|
wr::ColorF::WHITE,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Gecko-only value, represented as a (boxed) empty enum on non-Gecko.
|
||||||
|
Image::Rect(ref rect) => match **rect {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -914,10 +914,6 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exported_part(&self, _: &Atom) -> Option<Atom> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -1441,11 +1437,6 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exported_part(&self, _: &Atom) -> Option<Atom> {
|
|
||||||
debug!("ServoThreadSafeLayoutElement::exported_part called");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
||||||
debug!("ServoThreadSafeLayoutElement::imported_part called");
|
debug!("ServoThreadSafeLayoutElement::imported_part called");
|
||||||
None
|
None
|
||||||
|
|
|
@ -922,10 +922,6 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exported_part(&self, _: &Atom) -> Option<Atom> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -1447,11 +1443,6 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exported_part(&self, _: &Atom) -> Option<Atom> {
|
|
||||||
debug!("ServoThreadSafeLayoutElement::exported_part called");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
||||||
debug!("ServoThreadSafeLayoutElement::imported_part called");
|
debug!("ServoThreadSafeLayoutElement::imported_part called");
|
||||||
None
|
None
|
||||||
|
|
|
@ -17,7 +17,9 @@ use crate::stylesheet_loader::StylesheetLoader;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use style::shared_lock::Locked;
|
use style::shared_lock::Locked;
|
||||||
use style::stylesheets::{CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError};
|
use style::stylesheets::{
|
||||||
|
AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
|
||||||
|
};
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe_no_jsmanaged_fields!(RulesSource);
|
unsafe_no_jsmanaged_fields!(RulesSource);
|
||||||
|
@ -116,6 +118,7 @@ impl CSSRuleList {
|
||||||
index,
|
index,
|
||||||
nested,
|
nested,
|
||||||
Some(&loader),
|
Some(&loader),
|
||||||
|
AllowImportRules::Yes,
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
|
@ -682,10 +682,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::BackgroundImage(background_image::SpecifiedValue(
|
PropertyDeclaration::BackgroundImage(background_image::SpecifiedValue(
|
||||||
vec![specified::ImageLayer::Image(specified::Image::for_cascade(
|
vec![specified::Image::for_cascade(url.into())].into(),
|
||||||
url.into(),
|
|
||||||
))]
|
|
||||||
.into(),
|
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -3164,10 +3161,6 @@ impl<'a> SelectorsElement for DomRoot<Element> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exported_part(&self, _: &Atom) -> Option<Atom> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
fn imported_part(&self, _: &Atom) -> Option<Atom> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ use servo_arc::Arc;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use style::media_queries::MediaList;
|
use style::media_queries::MediaList;
|
||||||
use style::parser::ParserContext as CssParserContext;
|
use style::parser::ParserContext as CssParserContext;
|
||||||
use style::stylesheets::{CssRuleType, Origin, Stylesheet};
|
use style::stylesheets::{AllowImportRules, CssRuleType, Origin, Stylesheet};
|
||||||
use style_traits::ParsingMode;
|
use style_traits::ParsingMode;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -119,6 +119,7 @@ impl HTMLStyleElement {
|
||||||
css_error_reporter,
|
css_error_reporter,
|
||||||
doc.quirks_mode(),
|
doc.quirks_mode(),
|
||||||
self.line_number as u32,
|
self.line_number as u32,
|
||||||
|
AllowImportRules::Yes,
|
||||||
);
|
);
|
||||||
|
|
||||||
let sheet = Arc::new(sheet);
|
let sheet = Arc::new(sheet);
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::context::QuirksMode;
|
||||||
use crate::error_reporting::ParseErrorReporter;
|
use crate::error_reporting::ParseErrorReporter;
|
||||||
use crate::media_queries::MediaList;
|
use crate::media_queries::MediaList;
|
||||||
use crate::shared_lock::SharedRwLock;
|
use crate::shared_lock::SharedRwLock;
|
||||||
use crate::stylesheets::{Origin, Stylesheet, StylesheetLoader, UrlExtraData};
|
use crate::stylesheets::{AllowImportRules, Origin, Stylesheet, StylesheetLoader, UrlExtraData};
|
||||||
use cssparser::{stylesheet_encoding, EncodingSupport};
|
use cssparser::{stylesheet_encoding, EncodingSupport};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -78,6 +78,7 @@ impl Stylesheet {
|
||||||
error_reporter,
|
error_reporter,
|
||||||
quirks_mode,
|
quirks_mode,
|
||||||
0,
|
0,
|
||||||
|
AllowImportRules::Yes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ impl Stylesheet {
|
||||||
stylesheet_loader,
|
stylesheet_loader,
|
||||||
error_reporter,
|
error_reporter,
|
||||||
0,
|
0,
|
||||||
|
AllowImportRules::Yes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ use crate::media_queries::Device;
|
||||||
use crate::properties;
|
use crate::properties;
|
||||||
use crate::properties::{ComputedValues, LonghandId, StyleBuilder};
|
use crate::properties::{ComputedValues, LonghandId, StyleBuilder};
|
||||||
use crate::rule_cache::RuleCacheConditions;
|
use crate::rule_cache::RuleCacheConditions;
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
use crate::Prefix;
|
|
||||||
use crate::{ArcSlice, Atom};
|
use crate::{ArcSlice, Atom};
|
||||||
use euclid::default::Size2D;
|
use euclid::default::Size2D;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
|
@ -501,7 +499,9 @@ trivial_to_computed_value!(u32);
|
||||||
trivial_to_computed_value!(usize);
|
trivial_to_computed_value!(usize);
|
||||||
trivial_to_computed_value!(Atom);
|
trivial_to_computed_value!(Atom);
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
trivial_to_computed_value!(Prefix);
|
trivial_to_computed_value!(html5ever::Namespace);
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
trivial_to_computed_value!(html5ever::Prefix);
|
||||||
trivial_to_computed_value!(String);
|
trivial_to_computed_value!(String);
|
||||||
trivial_to_computed_value!(Box<str>);
|
trivial_to_computed_value!(Box<str>);
|
||||||
trivial_to_computed_value!(crate::OwnedStr);
|
trivial_to_computed_value!(crate::OwnedStr);
|
||||||
|
|
|
@ -79,6 +79,8 @@ trivial_to_resolved_value!(computed::url::ComputedUrl);
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
trivial_to_resolved_value!(computed::url::ComputedImageUrl);
|
trivial_to_resolved_value!(computed::url::ComputedImageUrl);
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
|
trivial_to_resolved_value!(html5ever::Namespace);
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
trivial_to_resolved_value!(html5ever::Prefix);
|
trivial_to_resolved_value!(html5ever::Prefix);
|
||||||
trivial_to_resolved_value!(computed::LengthPercentage);
|
trivial_to_resolved_value!(computed::LengthPercentage);
|
||||||
trivial_to_resolved_value!(style_traits::values::specified::AllowedNumericType);
|
trivial_to_resolved_value!(style_traits::values::specified::AllowedNumericType);
|
||||||
|
|
|
@ -52,6 +52,16 @@ pub type Gradient = generic::Gradient<
|
||||||
|
|
||||||
type LengthPercentageItemList = crate::OwnedSlice<generic::GradientItem<Color, LengthPercentage>>;
|
type LengthPercentageItemList = crate::OwnedSlice<generic::GradientItem<Color, LengthPercentage>>;
|
||||||
|
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
fn conic_gradients_enabled() -> bool {
|
||||||
|
static_prefs::pref!("layout.css.conic-gradient.enabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
fn conic_gradients_enabled() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
impl SpecifiedValueInfo for Gradient {
|
impl SpecifiedValueInfo for Gradient {
|
||||||
const SUPPORTED_TYPES: u8 = CssType::GRADIENT;
|
const SUPPORTED_TYPES: u8 = CssType::GRADIENT;
|
||||||
|
|
||||||
|
@ -73,7 +83,7 @@ impl SpecifiedValueInfo for Gradient {
|
||||||
"-webkit-gradient",
|
"-webkit-gradient",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if static_prefs::pref!("layout.css.conic-gradient.enabled") {
|
if conic_gradients_enabled() {
|
||||||
f(&["conic-gradient", "repeating-conic-gradient"]);
|
f(&["conic-gradient", "repeating-conic-gradient"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,10 +250,10 @@ impl Parse for Gradient {
|
||||||
"-moz-repeating-radial-gradient" => {
|
"-moz-repeating-radial-gradient" => {
|
||||||
(Shape::Radial, true, GradientCompatMode::Moz)
|
(Shape::Radial, true, GradientCompatMode::Moz)
|
||||||
},
|
},
|
||||||
"conic-gradient" if static_prefs::pref!("layout.css.conic-gradient.enabled") => {
|
"conic-gradient" if conic_gradients_enabled() => {
|
||||||
(Shape::Conic, false, GradientCompatMode::Modern)
|
(Shape::Conic, false, GradientCompatMode::Modern)
|
||||||
},
|
},
|
||||||
"repeating-conic-gradient" if static_prefs::pref!("layout.css.conic-gradient.enabled") => {
|
"repeating-conic-gradient" if conic_gradients_enabled() => {
|
||||||
(Shape::Conic, true, GradientCompatMode::Modern)
|
(Shape::Conic, true, GradientCompatMode::Modern)
|
||||||
},
|
},
|
||||||
"-webkit-gradient" => {
|
"-webkit-gradient" => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue