aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorDaniel Alley <dalley@redhat.com>2020-03-29 17:19:39 -0400
committerDaniel Alley <dalley@redhat.com>2020-04-03 11:34:04 -0400
commit61fb84d6a09b04f7d2de2ebbda3db0d10925561f (patch)
tree741f6fa8cd3f2ac20aa7d3206a24c2cf60c19a2a /components
parente66ab111a6fb5ea9fc7684a0ebeddbe6aa2134f1 (diff)
downloadservo-61fb84d6a09b04f7d2de2ebbda3db0d10925561f.tar.gz
servo-61fb84d6a09b04f7d2de2ebbda3db0d10925561f.zip
Don't send empty canvases to WebRender
If any dimension of a canvas is 0, don't try to render it as it causes problems inside webrender.
Diffstat (limited to 'components')
-rw-r--r--components/layout/display_list/builder.rs6
-rw-r--r--components/layout_2020/display_list/mod.rs1
-rw-r--r--components/layout_2020/replaced.rs7
3 files changed, 14 insertions, 0 deletions
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index 56748d55d2b..17f946f7187 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -1875,6 +1875,12 @@ impl Fragment {
}
},
SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => {
+ if canvas_fragment_info.dom_width == Au(0) ||
+ canvas_fragment_info.dom_height == Au(0)
+ {
+ return;
+ }
+
let image_key = match canvas_fragment_info.source {
CanvasFragmentSource::WebGL(image_key) => image_key,
CanvasFragmentSource::Image(ref ipc_renderer) => match *ipc_renderer {
diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs
index 46c31934831..dccee5ea71a 100644
--- a/components/layout_2020/display_list/mod.rs
+++ b/components/layout_2020/display_list/mod.rs
@@ -87,6 +87,7 @@ impl Fragment {
.rect
.to_physical(i.style.writing_mode, containing_block)
.translate(containing_block.origin.to_vector());
+
let common = builder.common_properties(rect.clone().to_webrender());
builder.wr.push_image(
&common,
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs
index 334ff44a665..f3501ce0e71 100644
--- a/components/layout_2020/replaced.rs
+++ b/components/layout_2020/replaced.rs
@@ -102,6 +102,7 @@ impl ReplacedContent {
let width = (intrinsic_size_in_dots.width as CSSFloat) / dppx;
let height = (intrinsic_size_in_dots.height as CSSFloat) / dppx;
+
return Some(Self {
kind,
intrinsic: IntrinsicSizes {
@@ -201,6 +202,12 @@ impl ReplacedContent {
.into_iter()
.collect(),
ReplacedContentKind::Canvas(canvas_info) => {
+ if self.intrinsic.width == Some(Length::zero()) ||
+ self.intrinsic.height == Some(Length::zero())
+ {
+ return vec![];
+ }
+
let image_key = match canvas_info.source {
CanvasSource::WebGL(image_key) => image_key,
CanvasSource::Image(ref ipc_renderer) => match *ipc_renderer {