aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/canvas/canvas_paint_thread.rs2
-rw-r--r--components/canvas_traits/Cargo.toml2
-rw-r--r--components/canvas_traits/canvas.rs2
-rw-r--r--components/layout/display_list/builder.rs20
-rw-r--r--components/layout/display_list/items.rs39
-rw-r--r--components/layout/display_list/webrender_helpers.rs15
-rw-r--r--components/layout_2020/display_list.rs4
-rw-r--r--components/layout_thread/lib.rs18
-rw-r--r--components/layout_thread_2020/lib.rs14
-rw-r--r--components/malloc_size_of/Cargo.toml2
-rw-r--r--components/script/Cargo.toml1
-rw-r--r--components/script/canvas_state.rs3
12 files changed, 79 insertions, 43 deletions
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs
index a249080cdfd..ace360c25b5 100644
--- a/components/canvas/canvas_paint_thread.rs
+++ b/components/canvas/canvas_paint_thread.rs
@@ -125,7 +125,7 @@ impl<'a> CanvasPaintThread<'a> {
) => {
let data = imagedata.map_or_else(
|| vec![0; image_size.width as usize * image_size.height as usize * 4],
- |bytes| bytes.into(),
+ |bytes| bytes.into_vec(),
);
self.canvas(canvas_id).draw_image(
data,
diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml
index faf5aebcf32..6d37f90f941 100644
--- a/components/canvas_traits/Cargo.toml
+++ b/components/canvas_traits/Cargo.toml
@@ -22,7 +22,7 @@ malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1"
pixels = {path = "../pixels"}
serde = "1.0"
-serde_bytes = "0.10"
+serde_bytes = "0.11"
servo_config = {path = "../config"}
sparkle = "0.1"
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs
index db678b42572..7d7a86e9961 100644
--- a/components/canvas_traits/canvas.rs
+++ b/components/canvas_traits/canvas.rs
@@ -172,7 +172,7 @@ impl SurfaceStyle {
repeat_y: bool,
) -> Self {
Self {
- surface_data: surface_data.into(),
+ surface_data: ByteBuf::from(surface_data),
surface_size,
repeat_x,
repeat_y,
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index c44324d43a1..4fd1b4b3988 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -67,7 +67,7 @@ use style::values::generics::image::{GradientKind, PaintWorklet};
use style::values::specified::ui::CursorKind;
use style::values::RGBA;
use style_traits::ToCss;
-use webrender_api::units::{LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
+use webrender_api::units::{LayoutRect, LayoutTransform, LayoutVector2D};
use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF};
use webrender_api::{ColorU, ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LineStyle};
use webrender_api::{NinePatchBorder, NinePatchBorderSource, NormalBorder};
@@ -357,9 +357,6 @@ impl<'a> DisplayListBuildState<'a> {
}
fn add_image_item(&mut self, base: BaseDisplayItem, item: webrender_api::ImageDisplayItem) {
- if item.stretch_size == LayoutSize::zero() {
- return;
- }
self.add_display_item(DisplayItem::Image(CommonDisplayItem::new(base, item)))
}
@@ -833,6 +830,10 @@ impl Fragment {
index,
);
+ if placement.tile_size.is_empty_or_negative() {
+ return;
+ }
+
state.clipping_and_scrolling_scope(|state| {
if !placement.clip_radii.is_zero() {
let clip_id =
@@ -849,9 +850,9 @@ impl Fragment {
);
debug!("(building display list) adding background image.");
- state.add_image_item(
+ let item = CommonDisplayItem::new(
base,
- webrender_api::ImageDisplayItem {
+ webrender_api::RepeatingImageDisplayItem {
bounds: placement.bounds.to_f32_px(),
common: items::empty_common_item_properties(),
image_key: webrender_image.key.unwrap(),
@@ -862,6 +863,7 @@ impl Fragment {
color: webrender_api::ColorF::WHITE,
},
);
+ state.add_display_item(DisplayItem::RepeatingImage(item))
});
}
@@ -1835,8 +1837,6 @@ impl Fragment {
bounds: stacking_relative_content_box.to_layout(),
common: items::empty_common_item_properties(),
image_key: id,
- stretch_size: stacking_relative_content_box.size.to_layout(),
- tile_spacing: LayoutSize::zero(),
image_rendering: self
.style
.get_inherited_box()
@@ -1858,8 +1858,6 @@ impl Fragment {
bounds: stacking_relative_content_box.to_layout(),
common: items::empty_common_item_properties(),
image_key: *image_key,
- stretch_size: stacking_relative_border_box.size.to_layout(),
- tile_spacing: LayoutSize::zero(),
image_rendering: ImageRendering::Auto,
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
color: webrender_api::ColorF::WHITE,
@@ -1891,8 +1889,6 @@ impl Fragment {
bounds: stacking_relative_border_box.to_layout(),
common: items::empty_common_item_properties(),
image_key,
- stretch_size: stacking_relative_content_box.size.to_layout(),
- tile_spacing: LayoutSize::zero(),
image_rendering: ImageRendering::Auto,
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
color: webrender_api::ColorF::WHITE,
diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs
index f838a95bf08..d7afa8423c0 100644
--- a/components/layout/display_list/items.rs
+++ b/components/layout/display_list/items.rs
@@ -25,10 +25,11 @@ use std::fmt;
use style::computed_values::_servo_top_layer::T as InTopLayer;
use webrender_api as wr;
use webrender_api::units::{LayoutPixel, LayoutPoint, LayoutRect, LayoutSize, LayoutTransform};
-use webrender_api::{BorderRadius, ClipId, ClipMode, CommonItemProperties, ComplexClipRegion};
-use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, GradientStop, ImageKey};
-use webrender_api::{MixBlendMode, ScrollSensitivity, Shadow, SpatialId};
-use webrender_api::{StickyOffsetBounds, TransformStyle};
+use webrender_api::{
+ BorderRadius, ClipId, ClipMode, CommonItemProperties, ComplexClipRegion, ExternalScrollId,
+ FilterOp, GlyphInstance, GradientStop, ImageKey, MixBlendMode, PrimitiveFlags,
+ ScrollSensitivity, Shadow, SpatialId, StickyOffsetBounds, TransformStyle,
+};
pub use style::dom::OpaqueNode;
@@ -377,6 +378,7 @@ pub enum DisplayItem {
Rectangle(Box<CommonDisplayItem<wr::RectangleDisplayItem>>),
Text(Box<CommonDisplayItem<wr::TextDisplayItem, Vec<GlyphInstance>>>),
Image(Box<CommonDisplayItem<wr::ImageDisplayItem>>),
+ RepeatingImage(Box<CommonDisplayItem<wr::RepeatingImageDisplayItem>>),
Border(Box<CommonDisplayItem<wr::BorderDisplayItem, Vec<GradientStop>>>),
Gradient(Box<CommonDisplayItem<wr::GradientDisplayItem, Vec<GradientStop>>>),
RadialGradient(Box<CommonDisplayItem<wr::RadialGradientDisplayItem, Vec<GradientStop>>>),
@@ -451,7 +453,7 @@ pub fn empty_common_item_properties() -> CommonItemProperties {
clip_id: ClipId::root(wr::PipelineId::dummy()),
spatial_id: SpatialId::root_scroll_node(wr::PipelineId::dummy()),
hit_info: None,
- is_backface_visible: false,
+ flags: PrimitiveFlags::empty(),
}
}
@@ -672,6 +674,7 @@ impl DisplayItem {
DisplayItem::Rectangle(ref rect) => &rect.base,
DisplayItem::Text(ref text) => &text.base,
DisplayItem::Image(ref image_item) => &image_item.base,
+ DisplayItem::RepeatingImage(ref image_item) => &image_item.base,
DisplayItem::Border(ref border) => &border.base,
DisplayItem::Gradient(ref gradient) => &gradient.base,
DisplayItem::RadialGradient(ref gradient) => &gradient.base,
@@ -703,6 +706,7 @@ impl DisplayItem {
DisplayItem::Rectangle(ref item) => item.item.common.clip_rect,
DisplayItem::Text(ref item) => item.item.bounds,
DisplayItem::Image(ref item) => item.item.bounds,
+ DisplayItem::RepeatingImage(ref item) => item.item.bounds,
DisplayItem::Border(ref item) => item.item.bounds,
DisplayItem::Gradient(ref item) => item.item.bounds,
DisplayItem::RadialGradient(ref item) => item.item.bounds,
@@ -736,20 +740,21 @@ impl fmt::Debug for DisplayItem {
f,
"{} @ {:?} {:?}",
match *self {
- DisplayItem::Rectangle(_) => "Rectangle".to_owned(),
- DisplayItem::Text(_) => "Text".to_owned(),
- DisplayItem::Image(_) => "Image".to_owned(),
- DisplayItem::Border(_) => "Border".to_owned(),
- DisplayItem::Gradient(_) => "Gradient".to_owned(),
- DisplayItem::RadialGradient(_) => "RadialGradient".to_owned(),
- DisplayItem::Line(_) => "Line".to_owned(),
- DisplayItem::BoxShadow(_) => "BoxShadow".to_owned(),
- DisplayItem::PushTextShadow(_) => "PushTextShadow".to_owned(),
- DisplayItem::PopAllTextShadows(_) => "PopTextShadow".to_owned(),
- DisplayItem::Iframe(_) => "Iframe".to_owned(),
+ DisplayItem::Rectangle(_) => "Rectangle",
+ DisplayItem::Text(_) => "Text",
+ DisplayItem::Image(_) => "Image",
+ DisplayItem::RepeatingImage(_) => "RepeatingImage",
+ DisplayItem::Border(_) => "Border",
+ DisplayItem::Gradient(_) => "Gradient",
+ DisplayItem::RadialGradient(_) => "RadialGradient",
+ DisplayItem::Line(_) => "Line",
+ DisplayItem::BoxShadow(_) => "BoxShadow",
+ DisplayItem::PushTextShadow(_) => "PushTextShadow",
+ DisplayItem::PopAllTextShadows(_) => "PopTextShadow",
+ DisplayItem::Iframe(_) => "Iframe",
DisplayItem::PushStackingContext(_) |
DisplayItem::PopStackingContext(_) |
- DisplayItem::DefineClipScrollNode(_) => "".to_owned(),
+ DisplayItem::DefineClipScrollNode(_) => "",
},
self.bounds(),
self.base().clip_rect
diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs
index 993e2b38cef..51972fed316 100644
--- a/components/layout/display_list/webrender_helpers.rs
+++ b/components/layout/display_list/webrender_helpers.rs
@@ -11,10 +11,10 @@ use crate::display_list::items::{BaseDisplayItem, ClipScrollNode, ClipScrollNode
use crate::display_list::items::{DisplayItem, DisplayList, StackingContextType};
use msg::constellation_msg::PipelineId;
use webrender_api::units::LayoutPoint;
-use webrender_api::{self, ClipId, CommonItemProperties, DisplayItem as WrDisplayItem};
-use webrender_api::{DisplayListBuilder, PropertyBinding, PushStackingContextDisplayItem};
use webrender_api::{
- RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext,
+ self, ClipId, CommonItemProperties, DisplayItem as WrDisplayItem, DisplayListBuilder,
+ PrimitiveFlags, PropertyBinding, PushStackingContextDisplayItem, RasterSpace,
+ ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext,
};
struct ClipScrollState {
@@ -121,6 +121,11 @@ impl DisplayItem {
builder.push_item(&WrDisplayItem::Image(item.item));
IsContentful(true)
},
+ DisplayItem::RepeatingImage(ref mut item) => {
+ item.item.common = build_common_item_properties(&item.base, state);
+ builder.push_item(&WrDisplayItem::RepeatingImage(item.item));
+ IsContentful(true)
+ },
DisplayItem::Border(ref mut item) => {
item.item.common = build_common_item_properties(&item.base, state);
if !item.data.is_empty() {
@@ -232,7 +237,7 @@ impl DisplayItem {
let wr_item = PushStackingContextDisplayItem {
origin: bounds.origin,
spatial_id,
- is_backface_visible: true,
+ prim_flags: PrimitiveFlags::default(),
stacking_context: StackingContext {
transform_style: stacking_context.transform_style,
mix_blend_mode: stacking_context.mix_blend_mode,
@@ -331,7 +336,7 @@ fn build_common_item_properties(
spatial_id: state.active_spatial_id,
clip_id: state.active_clip_id,
// TODO(gw): Make use of the WR backface visibility functionality.
- is_backface_visible: true,
+ flags: PrimitiveFlags::default(),
hit_info: tag,
}
}
diff --git a/components/layout_2020/display_list.rs b/components/layout_2020/display_list.rs
index 315c3bbc766..c153b04294c 100644
--- a/components/layout_2020/display_list.rs
+++ b/components/layout_2020/display_list.rs
@@ -8,7 +8,7 @@ use crate::style_ext::ComputedValuesExt;
use app_units::Au;
use euclid::{self, SideOffsets2D};
use style::values::computed::{BorderStyle, Length};
-use webrender_api::{self as wr, units, CommonItemProperties};
+use webrender_api::{self as wr, units, CommonItemProperties, PrimitiveFlags};
pub struct DisplayListBuilder {
pipeline_id: wr::PipelineId,
@@ -76,7 +76,7 @@ impl BoxFragment {
spatial_id: wr::SpatialId::root_scroll_node(builder.pipeline_id),
hit_info: None,
// TODO(gw): Make use of the WR backface visibility functionality.
- is_backface_visible: true,
+ flags: PrimitiveFlags::default(),
};
self.background_display_items(builder, &common);
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 48b7591c242..848ed595381 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -532,6 +532,20 @@ impl LayoutThread {
trace_layout: bool,
dump_flow_tree: bool,
) -> LayoutThread {
+ // Let webrender know about this pipeline by sending an empty display list.
+ let mut epoch = Epoch(0);
+ let webrender_api = webrender_api_sender.create_api();
+ let mut txn = webrender_api::Transaction::new();
+ txn.set_display_list(
+ webrender_api::Epoch(epoch.0),
+ None,
+ Default::default(),
+ (id.to_webrender(), Default::default(), Default::default()),
+ false,
+ );
+ webrender_api.send_transaction(webrender_document, txn);
+ epoch.next();
+
let device = Device::new(
MediaType::screen(),
window_size.initial_viewport,
@@ -576,9 +590,9 @@ impl LayoutThread {
document_shared_lock: None,
running_animations: ServoArc::new(RwLock::new(Default::default())),
expired_animations: ServoArc::new(RwLock::new(Default::default())),
- epoch: Cell::new(Epoch(0)),
+ epoch: Cell::new(epoch),
viewport_size: Size2D::new(Au(0), Au(0)),
- webrender_api: webrender_api_sender.create_api(),
+ webrender_api,
webrender_document,
stylist: Stylist::new(device, QuirksMode::NoQuirks),
rw_data: Arc::new(Mutex::new(LayoutThreadData {
diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs
index 106dace088b..bf18c584231 100644
--- a/components/layout_thread_2020/lib.rs
+++ b/components/layout_thread_2020/lib.rs
@@ -450,6 +450,20 @@ impl LayoutThread {
window_size: WindowSizeData,
relayout_event: bool,
) -> LayoutThread {
+ // Let webrender know about this pipeline by sending an empty display list.
+ let mut epoch = Epoch(0);
+ let webrender_api = webrender_api_sender.create_api();
+ let mut txn = webrender_api::Transaction::new();
+ txn.set_display_list(
+ webrender_api::Epoch(epoch.0),
+ None,
+ Default::default(),
+ (id.to_webrender(), Default::default(), Default::default()),
+ false,
+ );
+ webrender_api.send_transaction(webrender_document, txn);
+ epoch.next();
+
// The device pixel ratio is incorrect (it does not have the hidpi value),
// but it will be set correctly when the initial reflow takes place.
let device = Device::new(
diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml
index 836d637f1eb..3d2867d78b1 100644
--- a/components/malloc_size_of/Cargo.toml
+++ b/components/malloc_size_of/Cargo.toml
@@ -36,7 +36,7 @@ hyper_serde = { version = "0.11", optional = true }
keyboard-types = {version = "0.4.3", optional = true}
selectors = { path = "../selectors" }
serde = { version = "1.0.27", optional = true }
-serde_bytes = { version = "0.10", optional = true }
+serde_bytes = { version = "0.11", optional = true }
servo_arc = { path = "../servo_arc" }
smallbitvec = "2.3.0"
smallvec = "0.6"
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index 23873d59767..c44a9a06a54 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -91,6 +91,7 @@ script_plugins = {path = "../script_plugins"}
script_traits = {path = "../script_traits"}
selectors = { path = "../selectors" }
serde = {version = "1", features = ["derive"]}
+serde_bytes = "0.11"
servo_allocator = {path = "../allocator"}
servo_arc = {path = "../servo_arc"}
servo_atoms = {path = "../atoms"}
diff --git a/components/script/canvas_state.rs b/components/script/canvas_state.rs
index 76fd9d12caf..7c9ad232f30 100644
--- a/components/script/canvas_state.rs
+++ b/components/script/canvas_state.rs
@@ -47,6 +47,7 @@ use net_traits::request::CorsSettings;
use pixels::PixelFormat;
use profile_traits::ipc as profiled_ipc;
use script_traits::ScriptMsg;
+use serde_bytes::ByteBuf;
use servo_url::{ImmutableOrigin, ServoUrl};
use std::cell::Cell;
use std::fmt;
@@ -505,7 +506,7 @@ impl CanvasState {
let smoothing_enabled = self.state.borrow().image_smoothing_enabled;
self.send_canvas_2d_msg(Canvas2dMsg::DrawImage(
- Some(image_data.into()),
+ Some(ByteBuf::from(image_data)),
image_size,
dest_rect,
source_rect,