mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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.
This commit is contained in:
parent
e66ab111a6
commit
61fb84d6a0
5 changed files with 34 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue