mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Use the new WebRender conversion functions.
Remove the old ones.
This commit is contained in:
parent
71e542c424
commit
246b54507a
5 changed files with 89 additions and 285 deletions
|
@ -9,7 +9,7 @@
|
||||||
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
|
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use display_list::ToGfxColor;
|
use display_list::ToLayout;
|
||||||
use euclid::{Point2D, Size2D, Vector2D};
|
use euclid::{Point2D, Size2D, Vector2D};
|
||||||
use gfx::display_list;
|
use gfx::display_list;
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
|
@ -364,7 +364,7 @@ fn convert_gradient_stops(gradient_items: &[GradientItem], total_length: Au) ->
|
||||||
assert!(offset.is_finite());
|
assert!(offset.is_finite());
|
||||||
stops.push(GradientStop {
|
stops.push(GradientStop {
|
||||||
offset: offset,
|
offset: offset,
|
||||||
color: stop.color.to_gfx_color(),
|
color: stop.color.to_layout(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
stops
|
stops
|
||||||
|
|
|
@ -14,9 +14,10 @@ use app_units::{Au, AU_PER_PX};
|
||||||
use block::{BlockFlow, BlockStackingContextType};
|
use block::{BlockFlow, BlockStackingContextType};
|
||||||
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
||||||
use context::LayoutContext;
|
use context::LayoutContext;
|
||||||
|
use display_list::ToLayout;
|
||||||
use display_list::background::{compute_background_image_size, tile_image_axis};
|
use display_list::background::{compute_background_image_size, tile_image_axis};
|
||||||
use display_list::background::{convert_linear_gradient, convert_radial_gradient};
|
use display_list::background::{convert_linear_gradient, convert_radial_gradient};
|
||||||
use display_list::webrender_helpers::{ToBorderRadius, ToMixBlendMode, ToRectF, ToTransformStyle};
|
use display_list::webrender_helpers::ToBorderRadius;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Transform3D, TypedRect, TypedSize2D, Vector2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Transform3D, TypedRect, TypedSize2D, Vector2D};
|
||||||
use flex::FlexFlow;
|
use flex::FlexFlow;
|
||||||
use flow::{BaseFlow, Flow, FlowFlags};
|
use flow::{BaseFlow, Flow, FlowFlags};
|
||||||
|
@ -914,15 +915,15 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
let clip = if !border_radii.is_square() {
|
let clip = if !border_radii.is_square() {
|
||||||
LocalClip::RoundedRect(
|
LocalClip::RoundedRect(
|
||||||
bounds.to_rectf(),
|
bounds.to_layout(),
|
||||||
ComplexClipRegion::new(
|
ComplexClipRegion::new(
|
||||||
bounds.to_rectf(),
|
bounds.to_layout(),
|
||||||
border_radii.to_border_radius(),
|
border_radii.to_border_radius(),
|
||||||
ClipMode::Clip,
|
ClipMode::Clip,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
LocalClip::Rect(bounds.to_rectf())
|
LocalClip::Rect(bounds.to_layout())
|
||||||
};
|
};
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
|
@ -934,7 +935,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
);
|
);
|
||||||
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
color: background_color.to_gfx_color(),
|
color: background_color.to_layout(),
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// The background image is painted on top of the background color.
|
// The background image is painted on top of the background color.
|
||||||
|
@ -1118,7 +1119,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Create the image display item.
|
// Create the image display item.
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&placement.bounds,
|
&placement.bounds,
|
||||||
LocalClip::Rect(placement.css_clip.to_rectf()),
|
LocalClip::Rect(placement.css_clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
|
@ -1210,7 +1211,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&placement.bounds,
|
&placement.bounds,
|
||||||
LocalClip::Rect(placement.css_clip.to_rectf()),
|
LocalClip::Rect(placement.css_clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
|
@ -1271,7 +1272,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&bounds,
|
&bounds,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
|
@ -1284,7 +1285,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
.base
|
.base
|
||||||
.color
|
.color
|
||||||
.unwrap_or(style.get_color().color)
|
.unwrap_or(style.get_color().color)
|
||||||
.to_gfx_color(),
|
.to_layout(),
|
||||||
offset: Vector2D::new(
|
offset: Vector2D::new(
|
||||||
Au::from(box_shadow.base.horizontal),
|
Au::from(box_shadow.base.horizontal),
|
||||||
Au::from(box_shadow.base.vertical),
|
Au::from(box_shadow.base.vertical),
|
||||||
|
@ -1367,7 +1368,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Append the border to the display list.
|
// Append the border to the display list.
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&bounds,
|
&bounds,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
|
@ -1380,10 +1381,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
border_widths: border.to_physical(style.writing_mode),
|
border_widths: border.to_physical(style.writing_mode),
|
||||||
details: BorderDetails::Normal(NormalBorder {
|
details: BorderDetails::Normal(NormalBorder {
|
||||||
color: SideOffsets2D::new(
|
color: SideOffsets2D::new(
|
||||||
colors.top.to_gfx_color(),
|
colors.top.to_layout(),
|
||||||
colors.right.to_gfx_color(),
|
colors.right.to_layout(),
|
||||||
colors.bottom.to_gfx_color(),
|
colors.bottom.to_layout(),
|
||||||
colors.left.to_gfx_color(),
|
colors.left.to_layout(),
|
||||||
),
|
),
|
||||||
style: border_style,
|
style: border_style,
|
||||||
radius: build_border_radius(&bounds, border_style_struct),
|
radius: build_border_radius(&bounds, border_style_struct),
|
||||||
|
@ -1533,10 +1534,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Append the outline to the display list.
|
// Append the outline to the display list.
|
||||||
let color = style
|
let color = style
|
||||||
.resolve_color(style.get_outline().outline_color)
|
.resolve_color(style.get_outline().outline_color)
|
||||||
.to_gfx_color();
|
.to_layout();
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&bounds,
|
&bounds,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
DisplayListSection::Outlines,
|
DisplayListSection::Outlines,
|
||||||
|
@ -1567,7 +1568,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Compute the text fragment bounds and draw a border surrounding them.
|
// Compute the text fragment bounds and draw a border surrounding them.
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
stacking_relative_border_box,
|
stacking_relative_border_box,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -1594,7 +1595,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&baseline,
|
&baseline,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
style.get_cursor(Cursor::Default),
|
style.get_cursor(Cursor::Default),
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -1615,7 +1616,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// This prints a debug border around the border of this fragment.
|
// This prints a debug border around the border of this fragment.
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
stacking_relative_border_box,
|
stacking_relative_border_box,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
self.style.get_cursor(Cursor::Default),
|
self.style.get_cursor(Cursor::Default),
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -1653,14 +1654,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
let background_color = style.resolve_color(style.get_background().background_color);
|
let background_color = style.resolve_color(style.get_background().background_color);
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
stacking_relative_border_box,
|
stacking_relative_border_box,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
self.style.get_cursor(Cursor::Default),
|
self.style.get_cursor(Cursor::Default),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
);
|
);
|
||||||
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
color: background_color.to_gfx_color(),
|
color: background_color.to_layout(),
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,14 +1706,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&insertion_point_bounds,
|
&insertion_point_bounds,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
self.style.get_cursor(cursor),
|
self.style.get_cursor(cursor),
|
||||||
display_list_section,
|
display_list_section,
|
||||||
);
|
);
|
||||||
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
color: self.style().get_color().color.to_gfx_color(),
|
color: self.style().get_color().color.to_layout(),
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1869,15 +1870,15 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
let radii = build_border_radius_for_inner_rect(&stacking_relative_border_box, style);
|
let radii = build_border_radius_for_inner_rect(&stacking_relative_border_box, style);
|
||||||
if !radii.is_square() {
|
if !radii.is_square() {
|
||||||
LocalClip::RoundedRect(
|
LocalClip::RoundedRect(
|
||||||
stacking_relative_border_box.to_rectf(),
|
stacking_relative_border_box.to_layout(),
|
||||||
ComplexClipRegion::new(
|
ComplexClipRegion::new(
|
||||||
stacking_relative_content_box.to_rectf(),
|
stacking_relative_content_box.to_layout(),
|
||||||
radii.to_border_radius(),
|
radii.to_border_radius(),
|
||||||
ClipMode::Clip,
|
ClipMode::Clip,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
LocalClip::Rect(stacking_relative_border_box.to_rectf())
|
LocalClip::Rect(stacking_relative_border_box.to_layout())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2096,12 +2097,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
&overflow,
|
&overflow,
|
||||||
self.effective_z_index(),
|
self.effective_z_index(),
|
||||||
filters.into(),
|
filters.into(),
|
||||||
self.style()
|
self.style().get_effects().mix_blend_mode.to_layout(),
|
||||||
.get_effects()
|
|
||||||
.mix_blend_mode
|
|
||||||
.to_mix_blend_mode(),
|
|
||||||
self.transform_matrix(&border_box),
|
self.transform_matrix(&border_box),
|
||||||
self.style().get_used_transform_style().to_transform_style(),
|
self.style().get_used_transform_style().to_layout(),
|
||||||
self.perspective_matrix(&border_box),
|
self.perspective_matrix(&border_box),
|
||||||
scroll_policy,
|
scroll_policy,
|
||||||
parent_clipping_and_scrolling,
|
parent_clipping_and_scrolling,
|
||||||
|
@ -2149,7 +2147,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Base item for all text/shadows
|
// Base item for all text/shadows
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&stacking_relative_content_box,
|
&stacking_relative_content_box,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
self.style().get_cursor(cursor),
|
self.style().get_cursor(cursor),
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -2168,7 +2166,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
color: shadow
|
color: shadow
|
||||||
.color
|
.color
|
||||||
.unwrap_or(self.style().get_color().color)
|
.unwrap_or(self.style().get_color().color)
|
||||||
.to_gfx_color(),
|
.to_layout(),
|
||||||
},
|
},
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
@ -2215,7 +2213,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
base: base.clone(),
|
base: base.clone(),
|
||||||
text_run: text_fragment.run.clone(),
|
text_run: text_fragment.run.clone(),
|
||||||
range: text_fragment.range,
|
range: text_fragment.range,
|
||||||
text_color: text_color.to_gfx_color(),
|
text_color: text_color.to_layout(),
|
||||||
orientation: orientation,
|
orientation: orientation,
|
||||||
baseline_origin: baseline_origin,
|
baseline_origin: baseline_origin,
|
||||||
})));
|
})));
|
||||||
|
@ -2258,7 +2256,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
stacking_relative_box.to_physical(self.style.writing_mode, container_size);
|
stacking_relative_box.to_physical(self.style.writing_mode, container_size);
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&stacking_relative_box,
|
&stacking_relative_box,
|
||||||
LocalClip::from(clip.to_rectf()),
|
LocalClip::from(clip.to_layout()),
|
||||||
self.node,
|
self.node,
|
||||||
self.style.get_cursor(Cursor::Default),
|
self.style.get_cursor(Cursor::Default),
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -2266,7 +2264,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
|
|
||||||
state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
|
state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
color: color.to_gfx_color(),
|
color: color.to_layout(),
|
||||||
style: LineStyle::Solid,
|
style: LineStyle::Solid,
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@ -2736,10 +2734,8 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
// If we already have a scroll root for this flow, just return. This can happen
|
// If we already have a scroll root for this flow, just return. This can happen
|
||||||
// when fragments map to more than one flow, such as in the case of table
|
// when fragments map to more than one flow, such as in the case of table
|
||||||
// wrappers. We just accept the first scroll root in that case.
|
// wrappers. We just accept the first scroll root in that case.
|
||||||
let new_clip_scroll_node_id = ClipId::new(
|
let new_clip_scroll_node_id =
|
||||||
self.fragment.unique_id(),
|
ClipId::new(self.fragment.unique_id(), state.pipeline_id.to_webrender());
|
||||||
state.pipeline_id.to_webrender(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let sensitivity = if StyleOverflow::Hidden == self.fragment.style.get_box().overflow_x &&
|
let sensitivity = if StyleOverflow::Hidden == self.fragment.style.get_box().overflow_x &&
|
||||||
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_y
|
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_y
|
||||||
|
@ -3145,7 +3141,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
|
||||||
color.a = 1.0;
|
color.a = 1.0;
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
&stacking_context_relative_bounds.inflate(Au::from_px(2), Au::from_px(2)),
|
&stacking_context_relative_bounds.inflate(Au::from_px(2), Au::from_px(2)),
|
||||||
LocalClip::from(self.clip.to_rectf()),
|
LocalClip::from(self.clip.to_layout()),
|
||||||
node,
|
node,
|
||||||
None,
|
None,
|
||||||
DisplayListSection::Content,
|
DisplayListSection::Content,
|
||||||
|
@ -3208,23 +3204,6 @@ fn modify_border_width_for_inline_sides(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allows a CSS color to be converted into a graphics color.
|
|
||||||
pub trait ToGfxColor {
|
|
||||||
/// Converts a CSS color to a graphics color.
|
|
||||||
fn to_gfx_color(&self) -> ColorF;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToGfxColor for RGBA {
|
|
||||||
fn to_gfx_color(&self) -> ColorF {
|
|
||||||
ColorF::new(
|
|
||||||
self.red_f32(),
|
|
||||||
self.green_f32(),
|
|
||||||
self.blue_f32(),
|
|
||||||
self.alpha_f32(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Describes how to paint the borders.
|
/// Describes how to paint the borders.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum BorderPaintingMode<'a> {
|
pub enum BorderPaintingMode<'a> {
|
||||||
|
|
|
@ -10,7 +10,6 @@ pub use self::builder::InlineFlowDisplayListBuilding;
|
||||||
pub use self::builder::ListItemFlowDisplayListBuilding;
|
pub use self::builder::ListItemFlowDisplayListBuilding;
|
||||||
pub use self::builder::StackingContextCollectionFlags;
|
pub use self::builder::StackingContextCollectionFlags;
|
||||||
pub use self::builder::StackingContextCollectionState;
|
pub use self::builder::StackingContextCollectionState;
|
||||||
pub use self::builder::ToGfxColor;
|
|
||||||
pub use self::conversions::ToLayout;
|
pub use self::conversions::ToLayout;
|
||||||
pub use self::webrender_helpers::WebRenderDisplayListConverter;
|
pub use self::webrender_helpers::WebRenderDisplayListConverter;
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,12 @@
|
||||||
// completely converting layout to directly generate WebRender display lists, for example.
|
// completely converting layout to directly generate WebRender display lists, for example.
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D};
|
use display_list::ToLayout;
|
||||||
|
use euclid::Point2D;
|
||||||
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClipScrollNode};
|
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClipScrollNode};
|
||||||
use gfx::display_list::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingRegion, DisplayItem};
|
use gfx::display_list::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingRegion, DisplayItem};
|
||||||
use gfx::display_list::{DisplayList, StackingContextType};
|
use gfx::display_list::{DisplayList, StackingContextType};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use style::computed_values::image_rendering::T as ImageRendering;
|
|
||||||
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
|
||||||
use style::computed_values::transform_style::T as TransformStyle;
|
|
||||||
use style::values::computed::{BorderStyle, Filter};
|
|
||||||
use style::values::generics::effects::Filter as GenericFilter;
|
|
||||||
use webrender_api::{self, ClipAndScrollInfo, ClipId, ClipMode, ComplexClipRegion};
|
use webrender_api::{self, ClipAndScrollInfo, ClipId, ClipMode, ComplexClipRegion};
|
||||||
use webrender_api::{DisplayListBuilder, ExtendMode, LayoutTransform};
|
use webrender_api::{DisplayListBuilder, ExtendMode, LayoutTransform};
|
||||||
|
|
||||||
|
@ -36,42 +32,6 @@ trait WebRenderDisplayItemConverter {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ToBorderStyle {
|
|
||||||
fn to_border_style(&self) -> webrender_api::BorderStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToBorderStyle for BorderStyle {
|
|
||||||
fn to_border_style(&self) -> webrender_api::BorderStyle {
|
|
||||||
match *self {
|
|
||||||
BorderStyle::None => webrender_api::BorderStyle::None,
|
|
||||||
BorderStyle::Solid => webrender_api::BorderStyle::Solid,
|
|
||||||
BorderStyle::Double => webrender_api::BorderStyle::Double,
|
|
||||||
BorderStyle::Dotted => webrender_api::BorderStyle::Dotted,
|
|
||||||
BorderStyle::Dashed => webrender_api::BorderStyle::Dashed,
|
|
||||||
BorderStyle::Hidden => webrender_api::BorderStyle::Hidden,
|
|
||||||
BorderStyle::Groove => webrender_api::BorderStyle::Groove,
|
|
||||||
BorderStyle::Ridge => webrender_api::BorderStyle::Ridge,
|
|
||||||
BorderStyle::Inset => webrender_api::BorderStyle::Inset,
|
|
||||||
BorderStyle::Outset => webrender_api::BorderStyle::Outset,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToBorderWidths {
|
|
||||||
fn to_border_widths(&self) -> webrender_api::BorderWidths;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToBorderWidths for SideOffsets2D<Au> {
|
|
||||||
fn to_border_widths(&self) -> webrender_api::BorderWidths {
|
|
||||||
webrender_api::BorderWidths {
|
|
||||||
left: self.left.to_f32_px(),
|
|
||||||
top: self.top.to_f32_px(),
|
|
||||||
right: self.right.to_f32_px(),
|
|
||||||
bottom: self.bottom.to_f32_px(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToBoxShadowClipMode {
|
trait ToBoxShadowClipMode {
|
||||||
fn to_clip_mode(&self) -> webrender_api::BoxShadowClipMode;
|
fn to_clip_mode(&self) -> webrender_api::BoxShadowClipMode;
|
||||||
}
|
}
|
||||||
|
@ -85,52 +45,6 @@ impl ToBoxShadowClipMode for BoxShadowClipMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ToSizeF {
|
|
||||||
fn to_sizef(&self) -> webrender_api::LayoutSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToPointF {
|
|
||||||
fn to_pointf(&self) -> webrender_api::LayoutPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToVectorF {
|
|
||||||
fn to_vectorf(&self) -> webrender_api::LayoutVector2D;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToPointF for Point2D<Au> {
|
|
||||||
fn to_pointf(&self) -> webrender_api::LayoutPoint {
|
|
||||||
webrender_api::LayoutPoint::new(self.x.to_f32_px(), self.y.to_f32_px())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToVectorF for Vector2D<Au> {
|
|
||||||
fn to_vectorf(&self) -> webrender_api::LayoutVector2D {
|
|
||||||
webrender_api::LayoutVector2D::new(self.x.to_f32_px(), self.y.to_f32_px())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToSizeF for Size2D<Au> {
|
|
||||||
fn to_sizef(&self) -> webrender_api::LayoutSize {
|
|
||||||
webrender_api::LayoutSize::new(self.width.to_f32_px(), self.height.to_f32_px())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToRectF {
|
|
||||||
fn to_rectf(&self) -> webrender_api::LayoutRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToRectF for Rect<Au> {
|
|
||||||
fn to_rectf(&self) -> webrender_api::LayoutRect {
|
|
||||||
let x = self.origin.x.to_f32_px();
|
|
||||||
let y = self.origin.y.to_f32_px();
|
|
||||||
let w = self.size.width.to_f32_px();
|
|
||||||
let h = self.size.height.to_f32_px();
|
|
||||||
let point = webrender_api::LayoutPoint::new(x, y);
|
|
||||||
let size = webrender_api::LayoutSize::new(w, h);
|
|
||||||
webrender_api::LayoutRect::new(point, size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToBorderRadius {
|
pub trait ToBorderRadius {
|
||||||
fn to_border_radius(&self) -> webrender_api::BorderRadius;
|
fn to_border_radius(&self) -> webrender_api::BorderRadius;
|
||||||
}
|
}
|
||||||
|
@ -138,107 +52,10 @@ pub trait ToBorderRadius {
|
||||||
impl ToBorderRadius for BorderRadii<Au> {
|
impl ToBorderRadius for BorderRadii<Au> {
|
||||||
fn to_border_radius(&self) -> webrender_api::BorderRadius {
|
fn to_border_radius(&self) -> webrender_api::BorderRadius {
|
||||||
webrender_api::BorderRadius {
|
webrender_api::BorderRadius {
|
||||||
top_left: self.top_left.to_sizef(),
|
top_left: self.top_left.to_layout(),
|
||||||
top_right: self.top_right.to_sizef(),
|
top_right: self.top_right.to_layout(),
|
||||||
bottom_left: self.bottom_left.to_sizef(),
|
bottom_left: self.bottom_left.to_layout(),
|
||||||
bottom_right: self.bottom_right.to_sizef(),
|
bottom_right: self.bottom_right.to_layout(),
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToMixBlendMode {
|
|
||||||
fn to_mix_blend_mode(&self) -> webrender_api::MixBlendMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToMixBlendMode for MixBlendMode {
|
|
||||||
fn to_mix_blend_mode(&self) -> webrender_api::MixBlendMode {
|
|
||||||
match *self {
|
|
||||||
MixBlendMode::Normal => webrender_api::MixBlendMode::Normal,
|
|
||||||
MixBlendMode::Multiply => webrender_api::MixBlendMode::Multiply,
|
|
||||||
MixBlendMode::Screen => webrender_api::MixBlendMode::Screen,
|
|
||||||
MixBlendMode::Overlay => webrender_api::MixBlendMode::Overlay,
|
|
||||||
MixBlendMode::Darken => webrender_api::MixBlendMode::Darken,
|
|
||||||
MixBlendMode::Lighten => webrender_api::MixBlendMode::Lighten,
|
|
||||||
MixBlendMode::ColorDodge => webrender_api::MixBlendMode::ColorDodge,
|
|
||||||
MixBlendMode::ColorBurn => webrender_api::MixBlendMode::ColorBurn,
|
|
||||||
MixBlendMode::HardLight => webrender_api::MixBlendMode::HardLight,
|
|
||||||
MixBlendMode::SoftLight => webrender_api::MixBlendMode::SoftLight,
|
|
||||||
MixBlendMode::Difference => webrender_api::MixBlendMode::Difference,
|
|
||||||
MixBlendMode::Exclusion => webrender_api::MixBlendMode::Exclusion,
|
|
||||||
MixBlendMode::Hue => webrender_api::MixBlendMode::Hue,
|
|
||||||
MixBlendMode::Saturation => webrender_api::MixBlendMode::Saturation,
|
|
||||||
MixBlendMode::Color => webrender_api::MixBlendMode::Color,
|
|
||||||
MixBlendMode::Luminosity => webrender_api::MixBlendMode::Luminosity,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToImageRendering {
|
|
||||||
fn to_image_rendering(&self) -> webrender_api::ImageRendering;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToImageRendering for ImageRendering {
|
|
||||||
fn to_image_rendering(&self) -> webrender_api::ImageRendering {
|
|
||||||
match *self {
|
|
||||||
ImageRendering::CrispEdges => webrender_api::ImageRendering::CrispEdges,
|
|
||||||
ImageRendering::Auto => webrender_api::ImageRendering::Auto,
|
|
||||||
ImageRendering::Pixelated => webrender_api::ImageRendering::Pixelated,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ToFilterOps {
|
|
||||||
fn to_filter_ops(&self) -> Vec<webrender_api::FilterOp>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToFilterOps for Vec<Filter> {
|
|
||||||
fn to_filter_ops(&self) -> Vec<webrender_api::FilterOp> {
|
|
||||||
let mut result = Vec::with_capacity(self.len());
|
|
||||||
for filter in self.iter() {
|
|
||||||
match *filter {
|
|
||||||
GenericFilter::Blur(radius) => {
|
|
||||||
result.push(webrender_api::FilterOp::Blur(radius.px()))
|
|
||||||
},
|
|
||||||
GenericFilter::Brightness(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Brightness(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::Contrast(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Contrast(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::Grayscale(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Grayscale(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::HueRotate(angle) => {
|
|
||||||
result.push(webrender_api::FilterOp::HueRotate(angle.radians()))
|
|
||||||
},
|
|
||||||
GenericFilter::Invert(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Invert(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::Opacity(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Opacity(amount.0.into(), amount.0));
|
|
||||||
},
|
|
||||||
GenericFilter::Saturate(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Saturate(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::Sepia(amount) => {
|
|
||||||
result.push(webrender_api::FilterOp::Sepia(amount.0))
|
|
||||||
},
|
|
||||||
GenericFilter::DropShadow(ref shadow) => match *shadow {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToTransformStyle {
|
|
||||||
fn to_transform_style(&self) -> webrender_api::TransformStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToTransformStyle for TransformStyle {
|
|
||||||
fn to_transform_style(&self) -> webrender_api::TransformStyle {
|
|
||||||
match *self {
|
|
||||||
TransformStyle::Auto | TransformStyle::Flat => webrender_api::TransformStyle::Flat,
|
|
||||||
TransformStyle::Preserve3d => webrender_api::TransformStyle::Preserve3D,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +64,7 @@ impl WebRenderDisplayListConverter for DisplayList {
|
||||||
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder {
|
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder {
|
||||||
let mut builder = DisplayListBuilder::with_capacity(
|
let mut builder = DisplayListBuilder::with_capacity(
|
||||||
pipeline_id.to_webrender(),
|
pipeline_id.to_webrender(),
|
||||||
self.bounds().size.to_sizef(),
|
self.bounds().size.to_layout(),
|
||||||
1024 * 1024,
|
1024 * 1024,
|
||||||
); // 1 MB of space
|
); // 1 MB of space
|
||||||
|
|
||||||
|
@ -277,7 +94,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
webrender_api::LayoutPrimitiveInfo {
|
webrender_api::LayoutPrimitiveInfo {
|
||||||
rect: self.base().bounds.to_rectf(),
|
rect: self.base().bounds.to_layout(),
|
||||||
local_clip: self.base().local_clip,
|
local_clip: self.base().local_clip,
|
||||||
// TODO(gw): Make use of the WR backface visibility functionality.
|
// TODO(gw): Make use of the WR backface visibility functionality.
|
||||||
is_backface_visible: true,
|
is_backface_visible: true,
|
||||||
|
@ -359,34 +176,34 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
if item.stretch_size.width > Au(0) && item.stretch_size.height > Au(0) {
|
if item.stretch_size.width > Au(0) && item.stretch_size.height > Au(0) {
|
||||||
builder.push_image(
|
builder.push_image(
|
||||||
&self.prim_info(),
|
&self.prim_info(),
|
||||||
item.stretch_size.to_sizef(),
|
item.stretch_size.to_layout(),
|
||||||
item.tile_spacing.to_sizef(),
|
item.tile_spacing.to_layout(),
|
||||||
item.image_rendering.to_image_rendering(),
|
item.image_rendering.to_layout(),
|
||||||
id,
|
id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DisplayItem::Border(ref item) => {
|
DisplayItem::Border(ref item) => {
|
||||||
let widths = item.border_widths.to_border_widths();
|
let widths = item.border_widths.to_layout();
|
||||||
|
|
||||||
let details = match item.details {
|
let details = match item.details {
|
||||||
BorderDetails::Normal(ref border) => {
|
BorderDetails::Normal(ref border) => {
|
||||||
let left = webrender_api::BorderSide {
|
let left = webrender_api::BorderSide {
|
||||||
color: border.color.left,
|
color: border.color.left,
|
||||||
style: border.style.left.to_border_style(),
|
style: border.style.left.to_layout(),
|
||||||
};
|
};
|
||||||
let top = webrender_api::BorderSide {
|
let top = webrender_api::BorderSide {
|
||||||
color: border.color.top,
|
color: border.color.top,
|
||||||
style: border.style.top.to_border_style(),
|
style: border.style.top.to_layout(),
|
||||||
};
|
};
|
||||||
let right = webrender_api::BorderSide {
|
let right = webrender_api::BorderSide {
|
||||||
color: border.color.right,
|
color: border.color.right,
|
||||||
style: border.style.right.to_border_style(),
|
style: border.style.right.to_layout(),
|
||||||
};
|
};
|
||||||
let bottom = webrender_api::BorderSide {
|
let bottom = webrender_api::BorderSide {
|
||||||
color: border.color.bottom,
|
color: border.color.bottom,
|
||||||
style: border.style.bottom.to_border_style(),
|
style: border.style.bottom.to_layout(),
|
||||||
};
|
};
|
||||||
let radius = border.radius.to_border_radius();
|
let radius = border.radius.to_border_radius();
|
||||||
webrender_api::BorderDetails::Normal(webrender_api::NormalBorder {
|
webrender_api::BorderDetails::Normal(webrender_api::NormalBorder {
|
||||||
|
@ -422,8 +239,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
};
|
};
|
||||||
webrender_api::BorderDetails::Gradient(webrender_api::GradientBorder {
|
webrender_api::BorderDetails::Gradient(webrender_api::GradientBorder {
|
||||||
gradient: builder.create_gradient(
|
gradient: builder.create_gradient(
|
||||||
gradient.gradient.start_point.to_pointf(),
|
gradient.gradient.start_point.to_layout(),
|
||||||
gradient.gradient.end_point.to_pointf(),
|
gradient.gradient.end_point.to_layout(),
|
||||||
gradient.gradient.stops.clone(),
|
gradient.gradient.stops.clone(),
|
||||||
extend_mode,
|
extend_mode,
|
||||||
),
|
),
|
||||||
|
@ -439,8 +256,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
webrender_api::BorderDetails::RadialGradient(
|
webrender_api::BorderDetails::RadialGradient(
|
||||||
webrender_api::RadialGradientBorder {
|
webrender_api::RadialGradientBorder {
|
||||||
gradient: builder.create_radial_gradient(
|
gradient: builder.create_radial_gradient(
|
||||||
gradient.gradient.center.to_pointf(),
|
gradient.gradient.center.to_layout(),
|
||||||
gradient.gradient.radius.to_sizef(),
|
gradient.gradient.radius.to_layout(),
|
||||||
gradient.gradient.stops.clone(),
|
gradient.gradient.stops.clone(),
|
||||||
extend_mode,
|
extend_mode,
|
||||||
),
|
),
|
||||||
|
@ -453,8 +270,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
builder.push_border(&self.prim_info(), widths, details);
|
builder.push_border(&self.prim_info(), widths, details);
|
||||||
},
|
},
|
||||||
DisplayItem::Gradient(ref item) => {
|
DisplayItem::Gradient(ref item) => {
|
||||||
let start_point = item.gradient.start_point.to_pointf();
|
let start_point = item.gradient.start_point.to_layout();
|
||||||
let end_point = item.gradient.end_point.to_pointf();
|
let end_point = item.gradient.end_point.to_layout();
|
||||||
let extend_mode = if item.gradient.repeating {
|
let extend_mode = if item.gradient.repeating {
|
||||||
ExtendMode::Repeat
|
ExtendMode::Repeat
|
||||||
} else {
|
} else {
|
||||||
|
@ -469,13 +286,13 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
builder.push_gradient(
|
builder.push_gradient(
|
||||||
&self.prim_info(),
|
&self.prim_info(),
|
||||||
gradient,
|
gradient,
|
||||||
item.tile.to_sizef(),
|
item.tile.to_layout(),
|
||||||
item.tile_spacing.to_sizef(),
|
item.tile_spacing.to_layout(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::RadialGradient(ref item) => {
|
DisplayItem::RadialGradient(ref item) => {
|
||||||
let center = item.gradient.center.to_pointf();
|
let center = item.gradient.center.to_layout();
|
||||||
let radius = item.gradient.radius.to_sizef();
|
let radius = item.gradient.radius.to_layout();
|
||||||
let extend_mode = if item.gradient.repeating {
|
let extend_mode = if item.gradient.repeating {
|
||||||
ExtendMode::Repeat
|
ExtendMode::Repeat
|
||||||
} else {
|
} else {
|
||||||
|
@ -490,8 +307,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
builder.push_radial_gradient(
|
builder.push_radial_gradient(
|
||||||
&self.prim_info(),
|
&self.prim_info(),
|
||||||
gradient,
|
gradient,
|
||||||
item.tile.to_sizef(),
|
item.tile.to_layout(),
|
||||||
item.tile_spacing.to_sizef(),
|
item.tile_spacing.to_layout(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::Line(ref item) => {
|
DisplayItem::Line(ref item) => {
|
||||||
|
@ -505,11 +322,11 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::BoxShadow(ref item) => {
|
DisplayItem::BoxShadow(ref item) => {
|
||||||
let box_bounds = item.box_bounds.to_rectf();
|
let box_bounds = item.box_bounds.to_layout();
|
||||||
builder.push_box_shadow(
|
builder.push_box_shadow(
|
||||||
&self.prim_info(),
|
&self.prim_info(),
|
||||||
box_bounds,
|
box_bounds,
|
||||||
item.offset.to_vectorf(),
|
item.offset.to_layout(),
|
||||||
item.color,
|
item.color,
|
||||||
item.blur_radius.to_f32_px(),
|
item.blur_radius.to_f32_px(),
|
||||||
item.spread_radius.to_f32_px(),
|
item.spread_radius.to_f32_px(),
|
||||||
|
@ -522,7 +339,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
&self.prim_info(),
|
&self.prim_info(),
|
||||||
webrender_api::Shadow {
|
webrender_api::Shadow {
|
||||||
blur_radius: item.blur_radius.to_f32_px(),
|
blur_radius: item.blur_radius.to_f32_px(),
|
||||||
offset: item.offset.to_vectorf(),
|
offset: item.offset.to_layout(),
|
||||||
color: item.color,
|
color: item.color,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -545,20 +362,24 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
.map(|perspective| LayoutTransform::from_untyped(&perspective));
|
.map(|perspective| LayoutTransform::from_untyped(&perspective));
|
||||||
|
|
||||||
builder.push_stacking_context(
|
builder.push_stacking_context(
|
||||||
&webrender_api::LayoutPrimitiveInfo::new(stacking_context.bounds.to_rectf()),
|
&webrender_api::LayoutPrimitiveInfo::new(stacking_context.bounds.to_layout()),
|
||||||
stacking_context.scroll_policy,
|
stacking_context.scroll_policy,
|
||||||
transform,
|
transform,
|
||||||
stacking_context.transform_style,
|
stacking_context.transform_style,
|
||||||
perspective,
|
perspective,
|
||||||
stacking_context.mix_blend_mode,
|
stacking_context.mix_blend_mode,
|
||||||
stacking_context.filters.to_filter_ops(),
|
stacking_context
|
||||||
|
.filters
|
||||||
|
.iter()
|
||||||
|
.map(ToLayout::to_layout)
|
||||||
|
.collect(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
||||||
DisplayItem::DefineClipScrollNode(ref item) => {
|
DisplayItem::DefineClipScrollNode(ref item) => {
|
||||||
let node = &clip_scroll_nodes[item.node_index.0];
|
let node = &clip_scroll_nodes[item.node_index.0];
|
||||||
let parent_id = get_id(clip_ids, node.parent_index);
|
let parent_id = get_id(clip_ids, node.parent_index);
|
||||||
let item_rect = node.clip.main.to_rectf();
|
let item_rect = node.clip.main.to_layout();
|
||||||
|
|
||||||
let webrender_id = match node.node_type {
|
let webrender_id = match node.node_type {
|
||||||
ClipScrollNodeType::Clip => builder.define_clip_with_parent(
|
ClipScrollNodeType::Clip => builder.define_clip_with_parent(
|
||||||
|
@ -572,8 +393,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
.define_scroll_frame_with_parent(
|
.define_scroll_frame_with_parent(
|
||||||
node.id,
|
node.id,
|
||||||
parent_id,
|
parent_id,
|
||||||
node.content_rect.to_rectf(),
|
node.content_rect.to_layout(),
|
||||||
node.clip.main.to_rectf(),
|
node.clip.main.to_layout(),
|
||||||
node.clip.get_complex_clips(),
|
node.clip.get_complex_clips(),
|
||||||
None,
|
None,
|
||||||
scroll_sensitivity,
|
scroll_sensitivity,
|
||||||
|
@ -611,7 +432,7 @@ impl ToWebRenderClip for ClippingRegion {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|complex_clipping_region| {
|
.map(|complex_clipping_region| {
|
||||||
ComplexClipRegion::new(
|
ComplexClipRegion::new(
|
||||||
complex_clipping_region.rect.to_rectf(),
|
complex_clipping_region.rect.to_layout(),
|
||||||
complex_clipping_region.radii.to_border_radius(),
|
complex_clipping_region.radii.to_border_radius(),
|
||||||
ClipMode::Clip,
|
ClipMode::Clip,
|
||||||
)
|
)
|
||||||
|
|
|
@ -69,7 +69,7 @@ use layout::context::LayoutContext;
|
||||||
use layout::context::RegisteredPainter;
|
use layout::context::RegisteredPainter;
|
||||||
use layout::context::RegisteredPainters;
|
use layout::context::RegisteredPainters;
|
||||||
use layout::context::malloc_size_of_persistent_local_context;
|
use layout::context::malloc_size_of_persistent_local_context;
|
||||||
use layout::display_list::{ToGfxColor, WebRenderDisplayListConverter};
|
use layout::display_list::WebRenderDisplayListConverter;
|
||||||
use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||||
use layout::flow_ref::FlowRef;
|
use layout::flow_ref::FlowRef;
|
||||||
use layout::incremental::{LayoutDamageComputation, RelayoutMode, SpecialRestyleDamage};
|
use layout::incremental::{LayoutDamageComputation, RelayoutMode, SpecialRestyleDamage};
|
||||||
|
@ -1688,10 +1688,15 @@ fn get_root_flow_background_color(flow: &mut Flow) -> webrender_api::ColorF {
|
||||||
}
|
}
|
||||||
|
|
||||||
let kid_block_flow = kid.as_block();
|
let kid_block_flow = kid.as_block();
|
||||||
kid_block_flow.fragment
|
let color = kid_block_flow.fragment
|
||||||
.style
|
.style
|
||||||
.resolve_color(kid_block_flow.fragment.style.get_background().background_color)
|
.resolve_color(kid_block_flow.fragment.style.get_background().background_color);
|
||||||
.to_gfx_color()
|
webrender_api::ColorF::new(
|
||||||
|
color.red_f32(),
|
||||||
|
color.green_f32(),
|
||||||
|
color.blue_f32(),
|
||||||
|
color.alpha_f32(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
|
fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue