Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't send empty canvases to WebRender #26065
Conversation
highfive
commented
Mar 31, 2020
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @jdm (or someone else) soon. |
highfive
commented
Mar 31, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Mar 31, 2020
|
Cannot run test-tidy locally because Fedora 31 is Python 3 only |
7d7fb79
to
f049a3b
|
Since we have a minimal test case, it would be nice to add a test that makes sure we don't regress on this panic. Since this will be a servo-specific test, I would put it here: |
|
There's no issue specifically relating to zero-sized-canvas panic -- should I create one specifically to reference in a comment, or just reference the motionmark issue? |
|
Referencing the motionmark issue would be fine since that's where most the discussion is at regarding this fix. |
|
Can you run Once that is done, this looks good to me. Thanks again! |
|
@bors-servo r+ |
|
|
|
I'm pretty sure you want to apply the fix also to |
|
@gterzian ah good catch! |
|
No idea if that is the correct fix for layout 2020, but it seems like a decent guess. |
|
Maybe it would make more sense here? servo/components/layout_2020/replaced.rs Lines 203 to 230 in 75ca3d8 It might be good to check with someone familiar with layout 2020 canvas. |
| @@ -411,6 +411,9 @@ where | |||
| fn as_canvas(self) -> Option<(CanvasInfo, PhysicalSize<f64>)> { | |||
| let node = self.to_threadsafe(); | |||
| let canvas_data = node.canvas_data()?; | |||
| if canvas_data.width == 0 || canvas_data.height == 0 { | |||
| return None; | |||
This comment has been minimized.
This comment has been minimized.
SimonSapin
Apr 1, 2020
Member
This doesn’t look right: it’ll generate a non-replaced box (as for <div></div>), but we want to generate a replaced box, which might have different layout behavior (even if zero-size). Somewhere under layout_2020/display_list/ would be the right place for this change.
|
Error syncing changes upstream. Logs saved in error-snapshot-1585841672750. |
67eb348
to
cfa7092
|
Alright, I've tested this patch for layout 2020 and it seems to work... If there is somewhere better, let me know. I couldn't find anywhere that looked more appropriate. Comparing float equality makes me cringe a little bit but that is the only size available at this location. |
|
Sorry, but this still doesn’t look right. Returning |
|
@SimonSapin Apologies, but I simply do not know where this is supposed to go. The only usages of the word "replace" under the
And the one place under Would it be better to just merge the fix for layout 2013 and file an issue for layout 2020? Or is there any chance you could narrow it down a bit more? |
That’s fine with me too. This code generates a fragment for the replaced box for a servo/components/layout_2020/replaced.rs Lines 203 to 230 in e66ab11 It generates a servo/components/layout_2020/display_list/mod.rs Lines 84 to 99 in e66ab11 In that second location, it should be possible to check for |
|
@SimonSapin Thanks! I think the more accurate description of this issue is probably the latter one, that Webrender shouldn't be rendering 0-size canvases. The latter patch you suggested works (slightly modified), the others did not. |
If any dimension of a canvas is 0, don't try to render it as it causes problems inside webrender.
|
Looks good, thanks! @bors-servo r=cbrewster,SimonSapin |
|
|
|
|
dralley commentedMar 31, 2020
•
edited
If any dimension of a canvas is 0, don't try to display it as it causes
problems inside webrender.
Minimal test case available here: #21411 (comment)
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors