mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Fix style system build with recent changes.
This commit is contained in:
parent
ed2e9ce482
commit
add08518cd
7 changed files with 43 additions and 30 deletions
|
@ -57,10 +57,10 @@ use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect};
|
|||
use style::properties::{style_structs, ComputedValues};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::effects::SimpleShadow;
|
||||
use style::values::computed::image::Image as ComputedImage;
|
||||
use style::values::computed::image::{Image, ImageLayer};
|
||||
use style::values::computed::{Gradient, LengthOrAuto};
|
||||
use style::values::generics::background::BackgroundSize;
|
||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||
use style::values::generics::image::{GradientKind, PaintWorklet};
|
||||
use style::values::specified::ui::CursorKind;
|
||||
use style::values::{Either, RGBA};
|
||||
use style_traits::ToCss;
|
||||
|
@ -726,9 +726,13 @@ impl Fragment {
|
|||
// http://www.w3.org/TR/CSS21/colors.html#background
|
||||
let background = style.get_background();
|
||||
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 {
|
||||
Either::First(_) => {},
|
||||
Either::Second(Image::Gradient(ref gradient)) => {
|
||||
Image::Gradient(ref gradient) => {
|
||||
self.build_display_list_for_background_gradient(
|
||||
state,
|
||||
display_list_section,
|
||||
|
@ -738,7 +742,7 @@ impl Fragment {
|
|||
i,
|
||||
);
|
||||
},
|
||||
Either::Second(Image::Url(ref image_url)) => {
|
||||
Image::Url(ref image_url) => {
|
||||
if let Some(url) = image_url.url() {
|
||||
let webrender_image = state.layout_context.get_webrender_image_for_url(
|
||||
self.node,
|
||||
|
@ -757,7 +761,7 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
},
|
||||
Either::Second(Image::PaintWorklet(ref paint_worklet)) => {
|
||||
Image::PaintWorklet(ref paint_worklet) => {
|
||||
let bounding_box = self.border_box - style.logical_border_width();
|
||||
let bounding_box_size = bounding_box.size.to_physical(style.writing_mode);
|
||||
let background_size =
|
||||
|
@ -790,10 +794,10 @@ impl Fragment {
|
|||
);
|
||||
}
|
||||
},
|
||||
Either::Second(Image::Rect(_)) => {
|
||||
Image::Rect(_) => {
|
||||
// TODO: Implement `-moz-image-rect`
|
||||
},
|
||||
Either::Second(Image::Element(_)) => {
|
||||
Image::Element(_) => {
|
||||
// TODO: Implement `-moz-element`
|
||||
},
|
||||
}
|
||||
|
@ -978,7 +982,7 @@ impl Fragment {
|
|||
};
|
||||
DisplayItem::Gradient(CommonDisplayItem::with_data(base, item, stops))
|
||||
},
|
||||
GradientKind::Radial(shape, center, _angle) => {
|
||||
GradientKind::Radial(shape, center) => {
|
||||
let (gradient, stops) = gradient::radial(
|
||||
style,
|
||||
placement.tile_size,
|
||||
|
@ -1115,7 +1119,7 @@ impl Fragment {
|
|||
let border_radius = border::radii(bounds, border_style_struct);
|
||||
let border_widths = border.to_physical(style.writing_mode);
|
||||
|
||||
if let Either::Second(ref image) = border_style_struct.border_image_source {
|
||||
if let ImageLayer::Image(ref image) = border_style_struct.border_image_source {
|
||||
if self
|
||||
.build_display_list_for_border_image(
|
||||
state,
|
||||
|
@ -1173,7 +1177,7 @@ impl Fragment {
|
|||
style: &ComputedValues,
|
||||
base: BaseDisplayItem,
|
||||
bounds: Rect<Au>,
|
||||
image: &ComputedImage,
|
||||
image: &Image,
|
||||
border_width: SideOffsets2D<Au>,
|
||||
) -> Option<()> {
|
||||
let border_style_struct = style.get_border();
|
||||
|
@ -1227,7 +1231,7 @@ impl Fragment {
|
|||
stops = linear_stops;
|
||||
NinePatchBorderSource::Gradient(wr_gradient)
|
||||
},
|
||||
GradientKind::Radial(shape, center, _angle) => {
|
||||
GradientKind::Radial(shape, center) => {
|
||||
let (wr_gradient, radial_stops) = gradient::radial(
|
||||
style,
|
||||
border_image_area,
|
||||
|
|
|
@ -9,7 +9,6 @@ use style::properties::ComputedValues;
|
|||
use style::values::computed::image::{EndingShape, LineDirection};
|
||||
use style::values::computed::{Angle, GradientItem, LengthPercentage, Percentage, Position};
|
||||
use style::values::generics::image::{Circle, ColorStop, Ellipse, ShapeExtent};
|
||||
use style::values::specified::position::{X, Y};
|
||||
use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient};
|
||||
|
||||
/// A helper data structure for gradients.
|
||||
|
@ -227,15 +226,17 @@ pub fn linear(
|
|||
direction: LineDirection,
|
||||
repeating: bool,
|
||||
) -> (Gradient, Vec<GradientStop>) {
|
||||
use style::values::specified::position::HorizontalPositionKeyword::*;
|
||||
use style::values::specified::position::VerticalPositionKeyword::*;
|
||||
let angle = match direction {
|
||||
LineDirection::Angle(angle) => angle.radians(),
|
||||
LineDirection::Horizontal(x) => match x {
|
||||
X::Left => Angle::from_degrees(270.).radians(),
|
||||
X::Right => Angle::from_degrees(90.).radians(),
|
||||
Left => Angle::from_degrees(270.).radians(),
|
||||
Right => Angle::from_degrees(90.).radians(),
|
||||
},
|
||||
LineDirection::Vertical(y) => match y {
|
||||
Y::Top => Angle::from_degrees(0.).radians(),
|
||||
Y::Bottom => Angle::from_degrees(180.).radians(),
|
||||
Top => Angle::from_degrees(0.).radians(),
|
||||
Bottom => Angle::from_degrees(180.).radians(),
|
||||
},
|
||||
LineDirection::Corner(horizontal, vertical) => {
|
||||
// This the angle for one of the diagonals of the box. Our angle
|
||||
|
@ -243,10 +244,10 @@ pub fn linear(
|
|||
// two perpendicular angles.
|
||||
let atan = (size.height.to_f32_px() / size.width.to_f32_px()).atan();
|
||||
match (horizontal, vertical) {
|
||||
(X::Right, Y::Bottom) => ::std::f32::consts::PI - atan,
|
||||
(X::Left, Y::Bottom) => ::std::f32::consts::PI + atan,
|
||||
(X::Right, Y::Top) => atan,
|
||||
(X::Left, Y::Top) => -atan,
|
||||
(Right, Bottom) => ::std::f32::consts::PI - atan,
|
||||
(Left, Bottom) => ::std::f32::consts::PI + atan,
|
||||
(Right, Top) => atan,
|
||||
(Left, Top) => -atan,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -510,6 +510,10 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
*self.element.namespace() == ns!(svg)
|
||||
}
|
||||
|
||||
fn has_part_attr(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn style_attribute(&self) -> Option<ArcBorrow<StyleLocked<PropertyDeclarationBlock>>> {
|
||||
unsafe {
|
||||
(*self.element.style_attribute())
|
||||
|
|
|
@ -132,8 +132,7 @@ use style::selector_parser::{
|
|||
use style::shared_lock::{Locked, SharedRwLock};
|
||||
use style::thread_state;
|
||||
use style::values::generics::NonNegative;
|
||||
use style::values::{computed, specified};
|
||||
use style::values::{CSSFloat, Either};
|
||||
use style::values::{computed, specified, CSSFloat};
|
||||
use style::CaseSensitivityExt;
|
||||
use xml5ever::serialize as xmlSerialize;
|
||||
use xml5ever::serialize::SerializeOpts as XmlSerializeOpts;
|
||||
|
@ -684,7 +683,7 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
|||
hints.push(from_declaration(
|
||||
shared_lock,
|
||||
PropertyDeclaration::BackgroundImage(background_image::SpecifiedValue(
|
||||
vec![Either::Second(specified::Image::for_cascade(url.into()))].into(),
|
||||
vec![specified::ImageLayer::Image(specified::Image::for_cascade(url.into()))].into(),
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -237,10 +237,17 @@ partial interface CSSStyleDeclaration {
|
|||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString counter-reset;
|
||||
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow;
|
||||
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflowBlock;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow-block;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflowInline;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow-inline;
|
||||
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflowX;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow-x;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflowY;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow-y;
|
||||
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflowWrap;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString overflow-wrap;
|
||||
|
||||
|
|
|
@ -35,10 +35,9 @@ use crate::thread_state::{self, ThreadState};
|
|||
use crate::{Atom, LocalName, Namespace, WeakAtom};
|
||||
use fallible::FallibleVec;
|
||||
use hashglobe::FailedAllocationError;
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::bloom::BloomFilter;
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
|
|
|
@ -693,8 +693,7 @@ fn notify_paint_worklet<E>(context: &StyleContext<E>, data: &ElementData)
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
use crate::values::generics::image::Image;
|
||||
use crate::values::Either;
|
||||
use crate::values::generics::image::{GenericImageLayer, Image};
|
||||
use style_traits::ToCss;
|
||||
|
||||
// We speculatively evaluate any paint worklets during styling.
|
||||
|
@ -704,7 +703,7 @@ where
|
|||
if let Some(ref values) = data.styles.primary {
|
||||
for image in &values.get_background().background_image.0 {
|
||||
let (name, arguments) = match *image {
|
||||
Either::Second(Image::PaintWorklet(ref worklet)) => {
|
||||
GenericImageLayer::Image(Image::PaintWorklet(ref worklet)) => {
|
||||
(&worklet.name, &worklet.arguments)
|
||||
},
|
||||
_ => continue,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue