mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #19824 - pyfisch:dl-move, r=mrobinson
Use more WebRender types in gfx Removes ImageBorder details from gfx. Use WebRender BorderRadius in BoxShadow. Stores cursors as integer. Use FilterOp, BorderWidths from WebRender. Store content_rect as LayoutRect. This amends #19782. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19824) <!-- Reviewable:end -->
This commit is contained in:
commit
bad46383bd
7 changed files with 126 additions and 195 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1024,7 +1024,6 @@ dependencies = [
|
|||
"simd 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"truetype 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -40,7 +40,6 @@ servo_geometry = {path = "../geometry"}
|
|||
servo_url = {path = "../url"}
|
||||
smallvec = "0.6"
|
||||
style = {path = "../style"}
|
||||
style_traits = {path = "../style_traits"}
|
||||
time = "0.1.12"
|
||||
unicode-bidi = {version = "0.3", features = ["with_serde"]}
|
||||
unicode-script = {version = "0.1", features = ["harfbuzz"]}
|
||||
|
|
|
@ -29,14 +29,13 @@ use std::collections::HashMap;
|
|||
use std::f32;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::values::computed::Filter;
|
||||
use style_traits::cursor::CursorKind;
|
||||
use text::TextRun;
|
||||
use text::glyph::ByteIndex;
|
||||
use webrender_api::{BoxShadowClipMode, ClipId, ColorF, ExtendMode, GradientStop, ImageKey};
|
||||
use webrender_api::{ImageRendering, LayoutPoint, LayoutRect, LayoutSize, LayoutVector2D};
|
||||
use webrender_api::{LineStyle, LocalClip, MixBlendMode, NormalBorder, RepeatMode, ScrollPolicy};
|
||||
use webrender_api::{ScrollSensitivity, StickyOffsetBounds, TransformStyle};
|
||||
use webrender_api::{BorderRadius, BorderWidths, BoxShadowClipMode, ClipId, ColorF, ExtendMode};
|
||||
use webrender_api::{FilterOp, GradientStop, ImageBorder, ImageKey, ImageRendering, LayoutPoint};
|
||||
use webrender_api::{LayoutRect, LayoutSize, LayoutVector2D, LineStyle, LocalClip, MixBlendMode};
|
||||
use webrender_api::{NormalBorder, ScrollPolicy, ScrollSensitivity, StickyOffsetBounds};
|
||||
use webrender_api::TransformStyle;
|
||||
|
||||
pub use style::dom::OpaqueNode;
|
||||
|
||||
|
@ -204,7 +203,7 @@ pub struct StackingContext {
|
|||
pub z_index: i32,
|
||||
|
||||
/// CSS filters to be applied to this stacking context (including opacity).
|
||||
pub filters: Vec<Filter>,
|
||||
pub filters: Vec<FilterOp>,
|
||||
|
||||
/// The blend mode with which this stacking context blends with its backdrop.
|
||||
pub mix_blend_mode: MixBlendMode,
|
||||
|
@ -233,7 +232,7 @@ impl StackingContext {
|
|||
bounds: &Rect<Au>,
|
||||
overflow: &Rect<Au>,
|
||||
z_index: i32,
|
||||
filters: Vec<Filter>,
|
||||
filters: Vec<FilterOp>,
|
||||
mix_blend_mode: MixBlendMode,
|
||||
transform: Option<Transform3D<f32>>,
|
||||
transform_style: TransformStyle,
|
||||
|
@ -370,7 +369,7 @@ pub struct ClipScrollNode {
|
|||
pub clip: ClippingRegion,
|
||||
|
||||
/// The rect of the contents that can be scrolled inside of the scroll root.
|
||||
pub content_rect: Rect<Au>,
|
||||
pub content_rect: LayoutRect,
|
||||
|
||||
/// The type of this ClipScrollNode.
|
||||
pub node_type: ClipScrollNodeType,
|
||||
|
@ -419,7 +418,7 @@ pub struct BaseDisplayItem {
|
|||
|
||||
impl BaseDisplayItem {
|
||||
#[inline(always)]
|
||||
pub fn new(bounds: &Rect<Au>,
|
||||
pub fn new(bounds: Rect<Au>,
|
||||
metadata: DisplayItemMetadata,
|
||||
local_clip: LocalClip,
|
||||
section: DisplayListSection,
|
||||
|
@ -427,12 +426,12 @@ impl BaseDisplayItem {
|
|||
clipping_and_scrolling: ClippingAndScrolling)
|
||||
-> BaseDisplayItem {
|
||||
BaseDisplayItem {
|
||||
bounds: *bounds,
|
||||
metadata: metadata,
|
||||
local_clip: local_clip,
|
||||
section: section,
|
||||
stacking_context_id: stacking_context_id,
|
||||
clipping_and_scrolling: clipping_and_scrolling,
|
||||
bounds,
|
||||
metadata,
|
||||
local_clip,
|
||||
section,
|
||||
stacking_context_id,
|
||||
clipping_and_scrolling,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,7 +645,7 @@ pub struct DisplayItemMetadata {
|
|||
pub node: OpaqueNode,
|
||||
/// The value of the `cursor` property when the mouse hovers over this display item. If `None`,
|
||||
/// this display item is ineligible for pointer events (`pointer-events: none`).
|
||||
pub pointing: Option<CursorKind>,
|
||||
pub pointing: Option<u16>,
|
||||
}
|
||||
|
||||
/// Paints a solid color.
|
||||
|
@ -789,28 +788,6 @@ pub struct RadialGradientDisplayItem {
|
|||
pub tile_spacing: LayoutSize,
|
||||
}
|
||||
|
||||
/// A border that is made of image segments.
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct ImageBorder {
|
||||
/// The image this border uses, border-image-source.
|
||||
pub image: WebRenderImageInfo,
|
||||
|
||||
/// How to slice the image, as per border-image-slice.
|
||||
pub slice: SideOffsets2D<u32>,
|
||||
|
||||
/// Outsets for the border, as per border-image-outset.
|
||||
pub outset: SideOffsets2D<f32>,
|
||||
|
||||
/// If fill is true, draw the center patch of the image.
|
||||
pub fill: bool,
|
||||
|
||||
/// How to repeat or stretch horizontal edges (border-image-repeat).
|
||||
pub repeat_horizontal: RepeatMode,
|
||||
|
||||
/// How to repeat or stretch vertical edges (border-image-repeat).
|
||||
pub repeat_vertical: RepeatMode,
|
||||
}
|
||||
|
||||
/// A border that is made of linear gradient
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct GradientBorder {
|
||||
|
@ -847,7 +824,7 @@ pub struct BorderDisplayItem {
|
|||
pub base: BaseDisplayItem,
|
||||
|
||||
/// Border widths.
|
||||
pub border_widths: SideOffsets2D<Au>,
|
||||
pub border_widths: BorderWidths,
|
||||
|
||||
/// Details for specific border type
|
||||
pub details: BorderDetails,
|
||||
|
@ -949,7 +926,7 @@ pub struct BoxShadowDisplayItem {
|
|||
pub spread_radius: f32,
|
||||
|
||||
/// The border radius of this shadow.
|
||||
pub border_radius: BorderRadii<Au>,
|
||||
pub border_radius: BorderRadius,
|
||||
|
||||
/// How we should clip the result.
|
||||
pub clip_mode: BoxShadowClipMode,
|
||||
|
|
|
@ -58,7 +58,6 @@ extern crate servo_url;
|
|||
extern crate simd;
|
||||
extern crate smallvec;
|
||||
extern crate style;
|
||||
extern crate style_traits;
|
||||
extern crate time;
|
||||
extern crate unicode_bidi;
|
||||
extern crate unicode_script;
|
||||
|
|
|
@ -30,7 +30,7 @@ use gfx::display_list::{BaseDisplayItem, BorderDetails, BorderDisplayItem, BLUR_
|
|||
use gfx::display_list::{BorderRadii, BoxShadowDisplayItem, ClipScrollNode};
|
||||
use gfx::display_list::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingAndScrolling};
|
||||
use gfx::display_list::{ClippingRegion, DisplayItem, DisplayItemMetadata, DisplayList};
|
||||
use gfx::display_list::{DisplayListSection, GradientDisplayItem, IframeDisplayItem, ImageBorder};
|
||||
use gfx::display_list::{DisplayListSection, GradientDisplayItem, IframeDisplayItem};
|
||||
use gfx::display_list::{ImageDisplayItem, LineDisplayItem, OpaqueNode};
|
||||
use gfx::display_list::{PopAllTextShadowsDisplayItem, PushTextShadowDisplayItem};
|
||||
use gfx::display_list::{RadialGradientDisplayItem, SolidColorDisplayItem, StackingContext};
|
||||
|
@ -68,15 +68,15 @@ use style::values::computed::{Gradient, NumberOrPercentage};
|
|||
use style::values::computed::effects::SimpleShadow;
|
||||
use style::values::computed::pointing::Cursor;
|
||||
use style::values::generics::background::BackgroundSize;
|
||||
use style::values::generics::effects::Filter;
|
||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::cursor::CursorKind;
|
||||
use table_cell::CollapsedBordersForCell;
|
||||
use webrender_api::{self, BoxShadowClipMode, ClipId, ClipMode, ColorF, ComplexClipRegion};
|
||||
use webrender_api::{ImageRendering, LayoutSize, LayoutVector2D, LineStyle};
|
||||
use webrender_api::{LocalClip, NormalBorder, ScrollPolicy, ScrollSensitivity, StickyOffsetBounds};
|
||||
use webrender_api::{self, BorderSide, BoxShadowClipMode, ClipId, ClipMode, ColorF};
|
||||
use webrender_api::{ComplexClipRegion, FilterOp, ImageBorder, ImageRendering, LayoutRect};
|
||||
use webrender_api::{LayoutSize, LayoutVector2D, LineStyle, LocalClip, NinePatchDescriptor};
|
||||
use webrender_api::{NormalBorder, ScrollPolicy, ScrollSensitivity, StickyOffsetBounds};
|
||||
|
||||
trait ResolvePercentage {
|
||||
fn resolve(&self, length: u32) -> u32;
|
||||
|
@ -246,7 +246,7 @@ impl StackingContextCollectionState {
|
|||
id: Some(ClipId::root_scroll_node(pipeline_id.to_webrender())),
|
||||
parent_index: ClipScrollNodeIndex(0),
|
||||
clip: ClippingRegion::from_rect(&TypedRect::zero()),
|
||||
content_rect: Rect::zero(),
|
||||
content_rect: LayoutRect::zero(),
|
||||
node_type: ClipScrollNodeType::ScrollFrame(ScrollSensitivity::ScriptAndInputEvents),
|
||||
};
|
||||
|
||||
|
@ -387,10 +387,11 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
};
|
||||
|
||||
BaseDisplayItem::new(
|
||||
&bounds,
|
||||
*bounds,
|
||||
DisplayItemMetadata {
|
||||
node: node,
|
||||
pointing: cursor,
|
||||
node,
|
||||
// Store cursor id in display list.
|
||||
pointing: cursor.map(|x| x as u16),
|
||||
},
|
||||
clip,
|
||||
section,
|
||||
|
@ -816,7 +817,7 @@ fn calculate_inner_bounds(mut bounds: Rect<Au>, offsets: SideOffsets2D<Au>) -> R
|
|||
}
|
||||
|
||||
fn simple_normal_border(color: ColorF, style: webrender_api::BorderStyle) -> NormalBorder {
|
||||
let side = webrender_api::BorderSide { color, style };
|
||||
let side = BorderSide { color, style };
|
||||
NormalBorder {
|
||||
left: side,
|
||||
right: side,
|
||||
|
@ -844,6 +845,36 @@ fn calculate_inner_border_radii(
|
|||
radii
|
||||
}
|
||||
|
||||
fn build_image_border_details(
|
||||
webrender_image: WebRenderImageInfo,
|
||||
border_style_struct: &style_structs::Border,
|
||||
) -> Option<BorderDetails> {
|
||||
let corners = &border_style_struct.border_image_slice.offsets;
|
||||
let border_image_repeat = &border_style_struct.border_image_repeat;
|
||||
if let Some(image_key) = webrender_image.key {
|
||||
Some(BorderDetails::Image(ImageBorder {
|
||||
image_key: image_key,
|
||||
patch: NinePatchDescriptor {
|
||||
width: webrender_image.width,
|
||||
height: webrender_image.height,
|
||||
slice: SideOffsets2D::new(
|
||||
corners.0.resolve(webrender_image.height),
|
||||
corners.1.resolve(webrender_image.width),
|
||||
corners.2.resolve(webrender_image.height),
|
||||
corners.3.resolve(webrender_image.width),
|
||||
),
|
||||
},
|
||||
fill: border_style_struct.border_image_slice.fill,
|
||||
// TODO(gw): Support border-image-outset
|
||||
outset: SideOffsets2D::zero(),
|
||||
repeat_horizontal: border_image_repeat.0.to_layout(),
|
||||
repeat_vertical: border_image_repeat.1.to_layout(),
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl FragmentDisplayListBuilding for Fragment {
|
||||
fn collect_stacking_contexts_for_blocklike_fragment(
|
||||
&mut self,
|
||||
|
@ -1292,7 +1323,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
),
|
||||
blur_radius: box_shadow.base.blur.px(),
|
||||
spread_radius: box_shadow.spread.px(),
|
||||
border_radius,
|
||||
border_radius: border_radius.to_border_radius(),
|
||||
clip_mode: if box_shadow.inset {
|
||||
BoxShadowClipMode::Inset
|
||||
} else {
|
||||
|
@ -1352,13 +1383,6 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
);
|
||||
}
|
||||
|
||||
let colors = SideOffsets2D::new(
|
||||
style.resolve_color(colors.top),
|
||||
style.resolve_color(colors.right),
|
||||
style.resolve_color(colors.bottom),
|
||||
style.resolve_color(colors.left),
|
||||
);
|
||||
|
||||
// If this border collapses, then we draw outside the boundaries we were given.
|
||||
let mut bounds = *bounds;
|
||||
if let BorderPaintingMode::Collapse(collapsed_borders) = border_painting_mode {
|
||||
|
@ -1376,35 +1400,28 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
let border_radius = build_border_radius(&bounds, border_style_struct);
|
||||
|
||||
match border_style_struct.border_image_source {
|
||||
Either::First(_) => {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
left: webrender_api::BorderSide {
|
||||
color: colors.left.to_layout(),
|
||||
style: border_style.left.to_layout(),
|
||||
},
|
||||
right: webrender_api::BorderSide {
|
||||
color: colors.right.to_layout(),
|
||||
style: border_style.right.to_layout(),
|
||||
},
|
||||
top: webrender_api::BorderSide {
|
||||
color: colors.top.to_layout(),
|
||||
style: border_style.top.to_layout(),
|
||||
},
|
||||
bottom: webrender_api::BorderSide {
|
||||
color: colors.bottom.to_layout(),
|
||||
style: border_style.bottom.to_layout(),
|
||||
},
|
||||
radius: border_radius.to_border_radius(),
|
||||
}),
|
||||
})));
|
||||
},
|
||||
let details = match border_style_struct.border_image_source {
|
||||
Either::First(_) => Some(BorderDetails::Normal(NormalBorder {
|
||||
left: BorderSide {
|
||||
color: style.resolve_color(colors.left).to_layout(),
|
||||
style: border_style.left.to_layout(),
|
||||
},
|
||||
right: BorderSide {
|
||||
color: style.resolve_color(colors.right).to_layout(),
|
||||
style: border_style.right.to_layout(),
|
||||
},
|
||||
top: BorderSide {
|
||||
color: style.resolve_color(colors.top).to_layout(),
|
||||
style: border_style.top.to_layout(),
|
||||
},
|
||||
bottom: BorderSide {
|
||||
color: style.resolve_color(colors.bottom).to_layout(),
|
||||
style: border_style.bottom.to_layout(),
|
||||
},
|
||||
radius: border_radius.to_border_radius(),
|
||||
})),
|
||||
Either::Second(Image::Gradient(ref gradient)) => {
|
||||
let border_widths = border.to_physical(style.writing_mode);
|
||||
let details = match gradient.kind {
|
||||
Some(match gradient.kind {
|
||||
GradientKind::Linear(angle_or_corner) => {
|
||||
BorderDetails::Gradient(display_list::GradientBorder {
|
||||
gradient: convert_linear_gradient(
|
||||
|
@ -1430,80 +1447,39 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
outset: SideOffsets2D::zero(),
|
||||
})
|
||||
},
|
||||
};
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base,
|
||||
border_widths,
|
||||
details,
|
||||
})));
|
||||
})
|
||||
},
|
||||
Either::Second(Image::PaintWorklet(ref paint_worklet)) => {
|
||||
// TODO: this size should be increased by border-image-outset
|
||||
let size = self.border_box.size.to_physical(style.writing_mode);
|
||||
let webrender_image =
|
||||
self.get_webrender_image_for_paint_worklet(state, style, paint_worklet, size);
|
||||
if let Some(webrender_image) = webrender_image {
|
||||
let corners = &border_style_struct.border_image_slice.offsets;
|
||||
let border_image_repeat = &border_style_struct.border_image_repeat;
|
||||
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Image(ImageBorder {
|
||||
image: webrender_image,
|
||||
fill: border_style_struct.border_image_slice.fill,
|
||||
slice: SideOffsets2D::new(
|
||||
corners.0.resolve(webrender_image.height),
|
||||
corners.1.resolve(webrender_image.width),
|
||||
corners.2.resolve(webrender_image.height),
|
||||
corners.3.resolve(webrender_image.width),
|
||||
),
|
||||
// TODO(gw): Support border-image-outset
|
||||
outset: SideOffsets2D::zero(),
|
||||
repeat_horizontal: border_image_repeat.0.to_layout(),
|
||||
repeat_vertical: border_image_repeat.1.to_layout(),
|
||||
}),
|
||||
})));
|
||||
}
|
||||
self.get_webrender_image_for_paint_worklet(state, style, paint_worklet, size)
|
||||
.and_then(|image| build_image_border_details(image, border_style_struct))
|
||||
},
|
||||
Either::Second(Image::Rect(..)) => {
|
||||
// TODO: Handle border-image with `-moz-image-rect`.
|
||||
None
|
||||
},
|
||||
Either::Second(Image::Element(..)) => {
|
||||
// TODO: Handle border-image with `-moz-element`.
|
||||
None
|
||||
},
|
||||
Either::Second(Image::Url(ref image_url)) => {
|
||||
if let Some(url) = image_url.url() {
|
||||
let webrender_image = state.layout_context.get_webrender_image_for_url(
|
||||
Either::Second(Image::Url(ref image_url)) => image_url
|
||||
.url()
|
||||
.and_then(|url| {
|
||||
state.layout_context.get_webrender_image_for_url(
|
||||
self.node,
|
||||
url.clone(),
|
||||
UsePlaceholder::No,
|
||||
);
|
||||
if let Some(webrender_image) = webrender_image {
|
||||
let corners = &border_style_struct.border_image_slice.offsets;
|
||||
let border_image_repeat = &border_style_struct.border_image_repeat;
|
||||
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Image(ImageBorder {
|
||||
image: webrender_image,
|
||||
fill: border_style_struct.border_image_slice.fill,
|
||||
slice: SideOffsets2D::new(
|
||||
corners.0.resolve(webrender_image.height),
|
||||
corners.1.resolve(webrender_image.width),
|
||||
corners.2.resolve(webrender_image.height),
|
||||
corners.3.resolve(webrender_image.width),
|
||||
),
|
||||
// TODO(gw): Support border-image-outset
|
||||
outset: SideOffsets2D::zero(),
|
||||
repeat_horizontal: border_image_repeat.0.to_layout(),
|
||||
repeat_vertical: border_image_repeat.1.to_layout(),
|
||||
}),
|
||||
})));
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.and_then(|image| build_image_border_details(image, border_style_struct)),
|
||||
};
|
||||
if let Some(details) = details {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base,
|
||||
border_widths: border.to_physical(style.writing_mode).to_layout(),
|
||||
details,
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1531,10 +1507,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// absolute bounds.
|
||||
let mut bounds = *bounds;
|
||||
let offset = width + Au::from(style.get_outline().outline_offset);
|
||||
bounds.origin.x = bounds.origin.x - offset;
|
||||
bounds.origin.y = bounds.origin.y - offset;
|
||||
bounds.size.width = bounds.size.width + offset + offset;
|
||||
bounds.size.height = bounds.size.height + offset + offset;
|
||||
bounds = bounds.inflate(offset, offset);
|
||||
|
||||
// Append the outline to the display list.
|
||||
let color = style
|
||||
|
@ -1549,7 +1522,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
);
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(width),
|
||||
border_widths: SideOffsets2D::new_all_same(width).to_layout(),
|
||||
details: BorderDetails::Normal(simple_normal_border(color, outline_style.to_layout())),
|
||||
})));
|
||||
}
|
||||
|
@ -1576,7 +1549,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
);
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)).to_layout(),
|
||||
details: BorderDetails::Normal(simple_normal_border(
|
||||
ColorF::rgb(0, 0, 200),
|
||||
webrender_api::BorderStyle::Solid,
|
||||
|
@ -1623,7 +1596,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
);
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)).to_layout(),
|
||||
details: BorderDetails::Normal(simple_normal_border(
|
||||
ColorF::rgb(0, 0, 200),
|
||||
webrender_api::BorderStyle::Solid,
|
||||
|
@ -2084,9 +2057,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
// Create the filter pipeline.
|
||||
let effects = self.style().get_effects();
|
||||
let mut filters = effects.filter.0.clone();
|
||||
let mut filters: Vec<FilterOp> = effects.filter.0.iter().map(ToLayout::to_layout).collect();
|
||||
if effects.opacity != 1.0 {
|
||||
filters.push(Filter::Opacity(effects.opacity.into()))
|
||||
filters.push(FilterOp::Opacity(effects.opacity.into(), effects.opacity));
|
||||
}
|
||||
|
||||
StackingContext::new(
|
||||
|
@ -2095,7 +2068,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
&border_box,
|
||||
&overflow,
|
||||
self.effective_z_index(),
|
||||
filters.into(),
|
||||
filters,
|
||||
self.style().get_effects().mix_blend_mode.to_layout(),
|
||||
self.transform_matrix(&border_box),
|
||||
self.style().get_used_transform_style().to_layout(),
|
||||
|
@ -2171,8 +2144,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
}
|
||||
|
||||
// Create display items for text decorations.
|
||||
let text_decorations =
|
||||
self.style().get_inheritedtext().text_decorations_in_effect;
|
||||
let text_decorations = self.style().get_inheritedtext().text_decorations_in_effect;
|
||||
|
||||
let stacking_relative_content_box = LogicalRect::from_physical(
|
||||
self.style.writing_mode,
|
||||
|
@ -2697,7 +2669,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
id: None,
|
||||
parent_index: self.clipping_and_scrolling().scrolling,
|
||||
clip: ClippingRegion::from_rect(border_box),
|
||||
content_rect: Rect::zero(),
|
||||
content_rect: LayoutRect::zero(),
|
||||
node_type: ClipScrollNodeType::StickyFrame(sticky_frame_data),
|
||||
});
|
||||
|
||||
|
@ -2755,7 +2727,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
id: Some(new_clip_scroll_node_id),
|
||||
parent_index: self.clipping_and_scrolling().scrolling,
|
||||
clip: clip,
|
||||
content_rect: Rect::new(content_box.origin, content_size),
|
||||
content_rect: Rect::new(content_box.origin, content_size).to_layout(),
|
||||
node_type: ClipScrollNodeType::ScrollFrame(sensitivity),
|
||||
});
|
||||
|
||||
|
@ -2808,7 +2780,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
id: None,
|
||||
parent_index: self.clipping_and_scrolling().scrolling,
|
||||
clip: ClippingRegion::from_rect(&clip_rect),
|
||||
content_rect: Rect::zero(), // content_rect isn't important for clips.
|
||||
content_rect: LayoutRect::zero(), // content_rect isn't important for clips.
|
||||
node_type: ClipScrollNodeType::Clip,
|
||||
});
|
||||
|
||||
|
@ -3148,7 +3120,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
|
|||
);
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(2)),
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(2)).to_layout(),
|
||||
details: BorderDetails::Normal(simple_normal_border(
|
||||
color,
|
||||
webrender_api::BorderStyle::Solid,
|
||||
|
|
|
@ -77,7 +77,7 @@ impl WebRenderDisplayListConverter for DisplayList {
|
|||
impl WebRenderDisplayItemConverter for DisplayItem {
|
||||
fn prim_info(&self) -> webrender_api::LayoutPrimitiveInfo {
|
||||
let tag = match self.base().metadata.pointing {
|
||||
Some(cursor) => Some((self.base().metadata.node.0 as u64, cursor as u16)),
|
||||
Some(cursor) => Some((self.base().metadata.node.0 as u64, cursor)),
|
||||
None => None,
|
||||
};
|
||||
webrender_api::LayoutPrimitiveInfo {
|
||||
|
@ -173,29 +173,11 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
}
|
||||
},
|
||||
DisplayItem::Border(ref item) => {
|
||||
let widths = item.border_widths.to_layout();
|
||||
|
||||
let details = match item.details {
|
||||
BorderDetails::Normal(ref border) => {
|
||||
webrender_api::BorderDetails::Normal(*border)
|
||||
},
|
||||
BorderDetails::Image(ref image) => match image.image.key {
|
||||
None => return,
|
||||
Some(key) => {
|
||||
webrender_api::BorderDetails::Image(webrender_api::ImageBorder {
|
||||
image_key: key,
|
||||
patch: webrender_api::NinePatchDescriptor {
|
||||
width: image.image.width,
|
||||
height: image.image.height,
|
||||
slice: image.slice,
|
||||
},
|
||||
fill: image.fill,
|
||||
outset: image.outset,
|
||||
repeat_horizontal: image.repeat_horizontal,
|
||||
repeat_vertical: image.repeat_vertical,
|
||||
})
|
||||
},
|
||||
},
|
||||
BorderDetails::Image(ref image) => webrender_api::BorderDetails::Image(*image),
|
||||
BorderDetails::Gradient(ref gradient) => {
|
||||
webrender_api::BorderDetails::Gradient(webrender_api::GradientBorder {
|
||||
gradient: builder.create_gradient(
|
||||
|
@ -222,7 +204,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
},
|
||||
};
|
||||
|
||||
builder.push_border(&self.prim_info(), widths, details);
|
||||
builder.push_border(&self.prim_info(), item.border_widths, details);
|
||||
},
|
||||
DisplayItem::Gradient(ref item) => {
|
||||
let gradient = builder.create_gradient(
|
||||
|
@ -265,7 +247,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
item.color,
|
||||
item.blur_radius,
|
||||
item.spread_radius,
|
||||
item.border_radius.to_border_radius(),
|
||||
item.border_radius,
|
||||
item.clip_mode,
|
||||
);
|
||||
},
|
||||
|
@ -303,11 +285,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
stacking_context.transform_style,
|
||||
perspective,
|
||||
stacking_context.mix_blend_mode,
|
||||
stacking_context
|
||||
.filters
|
||||
.iter()
|
||||
.map(ToLayout::to_layout)
|
||||
.collect(),
|
||||
stacking_context.filters.clone(),
|
||||
);
|
||||
},
|
||||
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
||||
|
@ -328,7 +306,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
.define_scroll_frame_with_parent(
|
||||
node.id,
|
||||
parent_id,
|
||||
node.content_rect.to_layout(),
|
||||
node.content_rect,
|
||||
node.clip.main.to_layout(),
|
||||
node.clip.get_complex_clips(),
|
||||
None,
|
||||
|
|
|
@ -714,10 +714,13 @@ impl MallocSizeOf for url::Host {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::BorderRadius);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::BorderStyle);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::BorderWidths);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::BoxShadowClipMode);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::ClipAndScrollInfo);
|
||||
|
@ -728,8 +731,12 @@ malloc_size_of_is_0!(webrender_api::ColorF);
|
|||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::ExtendMode);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::FilterOp);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::GradientStop);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::ImageBorder);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::ImageKey);
|
||||
#[cfg(feature = "servo")]
|
||||
malloc_size_of_is_0!(webrender_api::ImageRendering);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue